Re: how to tell Mathematica to display x^-1 as x^-1 and not as

*To*: mathgroup at smc.vnet.net*Subject*: [mg110743] Re: how to tell Mathematica to display x^-1 as x^-1 and not as*From*: Albert Retey <awnl at gmx-topmail.de>*Date*: Sun, 4 Jul 2010 03:10:02 -0400 (EDT)*References*: <i0n9t5$hr6$1@smc.vnet.net>

Am 03.07.2010 14:19, schrieb Nasser M. Abbasi: > Hello; > > > When I type > > x^-1 > > Mathematica replies > > 1/x > > Is there a way to tell Mathematica to *display* terms with negative > powers as x^-n and not as 1/x^n ? (i.e keep the term just like it > would appear on paper). > > Another example, suppose I type > > expr = a*x^-2 + b *x^-1 + > > The reason I want to do this, is just for display purposes. When I print > the expression on the screen, I'd like it to look like x^-1 and not like > 1/x (to better match how the expression look like in the textbook) > > I am trying to avoid having to convert everything to a string, and force > the form to the way I want. I tried Hold functions, and > TraditionalForm, but can't get it to print as I want. > > I am hoping there is an easy trick to do this? for this special case you could use the following: expr /. Power[x, n_?Negative] :> Row[{x, "^", n}] it should be fairly easy to adopt to other or more general cases. hth, albert