HW 1 for CS 4220
You may (and probably should) talk about problems with the each other, with the TAs, and with me, providing attribution for any good ideas you might get. Your final write-up should be your own.
1: Placing Parens
Suppose $A, B \in \mathbb{R}^{n \times n}$ and $d, u, v, w \in \mathbb{R}^n$. Rewrite each of the following Julia functions to compute the same result but with the indicated asymptotic complexity.
hw1p1a (generic function with 1 method)
"P1a code passes correctness test"
hw1p1b (generic function with 1 method)
"P1b code passes correctness test"
hw1p1c (generic function with 1 method)
"P1c code passes correctness test"
2: Making matrices
Recall the first kind Chebyshev polynomials, which satisfy
$$\begin{align*} T_0(x) &= 1 \\ T_1(x) &= x \\ T_{n+1}(x) &= 2x T_n(x) - T_{n-1}(x), \quad n \geq 1. \end{align*}$$
Write the matrix $A \in \mathbb{R}^{5 \times 5}$ representing the linear map from the coefficients of $p \in \mathcal{P}_4$ in the Chebyshev basis to the coefficients of the same $p \in \mathcal{P}_4$ in the power basis.
Write the matrix $B \in \mathbb{R}^{5 \times 4}$ representing the linear map $p(x) \mapsto x p(x)$ from $\mathcal{P}_3$ to $\mathcal{P}_4$ with respect to the Chebyshev basis for both spaces.
Hint for 2: Observe that the Chebyshev recurrence can also be written as
$$x T_n(x) = \frac{1}{2} T_{n-1}(x) + \frac{1}{2} T_{n+1}(x)$$
3: Crafty cosines
Suppose $\| \cdot \|$ is a inner product norm in some real vector space and you are given
$$a = \|u\|, \quad b = \|v\|, \quad c = \|u-v\|$$
Express $\langle u, v \rangle$ in terms of $a$, $b$, and $c$. Be sure to explain where your formula comes from.
compute_dot (generic function with 1 method)
"Fails sanity check"