Bisection method (Numerical analysis)

主宰稳场 提交于 2019-12-20 04:13:38

问题


How many recursions are made before every single root is found? Also, which ones are the roots?


Here's my code:

e=0.000001; 
f1=@(x) 14.*x.*exp(x-2)-12.*exp(x-2)-7.*x.^3+20.*x.^2-26.*x+12;

a=0; 
c=3; 
while abs(c-a)>e 
    b=(c+a)/2; 
    if f1(a)*f1(b)<0 
        c=b; 
    else
        a=b;
    end    
    disp(b);  
end

回答1:


Bisection works by taking endpoints of some initial interval [a,b] and finding which half of the interval must contain the root (it evaluates the midpoint, and identifies which half has the sign change). Then bisection repeats the process on the identified half.

Bisection converges upon only one possible root, and if your function has multiple roots inside [a,b], it is difficult to predict in general which specific root it will converge to. (Note: since bisection is a fully deterministic algorithm, it will always converge to the exact same root if you give it the same initial interval.) The iterations simply refine your approximation of found root, they do not find multiple roots.

To directly answer your question, bisection will not discover all three of the roots of your function inside [0,3]. It will find just one root, and this is identified by the final iteration of your bisection code. All of the values outputted by the bisection iterations simply show the progress made by the algorithm towards the one root it eventually found (and these values should be a sequence converging upon the final value).




回答2:


The algorithm of bisection method is such that it can only find one root between a defined interval. In your problem, all three roots cannot be found, but if you define different intervals to find out individual roots, you may succeed. You may go through this sample program for bisection method in Matlab with full theoretical background and example.



来源:https://stackoverflow.com/questions/13294555/bisection-method-numerical-analysis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!