324 lines
72 KiB
Plaintext
324 lines
72 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import sympy as sp\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"from sympy.plotting import plot\n",
|
||
|
"from sympy.polys.polyfuncs import horner\n",
|
||
|
"\n",
|
||
|
"sp.init_printing()\n",
|
||
|
"\n",
|
||
|
"%matplotlib inline"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"x, s = sp.symbols(\"x, sigma\")\n",
|
||
|
"s = sp.sympify(1)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"full = sp.exp(- (x/s)**2)\n",
|
||
|
"approx = full.series(x, x0=0, n=5).removeO()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 5,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"x_vals = (-2 *s, -1.6*s, 0, 1.6*s, 2 * s)\n",
|
||
|
"y_vals = list(full.subs(x, e) for e in x_vals)\n",
|
||
|
"y_vals[0] = 0\n",
|
||
|
"y_vals[-1] = 0"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA58AAAA/CAYAAABn5XwPAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAElEQVR4Ae2d4ZXdttGGr3VUgCJXYKeDSKrAcgexXYG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WssXi1OG36NyjUtfnHG5ge1iR3tMfv6RqBeLDDroV0qqb6qnNTOY6PTev0rWdmwiaCUwja800fGz8GYPqBHtXZokPFzVDq7eHJhhdmZTtjzi+qEtB5CqJPj7ZVQD11TMRZf3XNe/5MUozpv8rTX/rDyWa66SrdIptXIKbFv/KbgmQPYYnOWe9mf0pFRNvVM+sAloQXil8rgifjT0jv44sOnLiRlotkJtmV4neKtxqy3j2ZNXua2ohHF88ROaLdNB8nhToZ8QdvnDROezq0Un7YhjuiqtWSU/UbKu/iCEMvXaa9CSy7vmiDnszh7vzJfMEPv8HmEx9LYAO49MOp4hb+uPCo6SH9N9uc2rbs+DA72qMf/a3pOMJTtEO+vcT4wrJbc3zzfKz1p+zvTeb3jMNevSSbtRSfEj1R5D5pAYxf20WZQqtrlz8p293FfO5LT7XVe3SvcatesvGvbCTwNSddJzlKkx0rBWfupTzdIizXueajbKxY97xQpJwHGeU6SEX/C5n3jYyheHPf/7tS1oD88GbauClt6vM/zfbnJGezHyilZ/1tDc5bAcwTfvnd3Q/RHjJXMh9sIY25rrduOk+ZV9nVWv7po1rpLZbZpCud0lI84A4FdZ5Jx4RZW9AANHEZTN5z8WGBxEkLiyM2nxg7YVRvD0/4YojovQz0h2B8LP9d1o9+EjkNSo4GAgsqY7LYQt0MbLZ
|
||
|
"text/latex": [
|
||
|
"$\\displaystyle \\begin{cases} - 0.27606958941084 x^{3} - 0.80213917882168 x^{2} + 6.93889390390723 \\cdot 10^{-18} x + 1.0 & \\text{for}\\: x \\geq -2 \\wedge x \\leq 0 \\\\0.27606958941084 x^{3} - 0.80213917882168 x^{2} + 6.93889390390723 \\cdot 10^{-18} x + 1.0 & \\text{for}\\: x \\geq 0 \\wedge x \\leq 2 \\end{cases}$"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
"⎧ 3 2 \n",
|
||
|
"⎪- 0.27606958941084⋅x - 0.80213917882168⋅x + 6.93889390390723e-18⋅x + 1.0 f\n",
|
||
|
"⎨ \n",
|
||
|
"⎪ 3 2 \n",
|
||
|
"⎩ 0.27606958941084⋅x - 0.80213917882168⋅x + 6.93889390390723e-18⋅x + 1.0 f\n",
|
||
|
"\n",
|
||
|
" \n",
|
||
|
"or x ≥ -2 ∧ x ≤ 0\n",
|
||
|
" \n",
|
||
|
" \n",
|
||
|
"or x ≥ 0 ∧ x ≤ 2 "
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 6,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"spline = sp.interpolating_spline(3, x, x_vals, y_vals)\n",
|
||
|
"spline"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 7,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAssAAAAVCAYAAACwo6OtAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAS60lEQVR4Ae2d65UcNROGhz0OYLEjADLwJQLsDD4gAkMG5vgf/3wgAyAC22QARGBDBkAENpvBfu+jVbXVGqlV6u7ZnWFb57Sllkp1eVVVrb7M+qPLy8vdVjYEbhMC33333aey97GO9zpoP9LxQv1/qt7KhsCGQAEBxce5up/HIeKG8lT9F1fN7d8NgQ2BY0cgxvGX0vMbtR/k+qrva/UR6/di/b36/s7pbtv5ndtm8GbvhoAQ+F7H30oAP4GG6meqftfxMedb2RDYECgiwEXzGxtR+0e1/9DxmfVt9YbAhsDxIqCYvS/teFBEYUM8KvFa+IvqsDlWDc1rHU9GhLfw5OwW2ryZvCHwQhC8TGDgDpqnzFvZENgQqCPwtS6edqGFipvOT9XHBXgrGwIbAkeOgGL1Tx0/SM3ak2I2xfbWaCda3hrdPXKzrkW9bbN8LTBvQo4JgZgw0k8u/if9uPBvZUNgQ6COAE+V39aHt5ENgQ2BE0fgV+n/q66R4Xqomk8yeIN068vJfIahReNuh6car9Tmbufki+y4ry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nvTm65btuvFFANqyey8WzqaNEd9ltYBXqUb64Sdmmm3SYjG+jS+pqLDrtSVjdSHO0BjehgXA6qdyxAkb37shoEjF/VcESsocv387yhOj9BLHt1u270AnSD0Piy0aRzyi4sNYKT6hGG8+MsDTGd3Ys8EMdbzP69LSmd4snvxrlSe0nYsYdF5tknPpNPEiSJR7qHhVouBHgeyJwQGe
|
||
|
"text/latex": [
|
||
|
"$\\displaystyle - 0.27606958941084 x^{3} - 0.80213917882168 x^{2} + 6.93889390390723 \\cdot 10^{-18} x + 1.0$"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
" 3 2 \n",
|
||
|
"- 0.27606958941084⋅x - 0.80213917882168⋅x + 6.93889390390723e-18⋅x + 1.0"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 7,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"spline.args[0][0]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 14,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEWCAYAAAAzcgPFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3dd3wVVf7/8de56ZQEQu9FQi8BAqJYwEYTUVAEQRQLRkER164/XV1F1raIBUQsX0WliAoIYgeVIoTepLcA0kMLIe38/piAEVNuYia5uXk/H49s9mbOTD73Mbt5M3PPfI6x1iIiIuJrPEVdgIiISFYUUCIi4pMUUCIi4pMUUCIi4pMUUCIi4pMUUCIi4pMUUCIi4pMUUCIi4pMCvRlkjKkMdASqA6eANUCctTbdxdpERKQEMzl1kjDGdAYeBSK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9sBma+1Wa20yMAnodc4YC5Q1Tt+fMsBhoEReGlwUVZF/XdWIGSv38MGC7dkPHDoUHn8cxo+HZ58ttPpERAqbm62OagC7Mr2OB84/Z8wbwAxgD1AWuNFam04Jdfel57FiVwLPz1pP8xoRtKsbmfXA556DPXvg3/+G6tWdJTtERPyMm1dQJoufnXtPqguwAqgORANvGGPC/3YgY4YYY+KMMXEHDhwo+Ep9hMdjeKVvK2qWD+Oej5ex/1hS1gONca6gunVzOk/MmFG4hYqIFAI3AyoeqJXpdU2cK6XMBgOfW8dmYBvQ+NwDWWvHW2tjrLUxlSp
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"p1 = plot(full, show=False, xlim=(0, 3), ylim=(-0.1, 1.1))\n",
|
||
|
"p2 = plot(spline, show=False, line_color='r')\n",
|
||
|
"p1.append(p2[0])\n",
|
||
|
"p1.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 15,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAKUAAAAPCAYAAACFrA9SAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFa0lEQVRoBe2a3XUVNxCAjQ8FOKYCoAMMHTgdhFABoYPk1W8c0gFQQYAOAhUQ6ABSQcztwPk+WaPs7tWuZO6amwfmHN2RRqP502hWu/aNi4uLg+/wPQK7RuDs7Owe7eNQDuMjxsfgz0N6q3+zxdA7j+Jnmfcf8F3as15j4LsD/295/X3wuWPoIyfzfEHM32PwBPykECudFl+ef83SE/qbiohEYu75YO6Y/uM5fugRj1jyB7SqP9D1o0f/qnwa1mtnh43v4DEJw0f7wsklGv/COxvLVZISBR9Q+RT8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Q1OE0++Mt9D/5dQP1vkReJOBeL0LF4qILpG+C17fQJUHtqphwgPuVlZ8G3Ess1ktKEiIox1Omp8YNqbNhwbtSHR4NMpmmymKgvoLuZW8kN/Yt0cEnkK/DB2gfI1w4/+t6mn/wBHzH2jjmsDl4vpgcHUuKxQm354OQeYG073aPp3umW8Rn5DF8zloe7BgQlXurPs7Ikjr4b9jMtXWolSqNd0LxfFWBsFXQjnffPeKVB84VlKanVY2tBi+9WFpBOdkWYNk4rgTZrX6kC9H2z9JCUQ0pf3aNYMJ5CS3/wr8L3lXYu6U57FkaK0RF/cRsWDKeasbyxxn8J5cC7ERuaLzYPaE+hlw1jrKGfQG5auU9kmobWwEp7Mp2A5kl3jSdRMBneQx+9rbf4mI+qphyTR3vTNYC50Rs040g0+YTZb4+ZN/hM9K1YKAC+Lv1r86lbQK4+Ldp5Bd3uR1RLffYQ++fiDXgEWa+00D2K5b8z6e0QbaTizAAAAABJRU5ErkJggg==\n",
|
||
|
"text/latex": [
|
||
|
"$\\displaystyle -0.2441961116159$"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
"-0.244196111615900"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 15,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"spline.subs(x, 1.99).evalf() * 255"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 42,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def bellCurveApproximation(x, inverseWidth):\n",
|
||
|
" if x < 0:\n",
|
||
|
" x = -x\n",
|
||
|
"\n",
|
||
|
" nx = x * inverseWidth * 4\n",
|
||
|
" if nx > 2:\n",
|
||
|
" return 0\n",
|
||
|
"\n",
|
||
|
" x2 = nx * nx\n",
|
||
|
" x3 = x2 * nx\n",
|
||
|
" res = 0.27606958941084 * x3 - 0.80213917882168 * x2 + 1\n",
|
||
|
" \n",
|
||
|
" return 0 if res < 0 else res"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 43,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[<matplotlib.lines.Line2D at 0x7f4a503fd190>]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 43,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD4CAYAAAD8Zh1EAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAYd0lEQVR4nO3de3CV933n8fdXEgLERcDRBRDiJsRF2AZccRGXBhubYrtrmnbrS9tNN5MsyzbOOjPtNN7u7HZTT6fT6aTTzcSJTVxvku021Eldm7hsbMaXGIyJkWNsh5sRAoPMRRfuCCQkffcPHbInQqADes55znnO5zWjQc9zHs75/IbhM8/8nuf8HnN3REQk++WFHUBERIKhQhcRiQgVuohIRKjQRUQiQoUuIhIRBWF9cElJiU+dOjWsjxcRyUrvvfdeq7uX9vdaaIU+depU6uvrw/p4EZGsZGafXO81TbmIiESECl1EJCJU6CIiEaFCFxGJCBW6iEhEDFjoZvacmTWb2S+u87qZ2TfMrMHMPjSzO4OPKSIiA0nmDP27wJobvH4fUB3/WQd8e/CxRETkZg1Y6O7+FnDqBoesBb7vvXYAY8xsQlAB+2q70MGTL+/hbPuVVH2EiEhWCmIOvQI4mrDdFN93DTNbZ2b1Zlbf0tJySx/29sE2/tfbh7j762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iojkMBV6AJZUxehx2HnoVNhRRCSHqdADcOfksRQW5Gl9dBEJlQo9AMOG5PNrk8dqXRcRCZUKPSB1VTH2HD/HmfbOsKOISI5SoQekriqGO/xM8+giEhIVekD
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.plot([bellCurveApproximation(i, 1 / (51 / 2)) for i in range(51)])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 25,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def extract_blue(v):\n",
|
||
|
" return (v >> 16) & 255"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 36,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAL8AAAAPCAYAAAC1IB5zAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAHuklEQVRoBd2a7XEUORCGFxcBGC4CTAZ8ZAAZwBGBIQMo/vGPggyACPjIAIiAjwzgIgCcge95tGpZM6OZ0WLsqruu0kpqtbpb6lct7doXjo+PN+dJT548uUb5Wtukv0//MvX3mv9/abOuA9Zyi/KG9tF5ruusbKP3Px/Hi3UgWNCz3P9BfZXyDF4XIPMmP8jzBbMBd/6HzIvqIzzH4wDYlq5vq+1n1vco825Q/6Q8gh/z8tBmA+9F6XCIaB/CWwUZMteQfUAdfldqkl7H31KuL+nLepbk1KOPL5ClmtAR/Es1l37EItiv4U3WHoPWjLfWs5Ptyu4aBnrjaH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h9Mh9gCqX58lN+oTeuP/gyL7Oq5e98BAGbDySwztLjnmJUJemyaOQ9rabBJjrinW4x5N4lBPRH5xPcois2obGW2uYqDStxjHLGeWfkwxzkGTGGG7V64bGxpD7+xe/gsCwZXfYN0PQwAAAABJRU5ErkJggg==\n",
|
||
|
"text/latex": [
|
||
|
"$\\displaystyle 0.35294117647058826$"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
"0.35294117647058826"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 36,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"v = [extract_blue(e) for e in data[0]]\n",
|
||
|
"v.count(0) / len(v)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 27,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[<matplotlib.lines.Line2D at 0x7f4a4fe84340>]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 27,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3deXRV1d3G8e8vcwgJYwgQgsxgIpNGoFArYsVZLA7FthatlVeLVVutxdY61Gq1tVZta/tSJ946ICoUa7GKqLVUBcIUZghjIkgCYYaEDPv9IzcYMUhIcnNyz3k+a7GSe+69yXOWi8fNPufubc45RETEX6K8DiAiIo1P5S4i4kMqdxERH1K5i4j4kMpdRMSHYrwOANC+fXvXrVs3r2OIiESUhQsX7nDOpdb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z1SG3JI1cMJLdgD/f9Y6XXcUTq7LjlbmYZZvaema0ysxVmdkvoeFszm21m60Jf29R4z51mlmdma8zs3HCeQKR6YNZK1hcd4NErB9EmKc7rOPIlzjulIzeO7MlL87cwbUG+13FE6qQuI/dy4Dbn3MnAMGCimWUCk4A5zrnewJzQY0LPjQOygPOAJ81Mu0rU8M7K7Tz/8RYmfK2HLtRFiNtH9+Wrvdpz18zlLCvQRtvS/B233J1z25xzi0Lf7wNWAenAGGBK6GVTgEtD348BpjrnSp1zG4E8YEhjB49UhftKuOO1XDI7pXDbaM2zR4roKOPxcYNonxTHDc8vZNeBw15HEvlSJzTnbmbdgMHAPCDNObcNqv4HAHQIvSwdqPl
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.plot([extract_blue(e) for e in data[0]])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"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.10"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 4
|
||
|
}
|