2018 Numerical Analysis Final Exam  
Numerical Analysis
Final Examination
Friday December 21st, 2018
18:00 — 21:00


ANSWER ALL 6 PROBLEMS; ALL PROBLEMS HAVE EQUAL VALUE; NO NOTES OR BOOKS.
11.05.18
Question #1
Consider a real number stored with 5 bytes. Bit #1 is reserved for the sign, while bits #2 to #10 are reserved for the biased exponent, and bits #11 to #40 are related to the significand. Do the following:
(a)  Find the minimum and maximum possible exponent $p$
(b)  Find the smallest possible positive number
(c)  Find the largest possible number
(d)  Find the smallest possible positive subnormal number
Question #2
Consider the following data points:
$x$$f(x)$
12
24
43
It is given that at $x=1$, $f^{\prime\prime\prime}=0$. Using a cubic spline, find the value of $f(x)$ at $x=3$. Derive proper boundary conditions and perform basic verifications to ensure that your answer is correct.
Question #3
Consider the system of equations $AX=B$ with $A$ equal to: $$ A=\left[ \begin{array}{cccc} -2 & 0 & 1 &1 \\ 2 & 1 & 0 &0 \\ 0 & 1 & 1 &2 \\ 0 & 0 & 2 &1 \\ \end{array} \right] $$ and $B$ equal to: $$ B=\left[ \begin{array}{c} -1 \\ -7 \\ 3\\ -6 \end{array} \right] $$ Using partial pivoting only when the pivot is zero, find the lower and upper triangular matrices associated with matrix $A$. Outline all the steps needed to obtain the matrix $L$, the matrix $U$, and the permutation matrices. Also, indicate clearly how $A$ can be written as a function of $L$, $U$, and the permutation matrices.
Question #4
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)  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) $$
(b)  Consider the function $f=\sin(x)$ with $x$ in radians. Write a C code that finds the root $f=0$ with an absolute error on $f$ not exceeding $10^{-9}$ for the initial condition $x_0=2.8$ using the second-order secant method derived in (a). The C code should start as follows:
Question #5
Use Taylor series to derive a numerical differentiation method for the ODE $$\frac{d\phi}{dt}=f(\phi,t)$$ when given $f(\phi,t)$ and $g(\phi,t)=d^2\phi/dt^2$ and $h(\phi,t)=d^3\phi/dt^3$. Note that $f$ and $g$ and $h$ are given expressions and are thus free of numerical error. Specifically, do the following:
(a)  First derive a method that is third-order accurate. You should also prove that the global error on $\phi_N-\phi_0$ is $O(\Delta t^3)$.
(b)  Then derive a method that is fourth-order accurate. You should also prove that the global error on $\phi_N-\phi_0$ is $O(\Delta t^4)$.
Question #6
You fit a curve using the method of least squares through the following data points:
$x$$y$
10${9}/{2}$
2$\pi/4$$\sqrt{2}$
3$\pi/2$?
and with the function: $$ y=c_1 \sin(x) + c_2 \cos(x) $$ with $x$ in radians. If the method of least squares yields $c_1=2$ and $c_2=3$, find $y_3$.
Reminder
Least square fit of a combination of functions: $$ (A^T A) C = A^T Y $$ Equations for inner nodes within cubic splines: $$ f_i(x)=a_i(x-x_i)^3 + b_i(x-x_i)^2 + c_i(x-x_i)+d_i $$ $$ d_i=y_i $$ $$ a_i=(b_{i+1}-b_i)/(3\Delta x_i) ~~\textrm{for}~1\le i \le N-1 $$ $$ c_i = \frac{\Delta y_i}{\Delta x_i} - b_i \Delta x_i - \left( \frac{b_{i+1}-b_i}{3}\right)\Delta x_i ~~\textrm{for}~1\le i \le N-1 $$ $$ \Delta x_{i-1} b_{i-1} + 2 \left(\Delta x_i + \Delta x_{i-1} \right) b_i + \Delta x_i b_{i+1} = 3 \left(\frac{\Delta y_i}{\Delta x_i} - \frac{\Delta y_{i-1}}{\Delta x_{i-1}}\right)~~\textrm{for}~2\le i \le N-1 $$
12.20.18
PDF 1✕1 2✕1 2✕2
$\pi$