5

My university teacher gave us a project. He wants us to create a program which will execute a modified bisection method for a function but not by diving everytime the range by $2$, but by dividing it with a random number. The process stops when $6$ digits precision occurs. My problem is with finding the correct condition for stopping finding roots.

*In classic Bisection when it gives us accuracy (for example, $6$) there's a formula for iterations that says:

Given a function $f$ defined on $(a,b)$,

$N> \frac{ \ln(b-a)-\ln k }{\ln2}$ with

$N$: number of iterations

$k: \frac12 \times 10^{-n}$ with $n$ being the wanted accuracy ($6$ in this example).

Siong Thye Goh
  • 149,520
  • 20
  • 88
  • 149
Georgio3
  • 61
  • 5

1 Answers1

1

Write a while loop, at each step, check the size of interval that you are working on $(a_k,b_k)$, you may stop when $b_k-a_k < 10^{-6}$.

If you know more information about how you are going to draw your random number, such that we know $\frac{b_k-a_k}{b_{k-1}-a_{k-1}} \leq r$ for some constant $r$, you should be able to come out with a closed form.

Siong Thye Goh
  • 149,520
  • 20
  • 88
  • 149