2018 Numerical Analysis Midterm Exam
Wednesday October 31st 2018
16:30 — 18:30

NO NOTES OR BOOKS; ANSWER ALL 4 QUESTIONS; ALL QUESTIONS HAVE EQUAL VALUE.
 10.18.18
 Question #1
 (a) Consider a number of real type. Knowing that the machine accuracy (non-denormal) is of $\epsilon_{\rm mach}=9.5367 \times 10^{-7}$ and that the maximum positive number must be at least as high as $10^{23}$, do the following: (i) find the minimum number of bits for the exponent; (ii) find the minimum number of bits for the significand. (b) Consider the number $9.5367\times 10^{-4}$ stored in memory as a real type. Knowing that the exponent of the real type has 4 bits what is the minimum number of bits that the significand should have if the relative error on the number is less than 0.01?
 Question #2
Consider the following system of equations: $$-3 x_1 + 2 x_2 + 4 x_3 + 5 x_4 = 1 \\ - x_1 + 3 x_2 - x_3 + 5 x_4 = 2 \\ -4 x_1 + 4 x_3 + 2 x_4 = 3 \\ 6 x_2 + 4 x_3 - 5 x_4 = 4$$ Find $x_1$, $x_2$, $x_3$, $x_4$ using Gaussian elimination in two different ways:
(a)  By hand.
(b)  By writing a C program that starts as follows:
 Question #3
The secant method (a.k.a. Newton-Raphson) can be written in the following form: $$x_{n+1}=x_n-\frac{f_n}{(f^\prime_n)_{\rm secant}}$$ where $n$ is the iteration count, $f_n=f(x_n)$, and $$(f^\prime_n)_{\rm secant}=\frac{f_n-f_{n-1}}{x_n-x_{n-1}}$$ Do the following:
 (a) Using Taylor series expansion, prove that $(f^\prime_n)_{\rm secant}$ is first-order accurate. That is, prove that $$(f^\prime_n)_{\rm secant}=f^\prime_n + O(\Delta x)$$ where $O(\Delta x)$ stands for a sum of terms where the largest term scales with $x_n-x_{n-1}$. (b) You wish to improve the secant method by finding an approximation for $f^\prime$ that is second order accurate. That is, derive using the Taylor series an expression for $(f^\prime_n)_{\rm secant2}$ such that $$(f^\prime_n)_{\rm secant2}=f^\prime_n + O(\Delta x^2)$$
 Question #4
You wish to solve a system of equations $AX=B$ given the square matrix $A$ and the vector $B$. Derive an expression for the work needed to find $X$ when using Gaussian elimination without pivoting. The work needed should be written as a function of $N$ (i.e., the number of rows within $A$) and should be simplified as much as possible. Explain clearly all steps needed to determine the work. Twenty points will be given for a clear explanation of how the work is determined, and five points for the correct answer. Note: the lower and upper triangular matrices of $A$ are not known.
 $\pi$