Numerical Analysis I, Fall 2017 (http://www.math.nthu.edu.tw/˜ wangwc/)

Homework Assignment for Week 02

Due Friday, Oct 06, 1:20PM. Goal: Review basic programming skills. Understand stability, instability and rate of convergence.

1. Section 1.3: Problems 4, 7(c), 10, 15.

2. Consider the following recursive relation

x_{1} = a_{1}, x_{2} = a_{2}, x_{n} = \frac{9}{2} x_{n−1} − 2 x_{n−2}

(a) What is the exact solution of x_{n} with a_{1} = 1/5, a_{2} = 1/10? Is it stable (in relative error)? Verify your answer numerically. for n around 40 or larger.

(b) Do the same for a_{1} = a_{2} = 1/5 and for a_{1} = 1, a_{2} = 1/2, respectively. Explain your observation.

3. Read the details about ‘loglog’, ‘semilogx’, ‘semilogy’ in matlab/octave. Typical convergence behavior, such as y_{n} = C_{1}n^{−k}, or z_{n} = C_{2}α^{n}, where n denotes the number of iterations and C_{1} > 0, C_{2} > 0, k > 0 and 0 < α < 1 are some constants, will have distinct behaviors when you choose the correct scaling. That is, if you try to plot y_{n} or z_{n} versus n in one of the special scalings above, you will see a straight line.

(a) Try to analyze and find the rate of convergence of

lim_{n→∞} ∑_{i=1}^{n} \frac{1}{i^{2}} = \frac{π^{2}}{6}

numerically by plotting the results in the correct x− and y− scaling.

(b) Assuming that the leading term of the error is of the form

∑_{i=1}^{n} \frac{1}{i^{2}} − limit ≈ Cn^{−p}

An alternative method to estimate the convergence rate (with or without using the information that the limit is \frac{π^{2}}{6} ) is to estimate p using the numerical values of ∑_{i=1}^{N} with two or three different values of N, say N = 100, 200 and 400. Find p with this method.

4. Section 2.1: Problems 14. Write your own code to practice various stopping conditions such as equation (2.1)-(2.3). .