If I understand this correctly, x1=(3*a^2)/(8*a^2)+c/a;
x2=b^3/(8*a^3)-(b*c)/(2*a^2)+d/a;
x3=(-3*b^4)/(256*a^4)+(c*b^2)/(16*a^3)-(b*d)/(4*a^2)+e/a;
//"(+-)" means "plus or minus"
if !x2 then
x4=-b/(4*a)(+-)((-x1(+-)(x1^2-4*x3)^.5)/2)^.5
else
//Too long. You get the general idea.
Alternatively there are a variety of root-finding algorithms for n-th order polynomials -- bisection method, secant method, newton-rhapson method, etc, all of which are explained in detail in Wikipedia.
Do you want to approximate the roots (numerically) or do you want to solve the equation (algebraically)? (The latter is still possible, since the degree isn't 5 or above, in which case you'd be out of luck...)
I am sorry, I did not check the forum for a month due to examinations! I still have this work pending.
I need to implement a program which is very fast to solve this equation. So I guess an approximated value would also do! I cannot afford to use programs which runs iterations 1000 times to get the corrrect value. Speed of calculation is of utmost importance.
I found the solution for this. There is a perfect code for it in Google-codes and it runs splendidly. If anybody wants to use a function which analytically solves 4th order equations, use this :-
I found the solution for this. There is a perfect code for it in Google-codes and it runs splendidly. If anybody wants to use a function which analytically solves 4th order equations, use this :-