Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
f1 = a x^2 + b x + c + x^3

(* a x^2+b x+c+x^3 *)

f1 /. x -> (x - a/3) // Expand

(* (2 a^3)/27-(a^2 x)/3-(a b)/3+b x+c+x^3 *)

I've tried this:

f1 /. x -> (x - a/3) // Expand // Collect[#, x] &

(* (2 a^3)/27+x (b-a^2/3)-(a b)/3+c+x^3 *)

f1 /. x -> (x - a/3) // Expand // Collect[#, x] & // PolynomialForm

(* (2 a^3)/27-(b a)/3+x^3+c+(b-a^2/3) x *)

share|improve this question
    
You can extract the coefficients of $x$ as a list using f1 /. x -> (x - a/3) // CoefficientList[#, x] &. – Stephen Luttrell Nov 19 '13 at 17:36

Try this formatting

OrderedForm[x_] := HoldForm[+##] & @@ (x^#1[[1]] #2 & @@@ CoefficientRules[#, x]) &;

f1 /. x -> (x - a/3) // OrderedForm[x]
x^3+(-(a^2/3)+b) x+((2 a^3)/27-(a b)/3+c)

See also my answer here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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