Graeffe's Root Squaring Method:
This is a direct method and it is used to find the roots of a polynomial equation with real coefficients. Let us consider an equation of the form:
ax3 + bx^2 + cx + d = 0
To find the solution of the above equation, we fill up the following table:
This is a direct method and it is used to find the roots of a polynomial equation with real coefficients. Let us consider an equation of the form:
ax3 + bx^2 + cx + d = 0
To find the solution of the above equation, we fill up the following table:
m | 2^m | n1 | n2 | n3 | n4 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Given Equation | 0 | 1 | a | b | c | d | |||||||
a^2 | b^2 | c^2 | d^2 | ||||||||||
0 | -2*a*c | -2*b*d | 0 | ||||||||||
First Squaring | 1 | 2 | a^2 | b^2 - 2*a*c | c^2 - 2*b*d | d^2 |
Thus, the table goes on. The number of squaring done depends on the required accuracy of the solution. The roots are calculated by using the final values of n1, n2, n3 and n4 as follows:
a1^(2^m)=n2/n1
a2^(2^m)=n3/n2
a3^(2^m)=n4/n3
From the above equations, the roots a1, a2, a3 can be calculated.The MATLAB code for solving a polynomial by the above method is given below:
Source Code:
% a function that uses Graeffe's method
% to calculate roots of Algebraic equation
function GraeffeFunc(co,gcount)
% variable b contains the size of co
% co coeff/: vector
[a b]=size(co);
% initialize count to zero
count = 0;
% loop where elements of co vector are squared
% step by step for further processing
while count<gcount
for i=1:b
% for other coeff.
if i~=1 && i~=b
co1(i)=(co(i)^2)-(2*co(i-1)*co(i+1));
% for 1st and last coeff.
else
co1(i)=co(i)^2;
end
end
count=count+1;
co=co1;
end
% end of while
% Finding the solution by operating on co1 vector values
for i=2:b
sol(i-1)=(co1(i)/co1(i-1))^(1/(2^gcount));
end
% displaying calculated values
disp(co1);
disp(sol);
end
% end of program
Coming up next:
* Solution of Simultaneous Linear Algebraic Equations
1 comments:
Hi, thank you for the code. I want to solve an 8-degree polynomial, but I cannot understand what value of gcount to use. I thought it should be 8, but this is not working.
Post a Comment
தங்களது கருத்துக்களை இங்கே வெளியிடவும்...