# Thread: Mathematica: Converting output display for derivatives

1. ## Mathematica: Converting output display for derivatives

Hi, I am using Mathematica 6.0 and I have to convert the display of a very large output expression. But my problem can be simply put as this:

Let's say my input is:
Input: D[f[x, y], x, y]

The output expression looks like this:
Output: $f^{(1,1)}[x,y]$

I want to "convert" this output to look like:
Output: $\frac{\partial^2{f}}{\partial{x}\partial{y}}$

How can I do it? I think this is more complex than it seems. Any help would be appreciated.

Thanks.

2. I found this package:
Fancy Formatting of Partial Derivatives -- from Wolfram Library Archive

Unfortunately, it does not seem to be compatible with new versions of Mathematica. I tried to come up with a quick and dirty fix, which is not particularly elegant but should work fine. Using DFormat[On] should get you what you need. Calling DFormat[Off] switches back to normal.

Code:
denomList[nn_List, vars_List] :=
Block[{i, result = {}},
Do[Which[
TrueQ[nn[[i]] == 0], Null,
TrueQ[nn[[i]] == 1],
result = Join[result, {"\[PartialD]", vars[[i]]}],
True, result = Join[result, {"\[PartialD]", nn[[i]]}] ],
{i, 1, Length[nn]} ];
result]

DFormat[On] :=
(Unprotect[Derivative];
Format[Literal[Derivative[nn__][ff_][vars : (_Symbol ..)]]] :=
If[TrueQ[Plus @@ {nn} == 1],
SequenceForm["\[PartialD]", ff[vars]],
SequenceForm[Superscript["\[PartialD]", Plus @@ {nn}], ff[vars]]]/
SequenceForm @@ denomList[{nn}, {vars}];
Protect[Derivative])

DFormat[Off] :=
(Unprotect[Derivative];
Format[Literal[Derivative[nn__][ff_][vars : (_Symbol ..)]]] =.;
Protect[Derivative])

3. Actually, scratch that. With the "Notation" package, you can do it easily. I have to admit that I have not figured out how to type in these expression; MMA seems to be very bitchy about it. So I try to explain it this way: