I want Mathematica to express the equation $$-11 - 2 x + x^2 - 4 y + y^2 - 6 z + z^2=0$$ in the form $$(x - 1)^2 + (y - 2)^2 + (z - 3)^2 - 25=0$$ How do I tell Mathematica to do that?
|
You can use custom transformation rules, for example:
returns
The above rule does not account for cases where |
|||||||||||||||||||
|
|
An algebraic one:
|
|||||
|
|
What about this: This is your left-hand part:
The result is
Now back to old notations:
The result is:
|
|||
|
|
|
|||||||||
|
|
A different route:
|
|||
|
|
|
The operation of completing the square with respect to a specified variable is realized by the function
|
|||||||
|
|
The following routine tries to eliminate the linear terms by completing the square for arbitrary number of variables:
In case that the polynomial is not expressable solely in quadratic terms it uses the
|
|||
|
|