Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8079
| From | JUN <noeckel@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Derivatives Output as TraditionalForm |
| Date | 2012-01-22 12:22 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jfgv2e$pdc$1@smc.vnet.net> (permalink) |
| References | <jfb2rl$hls$1@smc.vnet.net> <jfe3s2$a34$1@smc.vnet.net> |
On Jan 21, 2:26 am, "Oleksandr Rasputinov"
<oleksandr_rasputi...@hmamail.com> wrote:
> On Fri, 20 Jan 2012 06:50:29 -0000, mathgroup <fizzym...@knology.net>
> wrote:
>
>
>
>
>
>
>
>
>
> > The following code was offered in a Wolfram Blog to make Derivatives
> > print
> > out as they would be written with pencil and paper rather then
> > f^(0,1)[x,y] for example....which is standard Mathematica output....here
> > is the code(written by Simon, I think was his name).....the original
> > Blog had a Wolfram program pdConv ...however, you had to apply it to
> > each expression whereas this code , once run, does it throughout the
> > Notebook....
>
> > Derivative/:MakeBoxes[Derivative[inds__][g_][vars__],TraditionalForm]:=ToBo xes[Apply[Defer[D[g[vars],##]]&,Transpose[{{vars},{inds}}]/.{{var_,0}:>Sequ ence[],{var_,1}:>{var}}],TraditionalForm]
>
> > I have 2 Questions....
>
> > (1) Why isnt this code standard within Mathematica rather then having
> > to be Coded by the user?....I used to do all this with Format which
> > was a Royal Nightmare by comparison.........I have never seen what
> > purpose this output f^(0,1)[x,y] served.......or does it???
>
> The notation Mathematica uses is less commonly seen but there is nothing
> especially non-standard about it. If you don't like it, you can change it,
> as the code example demonstrates. As for why Mathematica doesn't use the
> more typical notation in TraditionalForm output, I don't know for sure,
> but I would hazard a guess that it is so that TraditionalForm can be
> re-interpreted into StandardForm without having to be littered with
> InterpretationBoxes to clarify the ambiguous notation. Implementing such
> features is not free, of course, so maybe WRI took the view that their
> time was better spent doing other things.
>
>
>
> > (2) Second....if I want to modify this code to get output as
> > df/dx rather then df[x,y]/dx, , for example , how do I change it?
>
> Derivative/:MakeBoxes[Derivative[inds__][g_][vars__],TraditionalForm]:=
ToBo xes[Apply[Defer[D[g,##]]&,Transpose[{{vars},{inds}}]/.{{var_,0}:>Sequence[] ,{var_,1}:>{var}}],TraditionalForm]
If you look at the comments on that blog,
http://blog.wolfram.com/2011/12/15/mathematica-qa-series-converting-to-conventional-mathematical-typesetting/
you'll see that there were some problems with that approach. E.g., try
the above definition with this derivative:
D[f[g[x]] + h[x, y], {x, 2}] // TraditionalForm
I wouldn't consider the result acceptable. That's why I suggested a
different approach on that page:
Derivative /:
MakeBoxes[Derivative[\[Alpha]__][f1_][vars__Symbol],
TraditionalForm] := Module[{bb, dd, sp},
MakeBoxes[dd, _] ^=
If[Length[{\[Alpha]}] == 1, "\[DifferentialD]", "\[PartialD]"];
MakeBoxes[sp, _] ^= "\[ThinSpace]";
bb /: MakeBoxes[bb[x__], _] := RowBox[Map[ToBoxes[#] &, {x}]];
FractionBox[ToBoxes[bb[dd^Plus[\[Alpha]], f1]],
ToBoxes[Apply[bb,
Riffle[Map[bb[dd, #] &,
Select[({vars}^{\[Alpha]}), (# =!= 1 &)]], sp]]]]
]
Jens
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Derivatives Output as TraditionalForm "mathgroup " <fizzymath@knology.net> - 2012-01-20 06:50 +0000
Re: Derivatives Output as TraditionalForm "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2012-01-21 10:26 +0000
Re: Derivatives Output as TraditionalForm JUN <noeckel@gmail.com> - 2012-01-22 12:22 +0000
Re: Derivatives Output as TraditionalForm A Retey <awnl@gmx-topmail.de> - 2012-01-22 12:21 +0000
Re: Derivatives Output as TraditionalForm "mathgroup " <fizzymath@knology.net> - 2012-01-23 07:57 +0000
Re: Derivatives Output as TraditionalForm JUN <noeckel@gmail.com> - 2012-01-24 10:11 +0000
csiph-web