Jump to content

Exercises on the bisection method

From Wikiversity

   

Exercises on the bisection method


Exercise 1

[edit | edit source]
  • Write a Octave/MATLAB function for the bisection method. The function takes as arguments the function f, the extrema of the interval a and b, the tolerance ϵ and the maximum number of iterations.
  • Consider the function f(x)=cos⁡x in [0,3π].
    1. How many roots are there in this interval?
    2. Theoretically, how many iterations are needed to find a solution?
    3. With ϵ=10−10, how many iterations are needed? Does the numerical result satisfy this condition?
    4. With ϵ=10−20, how many iterations are needed? Does the numerical result satisfy this condition?

Exercise 2

[edit | edit source]
  • Consider the function f(x)=ex−x2 in [−2,0].
    1. Show the existence and uniqueness of the root f(α)=0.
    2. Given the tolerance ϵ=10−8, how many iterations are needed?
    3. Consider the restriction of the interval to [−2,−1]. In this case how many iterations are needed?
    4. With the aid pf the Octave/MATLAB function of exercise 1, compute the root of the function.
    5. Compute the solution with precision ϵ=10−15 e consider it as the exact solution. Then considering ϵ=10−8, draw a logarithmic plot to represent the average error and the actual error. Comment.

Exercise 3

[edit | edit source]

Show that the sequence defined by the bisection method with k≥0 we have

|α−xk|≤b−a2k+1.