From: Jason on
Hello.

Consider the following example:
>> syms a b c d e f
>> syms x y

now define two functions which are partial derivatives of another function f(x,y)

fun1 = (4*d + 4*a*x + 4*b*y)*(a*x^2 + 2*b*x*y + 2*d*x + c*y^2 + 2*e*y + f)
fun2 = (4*e + 4*b*x + 4*c*y)*(a*x^2 + 2*b*x*y + 2*d*x + c*y^2 + 2*e*y + f)

If we now compute 'solve(fun1,fun2,x,y)' we should get the minimum, maximum and saddle points of the partial derivatives of f(x,y) in x and y.

However if you look at the roots you will see that only the first 5 of 7 seem to be computed correctly.

ans.x =

(b*e - c*d)/(a*c - b^2)
-(d + (b*(b*d - a*e + (a^2*e^2 - c*f*a^2 + f*a*b^2 - 2*a*b*d*e + c*a*d^2)^(1/2)))/(a*c - b^2))/a
-(e + (c*(b*d - a*e + b*((f*b^2 - 2*b*d*e + c*d^2 + a*e^2 - a*c*f)/c)^(1/2)))/(a*c - b^2))/b
-(e - (c*(a*e - b*d + b*((f*b^2 - 2*b*d*e + c*d^2 + a*e^2 - a*c*f)/c)^(1/2)))/(a*c - b^2))/b
-(d - (b*(a*e - b*d + (a^2*e^2 - c*f*a^2 + f*a*b^2 - 2*a*b*d*e + c*a*d^2)^(1/2)))/(a*c - b^2))/a
-(d + b*z - (b^2*z^2 + 2*b*d*z + d^2 - a*c*z^2 - 2*a*e*z - a*f)^(1/2))/a
-(d + b*z + (b^2*z^2 + 2*b*d*z + d^2 - a*c*z^2 - 2*a*e*z - a*f)^(1/2))/a

As you can see the 6th and 7th roots are:

-(d + b*z - (b^2*z^2 + 2*b*d*z + d^2 - a*c*z^2 - 2*a*e*z - a*f)^(1/2))/a

and

-(d + b*z + (b^2*z^2 + 2*b*d*z + d^2 - a*c*z^2 - 2*a*e*z - a*f)^(1/2))/a

MATLAB introduced a new symbol called 'z'

Why does it do it? Is it maybe because the root is not defined / imaginary?
What did MATLAB suddenly put a variable/symbol i haven't even defined in there?

Many thanks,
Jason