Re: I wish Descending Order Result
- To: mathgroup at smc.vnet.net
- Subject: [mg24010] Re: I wish Descending Order Result
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 20 Jun 2000 03:07:28 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <012d01bfd921$1e337460$9b16989e@machine1>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
Unprotect[MakeBoxes]
makeSignPair[-a_] /; ! NumericQ[a] := {"-", MakeBoxes[a]}
makeSignPair[b_?NumericQ*a_] /; b < 0 := {"-", MakeBoxes @@ {-b*a}}
makeSignPair[a_?NumericQ] /; a < 0 := {"-", MakeBoxes @@ {-a}}
makeSignPair[a_] := {"+", MakeBoxes[a]}
MakeBoxes[poly_Plus /; PolynomialQ[poly], form_:StandardForm] :=
Module[{lst},
lst = Reverse[List @@ poly];
lst = Flatten[makeSignPair /@ lst];
If[lst[[1]] == "+", lst = Rest[lst]];
RowBox[lst]
]
Protect[MakeBoxes]
will do what you want. In any depth and
it will not change the Out[] values. But it
works only with the Frontend
Regards
Jens
Allan Hayes wrote:
>
> Jens,
>
> I have used your suggestion to get a solution that deals with deeper
> polynomial parts
>
> $Post = # //. (x_Plus /; PolynomialQ[x] :>
> Infix[Reverse[List @@ x], "+"]) &
>
> Unfortunately, although this is fine for appearence, for further computation
> we run into problems analogous to those with Matrix form and other wrappers:
>
> x(1 + x + x^2)
>
> Expand[%]
>
> D[%%]
>
> $Post = .
>
> So, what to do?
>
> --
> Allan
> ---------------------
> Allan Hayes
> Mathematica Training and Consulting
> Leicester UK
> www.haystack.demon.co.uk
> hay at haystack.demon.co.uk
> Voice: +44 (0)116 271 4198
> Fax: +44 (0)870 164 0565
>
> "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de> wrote in message
> news:8ihslq$l5m at smc.vnet.net...
> > Hi,
> >
> > $Post = If[Head[#] === Plus && PolynomialQ[#],
> > Infix[Reverse[List @@ #], "+"], #] &
> >
> > ?
> >
> > Regards
> > Jens
> >
> > Choi sungkwon wrote:
> > >
> > > In Mathmatica,
> > >
> > > When I Typing
> > > Expand[(1 x)^2]
> > > Then Mathmatica Wrote 1 2 x x^2
> > >
> > > But I Wish the result to
> > > x^2 2 x 1
> > > ie Descending Order Result for x
> > >
> > > What can I do
> >