Simple expressions for project 1

For the special matrix we can can actually precalculate the updated matrix elements \( \tilde{d}_i \). The non-diagonal elements \( e_i \) are unchanged. For our particular matrix in project 1 we have $$ \tilde{d}_i= 2 - \frac{1}{\tilde{d}_{i-1}}=\frac{i+1}{i}, $$ and the new righthand side \( \tilde{f}_i \) given by $$ \tilde{f}_i= f_i + \frac{(i-1)\tilde{f}_{i-1}}{i}. $$ Recall that \( \tilde{d}_1=2 \) and \( \tilde{f}_1=f_1 \). These arrays can be set up before computing \( u \).

The backward substitution gives then the final solution $$ u_{i-1}= \frac{i-1}{i}\left(\tilde{f}_{i-1}+u_i\right), $$ with \( u_n=\tilde{f}_{n}/\tilde{b}_{n} \).