

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Instructor: Prof. Wolfgang Bangerth [email protected], Teaching Assistants: Dukjin Nam [email protected]
Problem 1 (Secant method). This problem is an example of finding the root of a function f that is only given in form of a procedure, a likely case in applications, instead of as a closed form expression. In order to define the function g(x), consider the following iteration: set a 0 = 1 and compute the values ai by the following iteration:
ai = ai− 1 + x cos ai− 1 + x 10
Clearly, we can compute a 1 from a 0 = 1 for each value of x. Similarly, we can compute a 2 from a 1 , and so on. Now, let g(x) be the function whose value equals a 10 for any given value of x.
a) Write a program function that given a value x returns g(x) = a 10 by computing the iteration above. Use your program to plot g(x) in the range − 10 ≤ x ≤ 10.
b) Assume we want to solve the equation f (x) = 0 where f (x) = g(x) − 2. State why Newton’s method may be ill-suited for this task. c) Write a program that finds a root of f (x) = g(x) − 2 up to 6 digits accuracy using the secant method. Use x 0 = 0, x 1 = 1 as starting points. State how many iterations you needed to get the desired accuracy. (Hint: Because the problem – probably – doesn’t have an analytic solution, the exact location x∗^ of the root of f (x) is unknown. So how do you know when your iterate xk is accurate to six digits, i.e. that xk − x∗^ < 10 −^6? In order to test algorithms, one often lets them run for a quite significant number of iterations, for example so that between xk and xk+1 the 10th or 12th digit doesn’t change any more. If that is the case, then one can be virtually assured that the first 9 or 11 digits of xk+1 are correct. You can then use this as a pretty good approximation of x∗^ and compare the first few iterates against it, to count how many it takes so that the first 6 digits coincide.)
d) Write a program that solves the same problem using the bisection method instead of the secant method, using a 0 = 0, b 0 = 1 as the initial interval. State how many iterations it takes this time to get 6 correct digits. How do the secant and the bisection method compare in terms of function evaluations for this problem? (8 points)
Problem 2 (Root finding methods). Compare, in words, the bisection method, Newton’s method, and the secant method with respect to the follow- ing criteria: reliability of finding a root of a function, speed of convergence, complexity (i.e., a method is better if it needs fewer evaluations of f (x) per iteration, or if it only needs function values rather than derivatives). (3 points)
Problem 3 (Convergence order for sequences). Determine the order of convergence and the asymptotic error constant for the following sequences:
(a) an = 5. 0625 , 2. 25 , 1 , 49 , (^1681)
(b) bn = 2. 718 , 2. 175 , 1. 740 , 1. 392 , 1. 113 , 0. 8907
(c) cn = 0. 318 , 0. 180 , 0. 0761 , 0. 021 , 3. 04 · 10 −^3 , 1. 68 · 10 −^4 , 2. 17 · 10 −^6. (3 points)
Problem 4 (Convergence order for functions).
(a) For the functions f (x) = x^4 + 2x^2 + 1 and g(x) = x^4 − 2 x^2 − 3 x, determine the exponent p in the asymptotic equation
f (x) − g(x) = O(xp) as x → ∞.
(b) For the functions f (x) = sin x and g(x) = x, determine the exponent p in the asymptotic equation
f (x) − g(x) = O(xp) as x → 0.
(Hint: Since we are interested in the limit of x approaching zero, it may make sense to expand f (x) into a Taylor series around x 0 = 0.) (4 points)