Re: Modifying displayed form of an expression?

*To*: mathgroup at smc.vnet.net*Subject*: [mg57139] Re: [mg57127] Modifying displayed form of an expression?*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Thu, 19 May 2005 03:08:06 -0400 (EDT)*References*: <200505170135.VAA23181@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 17 May 2005, at 10:35, AES wrote: > I have a number of symbolic results which emerge from a Mathematica > calculation in the form > > a Exp[b] > f = ---------------------------------- > Exp[c] - Exp[d] > > where a is "other stuff" and b, c and d are simple sums like b = b1 + > b2 > + b3. By default Mathematica seems to shuffle the elements of b, c and > d in these results such that there will be only positive signs in the > exponents b, c and d. > > I want to force Mathematica to display each of these expressions in the > form > > a Exp[b - c] > ------------------------------------------- > 1 - Exp[d - c] > > so that the leading term in the denominator is always one (which will > in > fact mean that these expressions all have the same common denominator). > How might I do this? > > Note: I only want to force this display of each expression _once_, when > I first calculate it, and I'm willing to do some handwork on each > expression to accomplish this. Thus, I don't need some sophisticated > general tool, just a way to do this "by hand". I've been trying Inputs > like > > (Exp[-c] Numerator[f]) / (Exp[-c] Denominator[f]) > > and not getting anywhere. > > Ideas? > > Your "by hand " way does not work simply because you do not force Mathematica to multiply-out the terms in the denominator, so immediately on evaluation the whole expression is put back into the original form. All you need to do is: (Exp[-c]*Numerator[f]/Expand[Exp[-c]*Denominator[f]]) If you do not wish to do so much typing a slightly quicker approach is: f /. Exp[x_] :> Exp[x - c] (a*E^(b - c))/(1 - E^(d - c)) Andrzej Kozlowski

**References**:**Modifying displayed form of an expression?***From:*AES <siegman@stanford.edu>