Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 0 years ago

Malte gravatar image

Completing the square with Sage

I am not an expert in the various ways of simplyfying terms with Sage. Currently I do not even succeed in letting SAGE complete squares for me. If the square is already complete, as in x^2 + 2x + 1, the command factor will do what I wish and come up with the desired output of (x+1)^2. However, I would like Sage to simplify terms like x^2 + 2*x + 5 into (x+1)^2+4, and I do not get that done.

Maybe I am asking too much from Sage, but I am even aiming at completing the square in several variables, up to three, that is. So, for two variables, I would like 4x^2 + 4xy + 10y^2 + 12x - 18y + 32 to be simplified into (2x+y+3)^2+(3y-4)^2+7.

Can anyone help we with this?

Thank you! Malte

Completing the square with Sage

I am not an expert in the various ways of simplyfying simplifying terms with Sage. Currently I do not even succeed in letting SAGE complete squares for me. If the square is already complete, as in x^2 + 2x + 1, the command factor will do what I wish and come up with the desired output of (x+1)^2. However, I would like Sage to simplify terms like x^2 + 2*x + 5 into (x+1)^2+4, and I do not get that done.

Maybe I am asking too much from Sage, but I am even aiming at completing the square in several variables, up to three, that is. So, for two variables, I would like 4x^2 + 4xy + 10y^2 + 12x - 18y + 32 to be simplified into (2x+y+3)^2+(3y-4)^2+7.

Can anyone help we with this?

Thank you! Malte

click to hide/show revision 3
None

updated 0 years ago

dan_fulea gravatar image

Completing the square with Sage

I am not an expert in the various ways of simplifying terms with Sage. Currently I do not even succeed in letting SAGE complete squares for me. If the square is already complete, as in x^2 + 2x + 1, 2*x + 1, the command factor will do what I wish and come up with the desired output of (x+1)^2. (x + 1)^2. However, I would like Sage to simplify terms like x^2 + 2*x + 5 5 into (x+1)^2+4, (x + 1)^2 + 4, and I do not get that done.

Maybe I am asking too much from Sage, but I am even aiming at completing the square in several variables, up to three, that is. So, for two variables, I would like 4x^2 + 4xy + 10y^2 + 12x 4*x^2 + 4*x*y + 10*y^2 + 12*x - 18y + 32 18*y + 32 to be simplified into (2x+y+3)^2+(3y-4)^2+7.(2*x + y + 3)^2 + (3*y - 4)^2 + 7.

Can anyone help we with this?

Thank you! Malte