Is it possible to "pretty print" my input integral in Mathematica like Wolfram|Alpha does?
Something like
heldint = HoldForm[Integrate[r^3, {t, 0, 2 Pi}, {r, 0, 2}, {z, r^2, 4}]];
int = ReleaseHold[heldint];
Row[{heldint, " \[LongEqual] ", int, " \[TildeTilde] ", N[int]}] // TraditionalForm
TraditionalForm
looks nice but it also incurs additional complexity in handling expressions. If you attempt to evaluate a TraditionalForm
cell you will be asked if you wish to interpret it as input, and the equivalence is not always complete. Fortunately Mathematica is quite cabable of displaying formatted integrals in StandardForm
.
If you merely wrap your expression in HoldForm
and evaluate it you will get:
Integrate[r^3, {t, 0, 2 Pi}, {r, 0, 2}, {z, r^2, 4}] // HoldForm
You can convert the expression in place without evaluation by selecting it and using menu Cell > Convert To > StandardForm which under Windows has the keyboard shortcut Shift+Ctrl+N. Example:
Note the active syntax highlighting which is not present in TraditionalForm
.
Mathematica 10 introduced a new set of functions that can help with this:
Inactive[Integrate][r^3, {t, 0, 2 Pi}, {r, 0, 2}, {z, r^2, 4}]
Or, obtaining same output:
Inactivate[Integrate[r^3, {t, 0, 2 Pi}, {r, 0, 2}, {z, r^2, 4}]]
And then:
Activate[%]
(* 32 Pi/3 *)