2
$\begingroup$

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.

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.

  1. What measure of "expression complexity" does Mathematica work with?
  2. 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.
$\endgroup$
7
  • $\begingroup$ Thanks, that addresses a part of my question. But I think my question is a little broader. $\endgroup$
    – Siva
    Commented Aug 21, 2013 at 20:47
  • $\begingroup$ @Siva I think you should make more precise question in 2). $\endgroup$
    – Kuba
    Commented Aug 21, 2013 at 20:49
  • $\begingroup$ Contrary to what you state, Simplify and FullSimplify yield the same result for me (c + x (b + a x)). You may have forgotten to insert a space between a and x. As to 1): Have a look at ComplexityFunction, especially the example at the bottom of the page. $\endgroup$ Commented Aug 21, 2013 at 21:03
  • $\begingroup$ @SjoerdC.deVries Example added to demonstrate what I see. Simplify and FullSimplify give me different results, unless I'm doing something wrong. I don't understand what you mean by the space between a and x. And thanks, I'll look at ComplexityFunction $\endgroup$
    – Siva
    Commented Aug 21, 2013 at 21:47
  • $\begingroup$ Since you originally presented your polynomial with symbolic coefficients (a , b, c) that's what I tried. In that case Simplify and FullSimplify yield the same. As to the space: a x^2 differs from ax^2. $\endgroup$ Commented Aug 21, 2013 at 21:53

0

Browse other questions tagged or ask your own question.