I have a general query about simplifying expressions in Mathematica, which I will illustrate using quadratics. If I tell Mathematica to simplify $a x^2 + b x + c$ then
Simplifywill give the same (fully expanded) form $a x^2 + b x + c$FullSimplifywill give a form like $((ax+b)x+c)$
Clarification: The coefficients in the simplified form (of course) need not be the same values $a,b,c$. The variable names are meant for demonstration of the format.
Example
poly = x^2 + 4*x + 1
Simplify[poly] (* gives 1 + 4 x + x^2 *)
FullSimplify[poly] (* gives 1 + x (4 + x) *)
(*Desired answer (x+2)^2 - 3 *)
However, I desire the format: $a{(x-b)}^2 + c$ which I find to be more intuitive in "understanding" the expression.
- What measure of "expression complexity" does Mathematica work with?
- How could I get the kind of result that I want? If possible, I'd like to know how to do this for not just quadratics, but also more complicated polynomial expressions.
SimplifyandFullSimplifyyield the same result for me (c + x (b + a x)). You may have forgotten to insert a space betweenaandx. As to 1): Have a look atComplexityFunction, especially the example at the bottom of the page. – Sjoerd C. de Vries Aug 21 '13 at 21:03SimplifyandFullSimplifygive me different results, unless I'm doing something wrong. I don't understand what you mean by the space betweenaandx. And thanks, I'll look atComplexityFunction– Siva Aug 21 '13 at 21:47a x^2differs fromax^2. – Sjoerd C. de Vries Aug 21 '13 at 21:53FullSimplifyon the quadratic gives a format convenient for implementing as a recursion but is not easy for me (and presumably others) to intuitively understand. – Siva Aug 21 '13 at 21:54