Lab assignment 1: Due Friday February 16, 18:00 EST

For this assigment, you will need a set up to work with Python code, in particular, to develop Jupyter notebooks, as well as a GitHub account to share your notebooks.

Exercise 1: Taylor polynomials

1. Read and understand what the code is doing. Explore the parameter landscape.
2. From the "error vs $n$" plot, we see that after a certain point, increasing $n$ does not improve the total accuracy anymore. Investigate experimentally, how this threshold depends on $x$ and $\varepsilon$.
3. Modify the code to study the relative error $|e^x-\tilde T_n(x)|/e^x$, instead of the absolute error $|e^x-\tilde T_n(x)|$, where $\tilde T_n(x)$ is the computed version of $T_n(x)$. Explain the observed behavior.
4. Pick your favorite transcendental function, and modify the given code accordingly for its computation. Not only the usual functions such as $\sin x$, $\cos x$, $\log x$, $\arctan x$, etc., but also more special functions such as $\mathrm{erf}\,x$, $\mathrm{Li}\,x$, $\mathrm{Si}\,x$, $J_\nu(x)$, etc. are allowed. Repeat the preceding 2 items for this function.
5. If you make any improvements to the original code, please mention it in your notebook.

Exercise 2: Newton's and Steffensen's fractals

Download this notebook, which is an attempt to produce fractals similar to the ones described here.
1. Read and understand what the code is doing. Why is there a large monochromatic region around each of the roots?
2. Generate a nice fractal by zooming in on a boundary between two regions. Try changing the resolution, the color setting, and other parameters. Heuristically explain the fractal nature of the boundary.
3. Pick a polynomial or a more general function, and modify the code to implement the corresponding Newton-Raphson iteration. Note that you will need to know the roots of the function in the complex plane. Investigate and explain the resulting graphics.
4. Modify the code again to implement Steffensen's iteration $$\phi(z) = z - \frac{\omega f(z)^2}{f(z+\omega f(z))-f(z)}$$ for some function $f$, where $\omega\in\mathbb{R}$ is a constant. The case $\omega=1$ is the classical Steffensen method. Produce graphics for several values of $\omega$, starting with $\omega=1$, and explain the behaviour.
5. By computing the derivative of $\phi$, show that Steffensen's method is locally a quadratically convergent method. If you are not comfortable with complex derivatives, you can do it only in the real case.
6. If you make any improvements to the original code, please mention it in your notebook.

How and what to submit

Please submit links to your Jupyter notebooks on GitHub by email, before Friday February 16, 18:00 EST.
• Include theory and commentaries in your Jupyter notebooks, by using Markdown cells.
• Notebooks without sufficient commentaries will not be accepted.
• You can update your notebooks up to the time limit, but please do not commit any overdue updates.
The subject line of the email should be:
• [Math 387 Lab 1] Yourname