Using matlab to solve algebraic equations...

• Jun 20th 2011, 08:43 PM
godelproof
Using matlab to solve algebraic equations...
Consider a simple one like this:
2(x+1)(2x-1)=x(x-1)(x+2)

the "solve" command gives:
x1=1/3*(54+3*i*705^(1/2))^(1/3)+7/(54+3*i*705^(1/2))^(1/3)+1

x2=-1/6*(54+3*i*705^(1/2))^(1/3)-7/2/(54+3*i*705^(1/2))^(1/3)+1+1/2*i*3^(1/2)*(1/3*(54+3*i*705^(1/2))^(1/3)-7/(54+3*i*705^(1/2))^(1/3))

x3=-1/6*(54+3*i*705^(1/2))^(1/3)-7/2/(54+3*i*705^(1/2))^(1/3)+1-1/2*i*3^(1/2)*(1/3*(54+3*i*705^(1/2))^(1/3)-7/(54+3*i*705^(1/2))^(1/3))

But we know that all 3 roots of the equation are REAL NUMBERS. So this result is not so satisfying to me... My question is this: how can we know if one solution is intrinsically complex or real, when it gives us results like these?

(btw, I remember there's a command that numerically finds zero of a polynomial, what's its name, please?)
• Jun 20th 2011, 08:50 PM
Also sprach Zarathustra
Re: Using matlab to solve algebraic equations...
Quote:

Originally Posted by godelproof
Consider a simple one like this:
2(x+1)(2x-1)=x(x-1)(x+2)

the "solve" command gives:
x1=1/3*(54+3*i*705^(1/2))^(1/3)+7/(54+3*i*705^(1/2))^(1/3)+1

x2=-1/6*(54+3*i*705^(1/2))^(1/3)-7/2/(54+3*i*705^(1/2))^(1/3)+1+1/2*i*3^(1/2)*(1/3*(54+3*i*705^(1/2))^(1/3)-7/(54+3*i*705^(1/2))^(1/3))

x3=-1/6*(54+3*i*705^(1/2))^(1/3)-7/2/(54+3*i*705^(1/2))^(1/3)+1-1/2*i*3^(1/2)*(1/3*(54+3*i*705^(1/2))^(1/3)-7/(54+3*i*705^(1/2))^(1/3))

But we know that all 3 roots of the equation are REAL NUMBERS. So this result is not so satisfying to me... My question is this: how can we know if one solution is intrinsically complex or real, when it gives us results like these?

(btw, I remember there's a command that numerically finds zero of a polynomial, what's its name, please?)

How we know?
• Jun 20th 2011, 09:01 PM
CaptainBlack
Re: Using matlab to solve algebraic equations...
Quote:

Originally Posted by Also sprach Zarathustra
How we know?

Simplify down to a cubic with positive leading coefficient , apply Descartes's rule of signs which shows this has 0 or 2 positive roots, and exactly one negative root. And since the cubic is positive at x=0 and negative at x=2 it follows that it has one negative and two positive real roots.

CB
• Jun 20th 2011, 10:18 PM
godelproof
Re: Using matlab to solve algebraic equations...
Quote:

Originally Posted by godelproof
My question is this: how can we know if one solution is intrinsically complex or real, when it gives us results like these?

I figured out one way to check: apply the "vpa" function (variable precision arithmetic)... If the imaginary part of the answer is small enough we may believe the answer is real number... This is not all that satisfying either, but perhaps we can do no better...

CB: Can you tell me how do we solve for n roots of polynomial of order n, analytically? Thanks!
• Jun 21st 2011, 02:32 PM
CaptainBlack
Re: Using matlab to solve algebraic equations...
Quote:

Originally Posted by godelproof
I figured out one way to check: apply the "vpa" function (variable precision arithmetic)... If the imaginary part of the answer is small enough we may believe the answer is real number... This is not all that satisfying either, but perhaps we can do no better...

CB: Can you tell me how do we solve for n roots of polynomial of order n, analytically? Thanks!

General solution: Google for cubic formula and/or quartic formula. There is no general formula in radicals for a polynomial equation in one variable of degree five or higher.

You will have trouble with the cubic (and probably the quartic formulas) since this is almost certainly what solve uses.

CB