5. Iterative Computation: Exercise#

Name:

\[ % Latex macros \newcommand{\mat}[1]{\begin{pmatrix} #1 \end{pmatrix}} \newcommand{\p}[2]{\frac{\partial #1}{\partial #2}} \newcommand{\b}[1]{\boldsymbol{#1}} \newcommand{\w}{\boldsymbol{w}} \newcommand{\x}{\boldsymbol{x}} \newcommand{\y}{\boldsymbol{y}} \]
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

1. Newton’s method#

  1. Define a function of your interest and find the solutions for \(f(x)=0\) by Newton’s method and quasi Newton’s method.

  2. Define an n-dimensional functions in n-dimensional space (e.g. n=2) and find solutions for \(\b{f}(\b{x})=\b{0}\) by Newton’s method and quasi Newton’s method.

2. Bifurcation and Chaos#

A value of \(x_k\) that stays unchanged after applying a map \(f\) to it, i.e.

\[x_k = f(x_k) = x_{k+1}\]

is called a fixed point of \(f\).

Let us consider the logistic map

\[ x_{k+1} = a x_k(1 - x_k) \]

A bifurcation diagram is a plot of trajectories versus a parameter.
draw the bifurcation diagram for parameter \(a\) \((1 \le a \le 4)\), like below:
bifurcation

Hint:

  • Use the logistic() and iterate() functions from the previous lecture.

  • For each value of \(a\), show the trajectory (i.e., the values that \(x_k\) took over some iterations) of the map after an initial transient.

  • Since \(x_k\) is 1D, you can plot the trajectory on the y axis. For example, take 200 points in \(1 \le a \le 4\), run 1000 step iterations for each \(a\), and plot \(x\) after skipping first 100 steps.

3. Recursive call and fractal#

Draw the Sherpinski gasket like below.

shelpinski