Tag Archives: Mathematica

Tweaking Mathematica output for order-of-magnitude estimates

Here is a trick I find useful when quickly estimating order-of magnitude values of various quantities  in Mathematica. The statements below force the format of all numerical output to be in the scientific notation (x 10^y).

oldPost = $Post;
format[x_Real] :=
NumberForm[x, ExponentFunction -> (If[-1 < # < 1, Null, #] &)];
format[x_] := x;
$Post = format;

When you execute these statements, the output formatting will persist for the rest of the mmka session. If you want to go back to the default output format in the session, execute

$Post = oldPost;