Get real roots of polynomial by using the bisection method

245 Views Asked by At
y= [0 1.41E-08 1.44E-08 1.50E-08];

fx= 0.0058*x^4-0.0008*x^3+4E-5*x^2-1E-6*x+1E-8;

how can I use the bisection method to find the real solution of every (fx-y=0)


I tried to find solutions of polynomial with

c= [0.0058 -0.0008 4E-5 -1E-6 ((1E-8)-y)]; 
solution=roots(c);

with the result

???

I also tried this code:

syms x 
y= [0 1.41E-08 1.44E-08 1.50E-08]; 
n=length(y) 
for j= 1:n 
    c=[0.0058 -0.0008 4E-5 -1E-6 ((1E-8)-y(j))];
    solution=roots(c); 
    a=solution(imag(solution)==0); 
    amax=max(a); 
    amin=min(a); 
end

giving the result

???
1

There are 1 best solutions below

0
On

In order to use Bisection you must have a general idea where your solution lies.

You will need an $a$ and $b$ such that $f(a) <0$ and $f(b) > 0$. Then by continuity of f there must exist $x \in [a,b]$ such that $f(x) = 0$.

Now define $c$ as $c = \frac{a+b}{2}$. If $f(c) > 0$ then replace b by c, otherwise replace a by c and repeat the process.

You posted some code, but I'm unsure of what language this even is...