Custom Format for (b-a)

*To*: mathgroup at smc.vnet.net*Subject*: [mg5667] Custom Format for (b-a)*From*: Ersek_Ted%PAX1A at mr.nawcad.navy.mil*Date*: Sun, 5 Jan 1997 16:00:41 -0500*Sender*: owner-wri-mathgroup at wolfram.com

Hello Math Group, When Mma displays an expression involving sums the terms are always sorted. Consider the following example: Exp[c+w (z-r)]+a(z-r) This is displayed as: Exp[c+w(-r+z)]+a(-r+z) It comes out this way because Sort[{z, -r}]->{-r,z}. I believe the output looks better if "z-r" is used rather than "-r+z". I would only want it this way when two terms are added, and I would want it to apply regardelss of where the sum is in the expression. I thnik this can be done using the following: Format[Plus[Times[-1,a_], b_]]:= ..........some output............... /;OrederedQ[a,b] However, I haven't been able to come up with code that gives adequate results. Can anyone help? T.E.