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

Quiz 02

1:20-2:10PM, Oct 16, 2020.

1. Find the smallest N so that |∑_{i=0}^{N} \frac{3^{i}}{i!} − exp(1)^{3}| < 10^{−5}. Let your code print the answer

N and |∑_{i=0}^{N} \frac{3^{i}}{i!} − exp(1)^{3}| on screen, and also write them down on the answer sheet.

Type the error bound 10^{−5} directly in your code, and do not use it as an input. Extra credits for more efficient method(s).

Name your code using your student ID number, quiz number and problem number, such as m107000001 q2p1.m or m108000002 q2p1.c. Extra credits using C, C++, etc.

2. Consider the following recursive formula p_{1} = 1, p_{2} = a_{1}, p_{n} = \frac{10}{3}p_{n−1} − p_{n−2}, used as an algorithm to compute p_{N} for a given N. For what values of a_{1} is this algorithm stable in relative error? Explain.

3. The file an.txt contains a sequence stored as ’n, a_{n}’ at nth line and its limit L in the comment line. Find its rate of convergence. Express your answer as O(β_{n}) and find β_{n} explicitly. Extra credits for finding the rate without knowing L. Explain how you get the answer and hand in your code.

4. Find a root of x = 2 cos x with 10 correct decimal digits using any numerical method of your choice. Write down (1): the detail formula of your method, (2): x_{0}, x_{1} and (3): the answer x^{∗}, on the answer sheet. Double check that your answer indeed satisfy the equation before you write them down. Need not hand in the code if you are sure about your answer.

5. Show that the nonlinear equation x = 1 + \frac{1}{2} cos(x) has a solution in [1, 1.5]. Let x_{0} = 1.25, give an estimate on N (need not be optimal) such that |x_{n} − x^{∗}| < 10^{−5} for all n ≥ N. You can use any theorem(s) on the textbook directly and need not prove the theorem(s) in advance, as long as you state the theorem(s) correctly.