Assignment 2
Assignment 2
1. Bisection. Write a script that uses the bisection method to solve a scalar nonlinear
equation f(x) = 0.
• Test your method by solving x3 = sin(x) in the interval 0.5 ≤ x ≤ 2 to a tolerance of
10-6.
• Plot (on a semilog graph) the error as a function of iteration number. Comment.
2. Newton's Method. Write Matlab code that implements Newton's method to find the
root of the equation x3 -2x - 5 = 0 in the interval 2 ≤ x ≤ 3 to an accuracy of 10-6.
• Print each iterate and its corresponding function value. (use format long)
• Use the function values at the last three iterates to compute the observed
convergence rate.
3. Cubic Root by Newton’s Method: Write a MATLAB script for computing the cube root of
a number, x = 3√a, with only basic arithmetic operations using Newton’s method, by
finding a root of the function f (x) = x3 − a. Run your program for a = 0, 2, 10. For each of
these cases, start with an initial guess reasonably close to the solution. As a stopping
criterion, require the function value whose root you are searching to be smaller than
10−8. Print out the values of xk and f (xk ) in each iteration. Comment on the convergence
rates and explain how they match your expectations.
4. Secant method.
a) Solve the univariate equation x3 - 2x - 5 = 0 in the interval 2 ≤ x ≤ 3 to an accuracy
of 10-6 using the secant method.
b) Compare your solution with the one produced by the built-in fzero() function.
c) Show the sequence of iterates produced and the corresponding function values.
Do you observe slower convergence than with Newton's method of problem 2
above?
d) What is the theoretical rate of convergence of the secant method? Check if your
results converge at this rate.
• Print out the iterates and show the progress in the number of correct decimal
digits throughout the iteration.
• Explain the convergence behavior and how it matches theoretical expectations.
Written:
Assume 𝑎 > 0. We seek an approximation to 𝑟 = 1/𝑎, where r is the unique positive root
of 𝑓(𝑥) = 𝑎 – 1/𝑥.
Problem 3:
Each of the following functions has p3 R as a zero for any positive real number R. Determine the
formulas for Newton’s method for each and any necessary restrictions on the choice for x0.
1. a(x) = x3 − R
2. b(x) = 1/x3 − 1/R
3. c(x) = x2 − R/x
4. d(x) = x − R/x2
5. e(x) = 1 − R/x3
6. f(x) = 1/x − x2/R
7. g(x) = 1/x2 − x/R
8. h(x) = 1 − x3/R
Math 213_ Assignment 2_ Spring 2019 Due date: Friday, April 5 2019
Problem 4:
(a) Show that in general the method converges quadratically to a root of f (x).
Problem 5: