I have to write a program that implements the bisection method.The program should end if the number of iterations surpass the maximum number of iterations,or if one or both of these conditions :
$\left | x_{k}-x_{k-1} \right | $ < ε and $ \left | f(x_{k}) \right | $< ε
are valid??
Which should be my termination criteria when the first interval is [a,b]...Could it be |b-a|<ε?? If yes,why???
Asked
Active
Viewed 46 times
0
evinda
- 7,823
1 Answers
0
Remember that $x_k$ stand for your iterates. If you were to check the conditions $\big|x_k-x_{k-1}\big|$ when you start your program, you will need to know what $x_0$ and $x_1$ are. Usually, $x_0= \frac{b+a}{2}$ if $f(a)\times f(b) < 0$. To compute $x_1$, you will need to apply the bisection method to the new interval $[a, \frac{b+a}{2}]$ or $[\frac{b+a}{2}, b]$ (depending on what $f(b)$ and $f(a)$).
So to answer your question, the first stopping criteria would not be $|b-a|< \epsilon$ because $x_0\neq a$ and $x_1\neq b$ (not necessarily).
ZanCoul
- 455
- 2
- 11
what is equal to first
$\big|x_k-x_{k-1}\big|$ that we use????
– evinda Nov 19 '13 at 08:29You check that $f(0) <0$ and $f(2)>0$, and so $x_0=(2+0)/2=1$. Since $f(1)<0$, your new interval becomes $[1, 2]$.
You will again that $f(1)<0$ and $f(2)>0$ and so your $x_1=(1+2)/2=3/2$. Since $f(3/2)>0$, your new interval will be $[1, 3/2]$.
Notice that after the first two iterations, you have $x_0$ and $x_1$, you can use that to start checking for your stopping criteria.
– ZanCoul Nov 19 '13 at 16:11