what are the possible ways to force mathematica to show -1+a as a-1
I am just getting started with pattern in mathematica. I want to know what the different ways to forc开发者_运维技巧e mma to show -1+a
as a-1
. Many thanks!
The simplest way is probably -1 + a // TraditionalForm
.
One due to Jean-Marc Gulliet (MathGroup)
(You may also be interested in the reply of Jens-Peer Kuska to this post)
PolynomialForm[-1 + a, TraditionalOrder -> True]
Out[34]= a-1
(PolynomialForm
is undocumented, as far as I know. I am using Mma 7.)
You could probably use a hack like this
$PrePrint = (# /. -1 + expr__ :> Interpretation[Row[{expr, -1}], expr - 1]) &
But (as WReach suggests) it might be best to use the default Mathematica ordering of expressions and use TraditionalForm
when you want it to look more like what a human would write.
精彩评论