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
Simplify
will give the same (fully expanded) form $a x^2 + b x + c$FullSimplify
will 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.
Examplepoly = 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.
Simplify
andFullSimplify
yield the same result for me (c + x (b + a x)
). You may have forgotten to insert a space betweena
andx
. As to 1): Have a look atComplexityFunction
, especially the example at the bottom of the page. $\endgroup$Simplify
andFullSimplify
give me different results, unless I'm doing something wrong. I don't understand what you mean by the space betweena
andx
. And thanks, I'll look atComplexityFunction
$\endgroup$a x^2
differs fromax^2
. $\endgroup$