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