I need to have time differentials to look like the 'textbook'. My code is

Dt[x y^2] /. {Dt[x] -> dx/dt, Dt[y] -> dy/dt} 

which gives the output

(2 dy x y)/dt + (dx y^2)/dt. 

This is very hard to follow.

My question is how can the output be made to look like

2 x y dy/dt + y^2  dx/dt 

(only with dy/dt and dx/dt vertical).


  • $\begingroup$ Strange. #[x] /. {#[x_] -> h} & /@ {Dt, g} == {Dt[x], h} $\endgroup$
    – ssch
    Sep 3 '13 at 19:46
  • 1
    $\begingroup$ Welcome to Mathematica.SE! Could you please change your username to something recognizable, instead of "user9292"? Then you can remove the signature from the post itself. This will comply with the site etiquette. $\endgroup$
    – Szabolcs
    Sep 3 '13 at 19:49
  • $\begingroup$ Nevermind my strangeness above, the pattern got differentiated. HoldPattern made everything better $\endgroup$
    – ssch
    Sep 3 '13 at 19:57
  • $\begingroup$ Have you asked this question Basins of Attraction? If this is the case the both accounts should be merged. $\endgroup$
    – Artes
    Sep 3 '13 at 20:52

I recommend using TraditionalForm for readability, but I do not recommend altering the looks of the output too much.

To look at the output in TraditionalForm, either use Dt[x y^2] // TraditionalForm as the input or select the output cell and press ctrl-shift-T. In the preferences you can set TraditionalForm as the default output.

I do not recommend trying to change the looks of the output too much because Mathematica is a programming language, and thus requires a precise, unambiguous syntax. TraditionalForm is already pushing this, as it is not entirely unambiguous (you'll get a warning popup when you try to use it as input). This is not as big a problem in practice as the warning would let you think. Most of the time everything will be fine. If you use output that Mathematica generated, then you can be confident that it'll be interpreted correctly when you use it as input.

So, to sum up: computers just follow instructions blindly, so you need to make sure those instructions are very precise. This places constraints on what notations are practical.

Mathematical notation used in textbooks is typically ambiguous and relies on context and the expectations of the target audience.


Not the answer you're looking for? Browse other questions tagged or ask your own question.