{
 "cells": [
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-27T09:52:23.298788Z",
     "start_time": "2024-09-27T09:52:22.778498Z"
    }
   },
   "cell_type": "code",
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ],
   "id": "91d1b834b4e49cbd",
   "outputs": [],
   "execution_count": 2
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-27T09:52:23.312699Z",
     "start_time": "2024-09-27T09:52:23.309026Z"
    }
   },
   "cell_type": "code",
   "source": [
    "var_names = ['X0', 'X1', 'X2', 'X3', 'X4', 'X5']\n",
    "n = len(var_names)\n",
    "L = 2000\n",
    "e = .3"
   ],
   "id": "71d38092c1470043",
   "outputs": [],
   "execution_count": 3
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-27T10:00:05.032159Z",
     "start_time": "2024-09-27T10:00:04.959280Z"
    }
   },
   "cell_type": "code",
   "source": [
    "x = np.random.randn(2, n)\n",
    "for i in range(2, L):\n",
    "    l = list()\n",
    "    x_1 = 1.4 - x[i-1, 0]**2 + .3 * x[i-2, 0]\n",
    "    l.append(x_1)\n",
    "    for p in range(1, n):\n",
    "        x_p = 1.4 - (e * x[i-1, p-1] + (1-e) * x[i-1, p])**2 + .3 * x[i-2, p]\n",
    "        l.append(x_p)\n",
    "    x = np.vstack([x, np.asarray(l)])\n",
    "data = x\n",
    "data.shape"
   ],
   "id": "2859243aee599384",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2000, 6)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 18
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-27T09:59:59.375476Z",
     "start_time": "2024-09-27T09:59:59.218866Z"
    }
   },
   "cell_type": "code",
   "source": [
    "plt.plot(data[:30])\n",
    "plt.xlabel('t', fontsize=18)\n",
    "plt.title('Henon', fontsize=24)\n",
    "plt.tight_layout()\n",
    "plt.show()\n",
    "plt.close()"
   ],
   "id": "58d6d6219d990395",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ],
      "image/png": "[encoded data, 168020 characters]"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "execution_count": 17
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "732b64737199f66b"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
