{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\\begin{equation}\n", "x_{n+1} = r(x_n)(1-x_n)\n", "\\end{equation}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "# see https://youtu.be/ovJcsL7vyrk?t=322 for more context\n", "\n", "# The following program carries out the iterative calculation stated above,\n", "# sweeping across different values of r.\n", "# n == number of iterations (x-axis)\n", "from logistics_bifurcation import *\n", "for r in reversed_logspace(2.9,3.84,num=200):\n", " fig, ax = plt.subplots()\n", " scat = ax.scatter(np.arange(NUM_ITER), get_series(r), marker=\"+\")\n", " ax.set_title(f\"{r=}\")\n", " ax.set_xlabel(\"number of iterations\")\n", " if np.isclose(r, 3.83, atol=1E-2):\n", " ax.set_title(rf\"{r=},$\\approx$ period 3!\")\n", " plt.show(block=False)\n", " plt.close(fig)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.2" } }, "nbformat": 4, "nbformat_minor": 2 }