Results 1 to 3 of 3

Math Help - Mathematica: Converting output display for derivatives

  1. #1
    Newbie
    Joined
    Aug 2009
    Posts
    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.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Junior Member
    Joined
    Aug 2009
    Posts
    29
    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])
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    Aug 2009
    Posts
    29
    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:

    Load the "Notation" package:
    << Notation`

    A new window should pop up with a "Notation Palette". Click the first of the buttons in that window.

    Type in what you find in the MMA-Tutorial in the MMA-Help under Notation/tutorial/NotationSymbolizeAndInfixNotation
    You can find what you need as Input 7 in that tutorial.

    I hope that helps.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 0
    Last Post: December 1st 2010, 04:52 PM
  2. How to extract mathematica output
    Posted in the Math Software Forum
    Replies: 1
    Last Post: September 22nd 2010, 12:57 PM
  3. Replies: 4
    Last Post: May 15th 2009, 04:37 AM
  4. Display a number...
    Posted in the Math Topics Forum
    Replies: 2
    Last Post: February 22nd 2008, 08:54 AM

Search Tags


/mathhelpforum @mathhelpforum