HW2 for CS 6210
You may (and probably should) talk about problems with the each other, with the TA, and with me, providing attribution for any good ideas you might get. Your final write-up should be your own.
1. Connect the dots
Give a numerical example of a dot product that is computed to low relative accuracy in Julia using the standard algorithm.
2. Rewriting puzzle
The following block of code considers three methods for computing $z = (e^x-1)/x$:
8.4451e-16
1.10468e-14
4.28332e-14
4.32521e-13
9.70175e-12
3.79829e-11
5.66321e-10
1.10775e-8
8.22404e-8
0.110223
0.0
0.0
2.21934e-16
2.22034e-16
0.0
0.0
0.0
2.22045e-16
0.0
2.22045e-16
The alternate formulation agrees much better with the reference computation than the naive computation does. Can you explain why? Give a first-order Taylor expansion of $z$ as a function of $x$ near $x = 0$; how well does this agree with the reference computation, and why?
3. Low rank revisited
Argue that, absent overflow or underflow, the floating point code
u = x*dot(y,z)
actually yields $\hat{u} = \hat{x} \hat{y}^T z$ where $\hat{y}_i = y_i (1+\delta_i)$ with $|\delta_i| \lesssim n \epsilon_{\mathrm{mach}}$ and $\hat{x}_i = y_i (1 + \eta_i)$ with $\eta_i \leq \epsilon_{\mathrm{mach}}$