Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

Can you explain me a little how Mathematica sort this result, and how to sort in descending powers of $x$

(x - 1/2) (4 x^3 + a x^2 + b x + 2) // Expand // Collect[#, x] &

$$\begin{align*}x^2 \left(b-\frac{a}{2}\right)+(a-2) x^3+\left(2-\frac{b}{2}\right) x+4 x^4-1\end{align*}$$

how to get the following order

$$\begin{align*}4x^4+(a-2)x^3+\left(b-\frac{a}{2}\right) x^2+\left(2-\frac{b}{2}\right)x-1\end{align*}$$

share|improve this question

marked as duplicate by Kuba, Artes, Sjoerd C. de Vries, rm -rf Aug 8 '13 at 15:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
@Nasser I'm doing exploring manipulation, and after Expand, then I realized that I need Collect –  HyperGroups Aug 8 '13 at 12:57
add comment

2 Answers 2

up vote 2 down vote accepted

It is undocumented but I saw it once:

(x - 1/2) (4 x^3 + a x^2 + b x + 2) // Expand // Collect[#, x] & // 
           PolynomialForm[#, TraditionalOrder -> True] &
share|improve this answer
    
Thanks, I saw something similar in MathWorld of Eric's Notebook. –  HyperGroups Aug 8 '13 at 12:58
add comment

fyi http://reference.wolfram.com/mathematica/tutorial/PolynomialOrderings.html has alot of information relating to this:

MonomialList[Collect[ Expand[(x - 1/2) (4 x^3 + a x^2 + b x + 2)], x], Reverse[{x}]]

(* {4 x^4, (-2 + a) x^3, (-(a/2) + b) x^2, (2 - b/2) x, -1} *)
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.