程序代写代做代考 Homework 3¶

Homework 3¶

Problem 1¶
(In Julia) Use Gauss-Seidel iteration from the IterativeSolvers.jl package to solve $Ax=b$, $A \in \mathbb{R}^n$ for
$$ A = \begin{bmatrix} 2 & -1 & 0 & 0 & 0 & \cdots & 0 \\ -1 & 2 & -1 & 0 & 0 & \cdots & 0 \\ 0 & -1 & 2 & -1 & 0 & \cdots & 0 \\ & \ddots & \ddots & \ddots & \ddots & \ddots & \\ 0 & \cdots & 0 & -1 & 2 & -1 & 0 \\ 0 & \cdots & 0 & 0 & -1 & 2 & -1 \\ 0 & \cdots & 0 & 0 & 0 & -1 & 2 \end{bmatrix} $$
and

$$ b = \begin{bmatrix} 1 \\ \vdots \\ 1 \end{bmatrix} $$
Take $n=100$. Think about what you can use in Julia to construct the matrix more easily.
In [ ]:

Problem 2¶
(Analytical) Find the 3rd-order Taylor’s Polynomial for $f(x) = \sin(x)$ centered at $a=0$ (i.e., the Maclaurin polynomial). What is the error term, $E_3(x)$?
In [ ]:

Problem 3¶
(Analytical) Find the 4rd-order Taylor’s Polynomial for $f(x) = \ln(x)$ centered at $a=1$. What is the error term, $E_4(x)$?
In [ ]:

Problem 4¶
(Analytical) Use Newton’s Method to get an iterative method for finding the square root of a number $a$. Simplify your formula so that there are no subtractions. Show your derivation in a Markdown cell. Hint: what function has $\sqrt{a}$ as a root?
In [ ]:

Problem 5¶
(In Julia) Use the formula you got for your square root solver in Problem 1 to approximate the square root of 2. For simplicity, you can do a for-loop over five to ten iterates of your formula. Print out your iterates to observe the convergence.
In [ ]: