Re: Descending order
- To: mathgroup at smc.vnet.net
- Subject: [mg71772] Re: Descending order
- From: "dimitris" <dimmechan at yahoo.com>
- Date: Tue, 28 Nov 2006 06:04:27 -0500 (EST)
- References: <ekecm8$p4$1@smc.vnet.net>
The trivial answer is: Use TraditionalForm
FrontEndExecute[{HelpBrowserLookup["MainBook", "1.10.9"]}]
defpol=x^4+x^3+x^2+x
\!\(x + x\^2 + x\^3 + x\^4\)
TraditionalForm[defpol]
\!\(TraditionalForm\`x\^4 + x\^3 + x\^2 + x\)
The clever answer is to use the following lines below which ensure a
polynomial is written in the opposite order from the usual Format.
These lines have taken from the following link
http://www.verbeia.com/mathematica/tips/HTMLLinks/Tricks_A-K_32.html
Unprotect[Plus];
HoldPattern[Plus[p__]] := Module[{s1, s2}, s1 = Hold[p]; s2 =
Reverse[s1];
ReplacePart[HoldForm[Evaluate[s2]], Plus, {1, 0}] /;
OrderedQ[s1] && s1 =!= s2];
Expand[defpol]
\!\(\*
TagBox[\(x\^4 + x\^3 + x\^2 + x\),
HoldForm]\)
Note however that
FullForm[%]
HoldForm[Plus[Power[1,4],Power[1,3],Power[1,2],1]]
The normal convention is restored by
HoldPattern[Plus[p__]] =. ;
Protect[Plus];
I higly suggest you to download the Supplementary Help Browser of Ted
Ersek
(which above code belong to) from the following link
http://library.wolfram.com/infocenter/MathSource/4557/
If you want you can make this to be part of your help browser.
Contact me for more details.
Regards
Dimitris
Bruno Campanini wrote:
> After Evaluation, is it possible to have Mathematica 5.2
> ordering descending instead of ascending?
>
> I.e.
> x^4 + x^3 + x^2 + x
> instead of
> x + x^2 + x^3 + x^4
>
> Bruno