MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: how do I display "Power[z,-1]" in an exponetial form?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50794] Re: how do I display "Power[z,-1]" in an exponetial form?
  • From: ab_def at prontomail.com (Maxim)
  • Date: Tue, 21 Sep 2004 03:49:21 -0400 (EDT)
  • References: <ci8mqm$bt3$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

dumstuck at gmx.ch (dumstuck at gmx.ch) wrote in message news:<ci8mqm$bt3$1 at smc.vnet.net>...
> In the field of DSP engineering we like keeping the expression "1/z"
> in the form of "z minus one", namly in a exponential form. Both the "z
> minus one" and "1/z" has the same "FullForm", namely "Power[z,-1]".
> But they both get displayed in a fractional form. how could I change
> that way of diplaying "Power[z,-1]"?

You can use MakeBoxes:

MakeBoxes[k_. * x_ ^ n_, form_] := Module[
  {kbox, xbox, nbox, powbox},
  kbox = MakeBoxes[k, form];
  xbox = MakeBoxes[x, form];
  nbox = MakeBoxes[n, form];
  If[Head @ xbox =!= String,
    xbox = RowBox[{"(", xbox, ")"}]
  ];
  powbox = SuperscriptBox[xbox, nbox];
  Switch[kbox,
    "1", powbox,
    RowBox[{"-", "1"}], RowBox[{"-", powbox}],
    _, RowBox[{kbox, " ", powbox}]
]]


Evaluate -1/(a+Sqrt[b])-1/a^2 in the front end to see how the output
will be formatted. It will work with StandardForm and TraditionalForm.
There is no need for a 'reverse' MakeExpression definition, because
the output can be correctly interpreted by Mathematica.
FormatValues[MakeBoxes]={} will clear this definition.

Maxim Rytin
m.r at inbox.ru


  • Prev by Date: Re: Re: Forcing a Derivative
  • Next by Date: Re: Bilinear Transforms
  • Previous by thread: Re: how do I display "Power[z,-1]" in an exponetial form?
  • Next by thread: Re: how do I display "Power[z,-1]" in an exponetial form?