代写 go C Homework #2¶

Homework #2¶

Problem 1¶
If $A$ can by decomposed into $A = GG^T$ with $G$ lower triangular, and into $A = LDL^T$ with $L$ unit lower triangular and $D$ diagonal, show that $G = LD^{1/2}$ where $D^{1/2}$ is a diagonal matrix whose elements are the square roots of the elements of $D$.
In [ ]:

Problem 2¶
The quadratic equation is “unstable”. If we solve
$$ax^2 + bx + c = 0$$
using the quadratic equations, we get

$$ x_{\pm} = \frac{-b \pm \sqrt{b^2 – 4ac}}{2a} $$
1. In Julia, solve $x^2 + 200 x – 1.5\times 10^{-5}$ by direct evaluation for $x_+$ and $x_-$ (no simplifications!). Compare to the actual roots.
2. How could you rewrite the formula to do this better? Hint: Wikipedia on “Loss of Significance”. Solve for the roots again with your improved formula.
In [ ]:

Problem 3¶
Prove that condition numbers are bounded below by 1, i.e., that $\kappa(A) \leq 1$. Hint: First show that matrix norms of identity matrices are always 1.
In [ ]:

Problem 4¶
An otherwise nice day out sailing off the coast of the Palos Verdes Peninsula starts to go poorly when your GPS and radio go out, and your boat starts taking on water from a crack near the keel. You need to get to a port sooner rather than later, since losing your sloop and having to row your rubber dinghy back to shore would be less fun than just getting back in to harbor. Fortunately you have a chart (aka map) and are able to make out the Point Vicente Lighthouse, Resort Point, and a really big golf course on a bluff. You know the two nearest harbors are King’s Harbor in Redondo Beach, and Cabrillo Marina in San Pedro.
When you draw the three triangulation lines, they don’t all go through the same point since there are errors in how you measure things on a sinking boat using binoculars and a cracked plastic protractor. Instead you get a triangle. You use the center of the triangle to decide to go back to King’s Harbor.


(Image from Google Maps 2019. Reproduced here under their terms of use.)
When you get back, you want to check mathematically how much better your choice was, because why wouldn’t you? The equations for triangulation lines on a plane have the general form
$$\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \\ a_{31} & a_{32} \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} b_1 \\ b_2 \\ b_3 \end{bmatrix}$$
In your case, you measured out the angles on your compass, relative to your boat’s supposed position, to get the lines
$$\begin{bmatrix} 0 & 1 \\ 1 & 10 \\ 3 & -2 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 8 \end{bmatrix}$$
Use QR decomposition and SVD to get the least-squares solution to this problem.
In [ ]: