{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Pynamical: quick overview\n", "\n", "**Citation info**: Boeing, G. 2016. \"[Visual Analysis of Nonlinear Dynamical Systems: Chaos, Fractals, Self-Similarity and the Limits of Prediction](http://geoffboeing.com/publications/nonlinear-chaos-fractals-prediction/).\" *Systems*, 4 (4), 37. doi:10.3390/systems4040037.\n", "\n", "Pynamical documentation: http://pynamical.readthedocs.org\n", "\n", "This notebook provides a quick overview of using pynamical." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pynamical import logistic_map, simulate, bifurcation_plot" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Simulate a model and visualize its bifurcation diagram:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "pops = simulate(model=logistic_map, num_gens=100, rate_min=0, rate_max=4, num_rates=1000, num_discard=100)\n", "bifurcation_plot(pops)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Zoom into a slice of this bifurcation diagram to see its [fractal structure](pynamical-demo-logistic-model.ipynb):" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "pops = simulate(model=logistic_map, num_gens=100, rate_min=3.7, rate_max=3.9, num_rates=1000, num_discard=100)\n", "bifurcation_plot(pops, xmin=3.7, xmax=3.9)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Plot a two-dimensional [phase diagram](pynamical-demo-phase-diagrams.ipynb) of the logistic map:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pynamical import phase_diagram\n", "pops = simulate(model=logistic_map, num_gens=4000, rate_min=3.6, rate_max=4.0, num_rates=50, num_discard=100)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "phase_diagram(pops, xmin=0.25, xmax=0.75, ymin=0.8, ymax=1.01, size=7, color='viridis')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Or a three-dimensional phase diagram of the [cubic map](pynamical-demo-other-models.ipynb):" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pynamical import cubic_map, phase_diagram_3d\n", "pops = simulate(model=cubic_map, num_gens=3000, rate_min=3.5, num_rates=30, num_discard=100)\n", "phase_diagram_3d(pops, xmin=-1, xmax=1, ymin=-1, ymax=1, zmin=-1, zmax=1, alpha=0.2, color='viridis', azim=330)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Or animate them with [pynamical-demo-3d-animation.ipynb](pynamical-demo-3d-animation.ipynb):" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import IPython.display as IPdisplay\n", "IPdisplay.Image(url='images/phase-animate/05-logistic-3d-phase-diagram-chaotic-regime.gif')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Or create animated cobweb plots with [pynamical-demo-cobweb-plots.ipynb](pynamical-demo-cobweb-plots.ipynb):" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "IPdisplay.Image(url='images/animated-logistic-cobweb.gif')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## For more info:\n", " - [Read the journal article](http://geoffboeing.com/publications/nonlinear-chaos-fractals-prediction/)\n", " - [Pynamical documentation](http://pynamical.readthedocs.org)\n", " - [Chaos Theory and the Logistic Map](http://geoffboeing.com/2015/03/chaos-theory-logistic-map/)\n", " - [Visualizing Chaos and Randomness with Phase Diagrams](http://geoffboeing.com/2015/04/visualizing-chaos-and-randomness/)\n", " - [Animated 3D Plots in Python](http://geoffboeing.com/2015/04/animated-3d-plots-python/)" ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python (pynamical)", "language": "python", "name": "pynamical" }, "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.10.4" } }, "nbformat": 4, "nbformat_minor": 4 }