Copy disabled (too large)
Download .txt
Showing preview only (14,168K chars total). Download the full file to get everything.
Repository: coells/100days
Branch: master
Commit: 986a81130a13
Files: 104
Total size: 13.5 MB
Directory structure:
gitextract_c9zpuegw/
├── .gitignore
├── README.md
├── bonus - fast convex hull.ipynb
├── day 00 - logo.ipynb
├── day 01 - hanoi tower.ipynb
├── day 02 - matrix chain multiplication.ipynb
├── day 03 - next permutation.ipynb
├── day 04 - counting 1-bits.ipynb
├── day 05 - eratosthenes sieve.ipynb
├── day 06 - postfix notation.ipynb
├── day 07 - binary addition FSA.ipynb
├── day 08 - binary search.ipynb
├── day 09 - monte carlo - pi.ipynb
├── day 10 - karatsuba multiplication.ipynb
├── day 11 - McCarthy 91.ipynb
├── day 12 - roots of polynomial.ipynb
├── day 13 - extended euclidean algorithm.ipynb
├── day 14 - huffman codes.ipynb
├── day 15 - breaking OTP.ipynb
├── day 16 - no-condition swap.ipynb
├── day 17 - perceptron.ipynb
├── day 18 - monopoly.ipynb
├── day 19 - counting inversions.ipynb
├── day 20 - linearithmic multiplication.ipynb
├── day 21 - k-means.ipynb
├── day 22 - determinant.ipynb
├── day 23 - sudoku.ipynb
├── day 24 - closest pair.ipynb
├── day 25 - conjugate gradients.ipynb
├── day 26 - karger's mincut.ipynb
├── day 27 - spiral matrix.ipynb
├── day 28 - convex hull.ipynb
├── day 29 - string searching.ipynb
├── day 30 - strassen multiplication.ipynb
├── day 31 - timeit.ipynb
├── day 32 - pagerank.ipynb
├── day 33 - reservoir sampling.ipynb
├── day 34 - aho-corasick.ipynb
├── day 35 - median.ipynb
├── day 36 - bulls and cows.ipynb
├── day 37 - longest common subsequence.ipynb
├── day 38 - burrows-wheeler.ipynb
├── day 39 - 4sum.ipynb
├── day 40 - counting ones.ipynb
├── day 41 - union-find.ipynb
├── day 42 - hamming codes.ipynb
├── day 43 - shuffle.ipynb
├── day 44 - gradient approximation.ipynb
├── day 45 - binary search tree.ipynb
├── day 46 - bézier curve.ipynb
├── day 47 - factoradic.ipynb
├── day 48 - dijkstra.ipynb
├── day 49 - ford-fulkerson.ipynb
├── day 50 - game of life.ipynb
├── day 51 - rabin-miller.ipynb
├── day 52 - RSA.ipynb
├── day 53 - RSA encryption scheme.ipynb
├── day 54 - longest unique sequence.ipynb
├── day 55 - quincunx.ipynb
├── day 56 - lzw.ipynb
├── day 57 - quicksort.ipynb
├── day 58 - integer exponentation.ipynb
├── day 59 - colored tiling.ipynb
├── day 60 - bloom filter.ipynb
├── day 61 - hanoi tower II.ipynb
├── day 62 - linked-list cycle.ipynb
├── day 63 - zig-zag.ipynb
├── day 64 - k-clique.ipynb
├── day 65 - floyd-warshall.ipynb
├── day 66 - gram-schmidt.ipynb
├── day 67 - linked-list mergesort.ipynb
├── day 68 - gale-shapley.ipynb
├── day 69 - rmsprop.ipynb
├── day 70 - deadlock.ipynb
├── day 71 - hashtable - chaining.ipynb
├── day 72 - hashtable - open addressing.ipynb
├── day 73 - bresenhams line.ipynb
├── day 74 - google interview question.ipynb
├── day 75 - merkles puzzles.ipynb
├── day 76 - 2-3 tree.ipynb
├── day 77 - unification.ipynb
├── day 78 - horn-satifiability.ipynb
├── day 79 - logistic regression.ipynb
├── day 80 - hopfield net.ipynb
├── day 81 - topological sort.ipynb
├── day 82 - flood fill.ipynb
├── day 83 - breaking AES.ipynb
├── day 84 - maze generation.ipynb
├── day 85 - coin success runs.ipynb
├── day 86 - binary heap.ipynb
├── day 87 - gray code.ipynb
├── day 88 - perlin noise.ipynb
├── day 89 - bipartiteness.ipynb
├── day 90 - simple nim - AI.ipynb
├── day 91 - variations.ipynb
├── day 92 - PCA.ipynb
├── day 93 - first and follow.ipynb
├── day 94 - earley parser.ipynb
├── day 95 - strongly connected components.ipynb
├── day 96 - floyd-steinberg.ipynb
├── day 97 - locally weighted regression.ipynb
├── day 98 - romberg integration.ipynb
├── day 99 - simplex.ipynb
└── day I00 - segmented eratosthenes sieve.ipynb
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.ipynb_checkpoints
================================================
FILE: README.md
================================================
### 100 days of algorithms
This repository contains notebooks with live code to accompany [100 days of algorithms](https://medium.com/100-days-of-algorithms) challenge.
I set the challenge for myself to implement algorithm by algorithm, day by day, until the number reaches **100**.
If you are interested, here's the [intro to the series](https://medium.com/100-days-of-algorithms/100-days-of-algorithms-challenge-41996f7e1ec8) and [all the articles](https://medium.com/100-days-of-algorithms/latest) sorted by date from the latest.
The challenge was quite fun and rough, as well. Do not expect the implementations to be the best, nor fastest, nor nicest, nor bug-free. Do expect to see code written in haste. A code that contains the same amount of enthusiasm and love to algorithms as many it contains bugs.
Feel free to (re)use my code in any way you wish, but bare in mind that the source code is provided "as-is". It is on your own risk and you are solely responsible for whatever happens then.
#### local machine
* download and install the latest version of [Anaconda](https://www.continuum.io/downloads) distribution
* clone the repo: `git clone https://github.com/coells/100days.git`
* open terminal and run Jupyter notebook: `jupyter notebook`
* open [localhost:8888](http://localhost:8888/tree) in your browser
#### notes
* the codebase was developed using `Python 3.6` and `Anaconda 4.3.1`
* notebooks containing [Bokeh](http://bokeh.pydata.org/en/latest/) plots are not directly supported by Github; you better clone the repo a run notebooks locally
#### alternate repository
[Microsoft Azure Notebooks](https://notebooks.azure.com/coells/libraries/100days) with `Python 3.5` support
================================================
FILE: bonus - fast convex hull.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## original algorithm: [day 28 - convex hull](https://github.com/coells/100days/blob/master/day 28 - convex hull.ipynb)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## refactored algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def extend(points, u, v, hull):\n",
" if not len(points):\n",
" return\n",
"\n",
" # find W as the furthest point from U-V\n",
" w = points[np.argmin(np.cross(points - u, v - u))]\n",
" p = points - w\n",
"\n",
" # extend hull for U-W and V-W\n",
" extend(points[np.cross(p, v - w) < 0], w, v, hull)\n",
" hull.append(w)\n",
" extend(points[np.cross(p, u - w) > 0], u, w, hull)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def convex_hull(points):\n",
" # U is left-most hull point, V is right-most hull point\n",
" u = points[np.argmin(points[:, 0])]\n",
" v = points[np.argmax(points[:, 0])]\n",
" w = np.cross(points - u, v - u)\n",
"\n",
" # recurse on hull construction\n",
" hull = [v]\n",
" extend(points[w < 0], u, v, hull)\n",
" hull.append(u)\n",
" extend(points[w > 0], v, u, hull)\n",
" hull.append(v)\n",
"\n",
" return hull"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## benchmark"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1000 loops, best of 3: 987 µs per loop\n"
]
}
],
"source": [
"%timeit convex_hull(np.random.rand(10**3, 2))"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"100 loops, best of 3: 2.35 ms per loop\n"
]
}
],
"source": [
"%timeit convex_hull(np.random.rand(10**4, 2))"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"100 loops, best of 3: 13.8 ms per loop\n"
]
}
],
"source": [
"%timeit convex_hull(np.random.rand(10**5, 2))"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10 loops, best of 3: 167 ms per loop\n"
]
}
],
"source": [
"%timeit convex_hull(np.random.rand(10**6, 2))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 loop, best of 3: 1.98 s per loop\n"
]
}
],
"source": [
"%timeit convex_hull(np.random.rand(10**7, 2))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 00 - logo.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np\n",
"from bokeh.plotting import figure, show, output_notebook"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"xs, ys, cs = [], [], []\n",
"\n",
"for x in range(0, 30):\n",
" for y in range(0, 30):\n",
" up = np.random.randint(0, 2)\n",
" xs.append([x, x + .8])\n",
" ys.append([y + .8 * (up >= .5), y + .8 * (up < .5)])\n",
"\n",
" col = np.random.randint(0, 4)\n",
" cs.append({0: 'blue', 1: 'red', 2: 'white', 3: 'white'}[col])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## plot"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <div class=\"bk-root\">\n",
" <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
" <span id=\"b0521627-9a43-4f6f-9bf6-1fb6ff634f4a\">Loading BokehJS ...</span>\n",
" </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
"\n",
" var force = true;\n",
"\n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
"\n",
"\n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
" window._bokeh_timeout = Date.now() + 5000;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
"\n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
"\n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" document.getElementById(\"b0521627-9a43-4f6f-9bf6-1fb6ff634f4a\").textContent = \"BokehJS successfully loaded.\";\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
"\n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
"\n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"b0521627-9a43-4f6f-9bf6-1fb6ff634f4a\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'b0521627-9a43-4f6f-9bf6-1fb6ff634f4a' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
"\n",
" var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.js\"];\n",
"\n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" Bokeh.set_log_level(\"info\");\n",
" },\n",
" \n",
" function(Bokeh) {\n",
" \n",
" document.getElementById(\"b0521627-9a43-4f6f-9bf6-1fb6ff634f4a\").textContent = \"BokehJS is loading...\";\n",
" },\n",
" function(Bokeh) {\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css\");\n",
" }\n",
" ];\n",
"\n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === true)) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === true) {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (force !== true) {\n",
" var cell = $(document.getElementById(\"b0521627-9a43-4f6f-9bf6-1fb6ff634f4a\")).parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
"\n",
" }\n",
"\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
"}(this));"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"output_notebook()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
" <div class=\"bk-root\">\n",
" <div class=\"bk-plotdiv\" id=\"e04fb131-664e-4433-a26c-417ad0759bed\"></div>\n",
" </div>\n",
"<script type=\"text/javascript\">\n",
" \n",
" (function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
" \n",
" var force = false;\n",
" \n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
" \n",
" \n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
" window._bokeh_timeout = Date.now() + 0;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
" \n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
" \n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" document.getElementById(\"e04fb131-664e-4433-a26c-417ad0759bed\").textContent = \"BokehJS successfully loaded.\";\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
" \n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
" \n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"e04fb131-664e-4433-a26c-417ad0759bed\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'e04fb131-664e-4433-a26c-417ad0759bed' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
" \n",
" var js_urls = [];\n",
" \n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" (function() {\n",
" var fn = function() {\n",
" var docs_json = {\"c6842469-cb8c-4816-94d1-682f8014d0f5\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"2a65bf97-8969-4e28-bc41-f45cf9c6b698\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"56faa974-274c-466f-9bc5-19ab709758e4\",\"type\":\"LinearAxis\"}],\"plot_height\":800,\"plot_width\":800,\"renderers\":[{\"id\":\"2a65bf97-8969-4e28-bc41-f45cf9c6b698\",\"type\":\"LinearAxis\"},{\"id\":\"9bd52784-5bc3-412b-8302-bff8831efe67\",\"type\":\"Grid\"},{\"id\":\"56faa974-274c-466f-9bc5-19ab709758e4\",\"type\":\"LinearAxis\"},{\"id\":\"938977dc-766a-45cf-a2b4-aad14376db13\",\"type\":\"Grid\"},{\"id\":\"74327897-96e3-4ac1-8343-a84bee2b9491\",\"type\":\"BoxAnnotation\"},{\"id\":\"533babb3-6e2f-4d3c-96dc-b97d3298633b\",\"type\":\"GlyphRenderer\"},{\"id\":\"71f64b20-9441-4b0d-b2ee-daa11aed3b2f\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"baf0c65d-35b4-4f8e-a219-9673c2a41196\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"9fa62003-6ec1-45b7-b646-d1149de818b2\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"dba19533-0bed-4624-89e4-3620a3e484bd\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"a593a708-5973-44ca-a3b1-d4a8751079da\",\"type\":\"DataRange1d\"},\"y_range\":{\"id\":\"1a8155dc-86c5-42db-bcd9-c41b82075840\",\"type\":\"DataRange1d\"}},\"id\":\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"callback\":null},\"id\":\"1a8155dc-86c5-42db-bcd9-c41b82075840\",\"type\":\"DataRange1d\"},{\"attributes\":{\"xs\":{\"field\":\"xs\"},\"ys\":{\"field\":\"ys\"}},\"id\":\"a9363304-2bb9-40fe-8905-bbaaca23bb7e\",\"type\":\"MultiLine\"},{\"attributes\":{\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"xs\":{\"field\":\"xs\"},\"ys\":{\"field\":\"ys\"}},\"id\":\"06e382d0-db7d-4655-a2de-020b3556ec44\",\"type\":\"MultiLine\"},{\"attributes\":{\"data_source\":{\"id\":\"a7a32c9c-0ba1-40c4-9059-f7281cab824b\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"a9363304-2bb9-40fe-8905-bbaaca23bb7e\",\"type\":\"MultiLine\"},\"hover_glyph\":null,\"nonselection_glyph\":{\"id\":\"06e382d0-db7d-4655-a2de-020b3556ec44\",\"type\":\"MultiLine\"},\"selection_glyph\":null},\"id\":\"71f64b20-9441-4b0d-b2ee-daa11aed3b2f\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"9fa62003-6ec1-45b7-b646-d1149de818b2\",\"type\":\"ToolEvents\"},{\"attributes\":{\"callback\":null},\"id\":\"a593a708-5973-44ca-a3b1-d4a8751079da\",\"type\":\"DataRange1d\"},{\"attributes\":{\"plot\":{\"id\":\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"9315802a-a2b5-4c59-87fe-7bc298d9492a\",\"type\":\"BasicTicker\"},\"visible\":false},\"id\":\"9bd52784-5bc3-412b-8302-bff8831efe67\",\"type\":\"Grid\"},{\"attributes\":{\"formatter\":{\"id\":\"5a9f1109-c0c5-407d-9c7f-280fd26534b1\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"9315802a-a2b5-4c59-87fe-7bc298d9492a\",\"type\":\"BasicTicker\"},\"visible\":false},\"id\":\"2a65bf97-8969-4e28-bc41-f45cf9c6b698\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"5a9f1109-c0c5-407d-9c7f-280fd26534b1\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"9315802a-a2b5-4c59-87fe-7bc298d9492a\",\"type\":\"BasicTicker\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"8852bcda-1db6-48e0-9a47-c4033a02462c\",\"type\":\"PanTool\"},{\"id\":\"be8326ce-270b-496d-994f-815571056489\",\"type\":\"WheelZoomTool\"},{\"id\":\"5c95187e-0ee8-4321-a22b-bc5df363e8a6\",\"type\":\"BoxZoomTool\"},{\"id\":\"c0111a95-3756-4e8d-8c42-f03f1287cb98\",\"type\":\"SaveTool\"},{\"id\":\"e2b8cd9d-6c3f-4861-a59c-f806dfb28642\",\"type\":\"ResetTool\"},{\"id\":\"29ae9e9e-6bc3-4fa8-8c2b-7834524f95ab\",\"type\":\"HelpTool\"}]},\"id\":\"dba19533-0bed-4624-89e4-3620a3e484bd\",\"type\":\"Toolbar\"},{\"attributes\":{\"formatter\":{\"id\":\"025da67a-3cb3-489c-9821-f010252083a5\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"934f5dcd-c6a0-4161-84ee-efdad9b28f56\",\"type\":\"BasicTicker\"},\"visible\":false},\"id\":\"56faa974-274c-466f-9bc5-19ab709758e4\",\"type\":\"LinearAxis\"},{\"attributes\":{\"line_alpha\":{\"value\":0.1},\"line_cap\":\"round\",\"line_color\":{\"field\":\"line_color\"},\"line_width\":{\"value\":6},\"xs\":{\"field\":\"xs\"},\"ys\":{\"field\":\"ys\"}},\"id\":\"4b16506a-045e-4da8-ad3f-75be424e4aa1\",\"type\":\"MultiLine\"},{\"attributes\":{},\"id\":\"934f5dcd-c6a0-4161-84ee-efdad9b28f56\",\"type\":\"BasicTicker\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"baf0c65d-35b4-4f8e-a219-9673c2a41196\",\"type\":\"Title\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"934f5dcd-c6a0-4161-84ee-efdad9b28f56\",\"type\":\"BasicTicker\"},\"visible\":false},\"id\":\"938977dc-766a-45cf-a2b4-aad14376db13\",\"type\":\"Grid\"},{\"attributes\":{\"data_source\":{\"id\":\"2dfcf6e9-51b7-4783-bd7d-d81aeef4cfc4\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"4b16506a-045e-4da8-ad3f-75be424e4aa1\",\"type\":\"MultiLine\"},\"hover_glyph\":null,\"nonselection_glyph\":{\"id\":\"23bfb5a9-20d8-40ae-9a52-0b5dfab56286\",\"type\":\"MultiLine\"},\"selection_glyph\":null},\"id\":\"533babb3-6e2f-4d3c-96dc-b97d3298633b\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"overlay\":{\"id\":\"74327897-96e3-4ac1-8343-a84bee2b9491\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"5c95187e-0ee8-4321-a22b-bc5df363e8a6\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"plot\":{\"id\":\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"c0111a95-3756-4e8d-8c42-f03f1287cb98\",\"type\":\"SaveTool\"},{\"attributes\":{\"plot\":{\"id\":\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"e2b8cd9d-6c3f-4861-a59c-f806dfb28642\",\"type\":\"ResetTool\"},{\"attributes\":{\"plot\":{\"id\":\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"29ae9e9e-6bc3-4fa8-8c2b-7834524f95ab\",\"type\":\"HelpTool\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"xs\",\"ys\",\"line_color\"],\"data\":{\"line_color\":[\"blue\",\"red\",\"blue\",\"red\",\"red\",\"white\",\"white\",\"blue\",\"white\",\"white\",\"blue\",\"red\",\"red\",\"blue\",\"white\",\"white\",\"white\",\"red\",\"white\",\"blue\",\"white\",\"blue\",\"blue\",\"blue\",\"white\",\"white\",\"white\",\"white\",\"white\",\"red\",\"red\",\"white\",\"white\",\"white\",\"white\",\"red\",\"white\",\"red\",\"red\",\"red\",\"blue\",\"blue\",\"white\",\"white\",\"red\",\"white\",\"blue\",\"blue\",\"blue\",\"white\",\"blue\",\"blue\",\"blue\",\"white\",\"red\",\"white\",\"blue\",\"blue\",\"white\",\"blue\",\"white\",\"red\",\"red\",\"white\",\"red\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"red\",\"blue\",\"white\",\"white\",\"blue\",\"blue\",\"white\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"red\",\"blue\",\"red\",\"white\",\"blue\",\"red\",\"blue\",\"white\",\"red\",\"red\",\"blue\",\"blue\",\"white\",\"red\",\"white\",\"red\",\"white\",\"white\",\"white\",\"red\",\"white\",\"white\",\"white\",\"red\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"red\",\"red\",\"blue\",\"white\",\"blue\",\"white\",\"red\",\"white\",\"white\",\"white\",\"blue\",\"red\",\"white\",\"white\",\"red\",\"blue\",\"blue\",\"white\",\"red\",\"white\",\"red\",\"white\",\"white\",\"blue\",\"white\",\"blue\",\"white\",\"blue\",\"blue\",\"white\",\"blue\",\"blue\",\"blue\",\"white\",\"blue\",\"white\",\"blue\",\"white\",\"red\",\"white\",\"red\",\"blue\",\"white\",\"white\",\"red\",\"white\",\"blue\",\"blue\",\"white\",\"blue\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"blue\",\"white\",\"blue\",\"white\",\"white\",\"blue\",\"blue\",\"blue\",\"white\",\"blue\",\"red\",\"red\",\"white\",\"blue\",\"blue\",\"red\",\"red\",\"blue\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"blue\",\"white\",\"blue\",\"red\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"blue\",\"blue\",\"white\",\"red\",\"white\",\"white\",\"blue\",\"blue\",\"white\",\"blue\",\"white\",\"white\",\"red\",\"blue\",\"blue\",\"red\",\"white\",\"red\",\"red\",\"white\",\"red\",\"blue\",\"white\",\"white\",\"red\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"red\",\"red\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"red\",\"white\",\"blue\",\"white\",\"white\",\"red\",\"red\",\"white\",\"red\",\"red\",\"white\",\"blue\",\"red\",\"red\",\"blue\",\"white\",\"white\",\"red\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"red\",\"blue\",\"white\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"red\",\"white\",\"red\",\"red\",\"red\",\"white\",\"red\",\"white\",\"red\",\"red\",\"blue\",\"white\",\"blue\",\"white\",\"red\",\"red\",\"blue\",\"white\",\"white\",\"red\",\"red\",\"blue\",\"white\",\"white\",\"white\",\"red\",\"blue\",\"blue\",\"white\",\"white\",\"red\",\"blue\",\"blue\",\"blue\",\"red\",\"blue\",\"blue\",\"white\",\"white\",\"blue\",\"white\",\"red\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"white\",\"red\",\"red\",\"white\",\"blue\",\"red\",\"white\",\"red\",\"blue\",\"red\",\"blue\",\"white\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"red\",\"white\",\"blue\",\"white\",\"white\",\"blue\",\"white\",\"red\",\"white\",\"white\",\"red\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"white\",\"blue\",\"blue\",\"white\",\"red\",\"blue\",\"white\",\"blue\",\"red\",\"blue\",\"red\",\"blue\",\"white\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"white\",\"red\",\"white\",\"white\",\"white\",\"red\",\"blue\",\"white\",\"blue\",\"white\",\"blue\",\"white\",\"blue\",\"white\",\"white\",\"red\",\"red\",\"blue\",\"white\",\"white\",\"white\",\"blue\",\"red\",\"blue\",\"red\",\"white\",\"red\",\"red\",\"blue\",\"white\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"red\",\"red\",\"white\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"red\",\"white\",\"red\",\"white\",\"blue\",\"red\",\"white\",\"blue\",\"red\",\"white\",\"red\",\"white\",\"red\",\"white\",\"blue\",\"blue\",\"white\",\"white\",\"white\",\"red\",\"white\",\"red\",\"blue\",\"white\",\"white\",\"blue\",\"red\",\"white\",\"white\",\"blue\",\"red\",\"white\",\"white\",\"blue\",\"white\",\"red\",\"white\",\"white\",\"blue\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"blue\",\"white\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"white\",\"red\",\"white\",\"blue\",\"blue\",\"white\",\"white\",\"white\",\"red\",\"white\",\"red\",\"white\",\"blue\",\"white\",\"red\",\"blue\",\"red\",\"red\",\"blue\",\"blue\",\"white\",\"blue\",\"white\",\"white\",\"blue\",\"blue\",\"white\",\"red\",\"red\",\"white\",\"red\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"white\",\"red\",\"red\",\"red\",\"blue\",\"blue\",\"white\",\"white\",\"blue\",\"white\",\"red\",\"white\",\"white\",\"white\",\"white\",\"red\",\"red\",\"white\",\"blue\",\"white\",\"white\",\"blue\",\"red\",\"blue\",\"blue\",\"white\",\"blue\",\"red\",\"white\",\"red\",\"white\",\"red\",\"white\",\"white\",\"white\",\"red\",\"blue\",\"red\",\"white\",\"white\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"blue\",\"white\",\"white\",\"white\",\"blue\",\"red\",\"red\",\"red\",\"white\",\"white\",\"red\",\"red\",\"red\",\"white\",\"blue\",\"red\",\"blue\",\"red\",\"white\",\"white\",\"white\",\"blue\",\"blue\",\"blue\",\"red\",\"white\",\"blue\",\"blue\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"blue\",\"white\",\"red\",\"blue\",\"white\",\"blue\",\"white\",\"red\",\"white\",\"blue\",\"red\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"white\",\"white\",\"blue\",\"red\",\"red\",\"white\",\"red\",\"red\",\"white\",\"red\",\"white\",\"red\",\"white\",\"red\",\"white\",\"white\",\"red\",\"white\",\"red\",\"white\",\"red\",\"red\",\"white\",\"white\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"red\",\"white\",\"white\",\"red\",\"white\",\"red\",\"white\",\"red\",\"red\",\"blue\",\"white\",\"red\",\"white\",\"blue\",\"blue\",\"blue\",\"blue\",\"red\",\"red\",\"white\",\"red\",\"white\",\"red\",\"red\",\"white\",\"red\",\"blue\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"white\",\"white\",\"red\",\"white\",\"red\",\"white\",\"white\",\"blue\",\"red\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"red\",\"white\",\"white\",\"white\",\"blue\",\"white\",\"red\",\"red\",\"white\",\"white\",\"red\",\"white\",\"red\",\"red\",\"red\",\"white\",\"red\",\"blue\",\"white\",\"white\",\"blue\",\"white\",\"white\",\"blue\",\"red\",\"blue\",\"red\",\"red\",\"red\",\"red\",\"blue\",\"white\",\"blue\",\"blue\",\"white\",\"white\",\"white\",\"blue\",\"red\",\"red\",\"white\",\"red\",\"white\",\"blue\",\"white\",\"red\",\"red\",\"red\",\"white\",\"red\",\"blue\",\"white\",\"blue\",\"red\",\"red\",\"red\",\"white\",\"white\",\"blue\",\"white\",\"red\",\"white\",\"blue\",\"blue\",\"red\",\"blue\",\"red\",\"blue\",\"red\",\"red\",\"red\",\"white\",\"white\",\"white\",\"white\",\"blue\",\"white\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"white\",\"red\",\"blue\",\"red\",\"red\",\"white\",\"blue\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"blue\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"red\",\"blue\",\"red\",\"white\",\"blue\",\"white\",\"blue\",\"white\",\"blue\",\"white\",\"blue\",\"white\",\"white\",\"red\",\"blue\",\"white\",\"white\",\"blue\",\"white\",\"blue\",\"red\",\"red\",\"red\",\"blue\",\"white\",\"red\",\"blue\",\"blue\",\"red\",\"white\",\"white\",\"red\",\"white\",\"white\",\"red\",\"red\",\"red\",\"blue\",\"white\",\"red\",\"white\",\"red\",\"white\",\"red\",\"white\",\"white\",\"white\",\"red\",\"blue\",\"blue\",\"white\",\"white\",\"white\",\"red\",\"white\",\"blue\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"white\",\"red\",\"red\",\"white\",\"red\",\"white\",\"white\",\"blue\",\"white\",\"blue\",\"white\",\"blue\",\"white\",\"blue\",\"blue\",\"blue\",\"white\",\"blue\",\"blue\",\"blue\",\"white\",\"red\",\"white\",\"red\",\"blue\",\"blue\",\"red\"],\"xs\":[[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8]],\"ys\":[[0.0,0.8],[1.0,1.8],[2.8,2.0],[3.0,3.8],[4.8,4.0],[5.8,5.0],[6.8,6.0],[7.8,7.0],[8.8,8.0],[9.8,9.0],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.0,13.8],[14.0,14.8],[15.0,15.8],[16.0,16.8],[17.8,17.0],[18.0,18.8],[19.0,19.8],[20.0,20.8],[21.8,21.0],[22.8,22.0],[23.8,23.0],[24.0,24.8],[25.0,25.8],[26.8,26.0],[27.0,27.8],[28.0,28.8],[29.8,29.0],[0.8,0.0],[1.0,1.8],[2.8,2.0],[3.0,3.8],[4.8,4.0],[5.0,5.8],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.8,10.0],[11.8,11.0],[12.0,12.8],[13.8,13.0],[14.8,14.0],[15.0,15.8],[16.0,16.8],[17.0,17.8],[18.0,18.8],[19.8,19.0],[20.0,20.8],[21.8,21.0],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.8,26.0],[27.0,27.8],[28.8,28.0],[29.0,29.8],[0.8,0.0],[1.0,1.8],[2.8,2.0],[3.0,3.8],[4.8,4.0],[5.8,5.0],[6.8,6.0],[7.0,7.8],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.0,11.8],[12.8,12.0],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.0,16.8],[17.0,17.8],[18.8,18.0],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.0,24.8],[25.8,25.0],[26.8,26.0],[27.0,27.8],[28.8,28.0],[29.8,29.0],[0.0,0.8],[1.8,1.0],[2.8,2.0],[3.0,3.8],[4.8,4.0],[5.0,5.8],[6.8,6.0],[7.8,7.0],[8.8,8.0],[9.8,9.0],[10.0,10.8],[11.0,11.8],[12.8,12.0],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.8,16.0],[17.0,17.8],[18.8,18.0],[19.8,19.0],[20.0,20.8],[21.8,21.0],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.0,25.8],[26.0,26.8],[27.8,27.0],[28.0,28.8],[29.8,29.0],[0.8,0.0],[1.0,1.8],[2.8,2.0],[3.0,3.8],[4.0,4.8],[5.8,5.0],[6.8,6.0],[7.8,7.0],[8.8,8.0],[9.8,9.0],[10.8,10.0],[11.8,11.0],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.0,18.8],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.0,22.8],[23.0,23.8],[24.0,24.8],[25.0,25.8],[26.8,26.0],[27.0,27.8],[28.0,28.8],[29.8,29.0],[0.8,0.0],[1.8,1.0],[2.8,2.0],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.0,6.8],[7.0,7.8],[8.8,8.0],[9.0,9.8],[10.8,10.0],[11.0,11.8],[12.8,12.0],[13.0,13.8],[14.0,14.8],[15.8,15.0],[16.8,16.0],[17.8,17.0],[18.0,18.8],[19.0,19.8],[20.8,20.0],[21.8,21.0],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.0,25.8],[26.8,26.0],[27.8,27.0],[28.0,28.8],[29.8,29.0],[0.0,0.8],[1.0,1.8],[2.0,2.8],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.8,6.0],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.0,11.8],[12.8,12.0],[13.8,13.0],[14.0,14.8],[15.0,15.8],[16.8,16.0],[17.0,17.8],[18.8,18.0],[19.8,19.0],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.8,26.0],[27.0,27.8],[28.8,28.0],[29.8,29.0],[0.0,0.8],[1.0,1.8],[2.0,2.8],[3.8,3.0],[4.8,4.0],[5.0,5.8],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.8,10.0],[11.0,11.8],[12.0,12.8],[13.8,13.0],[14.0,14.8],[15.0,15.8],[16.0,16.8],[17.8,17.0],[18.8,18.0],[19.0,19.8],[20.8,20.0],[21.8,21.0],[22.0,22.8],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.0,26.8],[27.0,27.8],[28.0,28.8],[29.8,29.0],[0.8,0.0],[1.0,1.8],[2.0,2.8],[3.8,3.0],[4.0,4.8],[5.0,5.8],[6.8,6.0],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.0,12.8],[13.8,13.0],[14.0,14.8],[15.8,15.0],[16.8,16.0],[17.8,17.0],[18.0,18.8],[19.0,19.8],[20.0,20.8],[21.8,21.0],[22.8,22.0],[23.8,23.0],[24.0,24.8],[25.0,25.8],[26.8,26.0],[27.8,27.0],[28.8,28.0],[29.0,29.8],[0.0,0.8],[1.8,1.0],[2.0,2.8],[3.0,3.8],[4.8,4.0],[5.0,5.8],[6.0,6.8],[7.0,7.8],[8.0,8.8],[9.8,9.0],[10.8,10.0],[11.8,11.0],[12.0,12.8],[13.8,13.0],[14.0,14.8],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.8,18.0],[19.0,19.8],[20.8,20.0],[21.8,21.0],[22.0,22.8],[23.8,23.0],[24.8,24.0],[25.0,25.8],[26.8,26.0],[27.0,27.8],[28.0,28.8],[29.0,29.8],[0.0,0.8],[1.8,1.0],[2.8,2.0],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.8,6.0],[7.0,7.8],[8.0,8.8],[9.0,9.8],[10.8,10.0],[11.8,11.0],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.8,16.0],[17.8,17.0],[18.0,18.8],[19.8,19.0],[20.8,20.0],[21.8,21.0],[22.0,22.8],[23.8,23.0],[24.0,24.8],[25.0,25.8],[26.0,26.8],[27.8,27.0],[28.0,28.8],[29.0,29.8],[0.0,0.8],[1.8,1.0],[2.8,2.0],[3.0,3.8],[4.0,4.8],[5.0,5.8],[6.8,6.0],[7.8,7.0],[8.8,8.0],[9.8,9.0],[10.0,10.8],[11.0,11.8],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.8,16.0],[17.0,17.8],[18.8,18.0],[19.8,19.0],[20.8,20.0],[21.8,21.0],[22.0,22.8],[23.0,23.8],[24.8,24.0],[25.0,25.8],[26.0,26.8],[27.0,27.8],[28.8,28.0],[29.0,29.8],[0.0,0.8],[1.0,1.8],[2.0,2.8],[3.8,3.0],[4.0,4.8],[5.8,5.0],[6.8,6.0],[7.8,7.0],[8.8,8.0],[9.8,9.0],[10.0,10.8],[11.0,11.8],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.0,16.8],[17.0,17.8],[18.8,18.0],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.8,26.0],[27.0,27.8],[28.8,28.0],[29.0,29.8],[0.0,0.8],[1.8,1.0],[2.0,2.8],[3.0,3.8],[4.8,4.0],[5.0,5.8],[6.0,6.8],[7.0,7.8],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.0,16.8],[17.8,17.0],[18.0,18.8],[19.8,19.0],[20.0,20.8],[21.0,21.8],[22.0,22.8],[23.8,23.0],[24.0,24.8],[25.0,25.8],[26.0,26.8],[27.8,27.0],[28.0,28.8],[29.8,29.0],[0.8,0.0],[1.8,1.0],[2.8,2.0],[3.0,3.8],[4.8,4.0],[5.8,5.0],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.8,9.0],[10.0,10.8],[11.0,11.8],[12.8,12.0],[13.8,13.0],[14.0,14.8],[15.8,15.0],[16.8,16.0],[17.0,17.8],[18.8,18.0],[19.8,19.0],[20.0,20.8],[21.8,21.0],[22.8,22.0],[23.8,23.0],[24.8,24.0],[25.8,25.0],[26.0,26.8],[27.0,27.8],[28.0,28.8],[29.8,29.0],[0.0,0.8],[1.0,1.8],[2.0,2.8],[3.8,3.0],[4.8,4.0],[5.0,5.8],[6.0,6.8],[7.0,7.8],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.8,18.0],[19.0,19.8],[20.8,20.0],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.0,26.8],[27.8,27.0],[28.8,28.0],[29.0,29.8],[0.8,0.0],[1.0,1.8],[2.8,2.0],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.8,6.0],[7.0,7.8],[8.8,8.0],[9.0,9.8],[10.8,10.0],[11.0,11.8],[12.8,12.0],[13.8,13.0],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.8,18.0],[19.0,19.8],[20.8,20.0],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.0,25.8],[26.0,26.8],[27.8,27.0],[28.8,28.0],[29.0,29.8],[0.8,0.0],[1.0,1.8],[2.8,2.0],[3.0,3.8],[4.0,4.8],[5.0,5.8],[6.8,6.0],[7.0,7.8],[8.0,8.8],[9.8,9.0],[10.8,10.0],[11.0,11.8],[12.0,12.8],[13.8,13.0],[14.0,14.8],[15.8,15.0],[16.0,16.8],[17.0,17.8],[18.8,18.0],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.0,25.8],[26.8,26.0],[27.0,27.8],[28.8,28.0],[29.8,29.0],[0.8,0.0],[1.0,1.8],[2.0,2.8],[3.0,3.8],[4.0,4.8],[5.0,5.8],[6.0,6.8],[7.0,7.8],[8.8,8.0],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.0,13.8],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.8,18.0],[19.8,19.0],[20.8,20.0],[21.0,21.8],[22.8,22.0],[23.8,23.0],[24.8,24.0],[25.8,25.0],[26.0,26.8],[27.0,27.8],[28.0,28.8],[29.0,29.8],[0.0,0.8],[1.8,1.0],[2.0,2.8],[3.0,3.8],[4.0,4.8],[5.8,5.0],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.8,9.0],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.8,13.0],[14.0,14.8],[15.0,15.8],[16.0,16.8],[17.0,17.8],[18.0,18.8],[19.0,19.8],[20.8,20.0],[21.0,21.8],[22.0,22.8],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.8,26.0],[27.8,27.0],[28.0,28.8],[29.8,29.0],[0.0,0.8],[1.8,1.0],[2.0,2.8],[3.0,3.8],[4.0,4.8],[5.0,5.8],[6.8,6.0],[7.0,7.8],[8.8,8.0],[9.8,9.0],[10.8,10.0],[11.0,11.8],[12.8,12.0],[13.0,13.8],[14.0,14.8],[15.8,15.0],[16.8,16.0],[17.0,17.8],[18.8,18.0],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.8,26.0],[27.8,27.0],[28.8,28.0],[29.8,29.0],[0.8,0.0],[1.8,1.0],[2.8,2.0],[3.0,3.8],[4.0,4.8],[5.8,5.0],[6.8,6.0],[7.0,7.8],[8.8,8.0],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.8,13.0],[14.8,14.0],[15.0,15.8],[16.0,16.8],[17.8,17.0],[18.0,18.8],[19.0,19.8],[20.8,20.0],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.0,24.8],[25.0,25.8],[26.8,26.0],[27.0,27.8],[28.0,28.8],[29.0,29.8],[0.8,0.0],[1.8,1.0],[2.8,2.0],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.0,6.8],[7.8,7.0],[8.8,8.0],[9.8,9.0],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.8,13.0],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.0,18.8],[19.8,19.0],[20.0,20.8],[21.8,21.0],[22.0,22.8],[23.8,23.0],[24.8,24.0],[25.0,25.8],[26.0,26.8],[27.8,27.0],[28.8,28.0],[29.0,29.8],[0.8,0.0],[1.8,1.0],[2.0,2.8],[3.8,3.0],[4.0,4.8],[5.8,5.0],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.8,9.0],[10.0,10.8],[11.8,11.0],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.0,18.8],[19.8,19.0],[20.8,20.0],[21.0,21.8],[22.8,22.0],[23.8,23.0],[24.0,24.8],[25.0,25.8],[26.0,26.8],[27.0,27.8],[28.0,28.8],[29.8,29.0],[0.0,0.8],[1.8,1.0],[2.8,2.0],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.0,11.8],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.0,16.8],[17.8,17.0],[18.8,18.0],[19.0,19.8],[20.0,20.8],[21.8,21.0],[22.8,22.0],[23.8,23.0],[24.8,24.0],[25.0,25.8],[26.8,26.0],[27.0,27.8],[28.0,28.8],[29.0,29.8],[0.0,0.8],[1.8,1.0],[2.8,2.0],[3.0,3.8],[4.0,4.8],[5.8,5.0],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.0,12.8],[13.0,13.8],[14.0,14.8],[15.0,15.8],[16.0,16.8],[17.8,17.0],[18.0,18.8],[19.8,19.0],[20.8,20.0],[21.0,21.8],[22.0,22.8],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.8,26.0],[27.0,27.8],[28.8,28.0],[29.0,29.8],[0.0,0.8],[1.0,1.8],[2.8,2.0],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.0,6.8],[7.0,7.8],[8.8,8.0],[9.8,9.0],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.0,16.8],[17.8,17.0],[18.0,18.8],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.0,22.8],[23.8,23.0],[24.0,24.8],[25.8,25.0],[26.0,26.8],[27.0,27.8],[28.0,28.8],[29.8,29.0],[0.8,0.0],[1.8,1.0],[2.8,2.0],[3.0,3.8],[4.8,4.0],[5.0,5.8],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.0,13.8],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.0,17.8],[18.8,18.0],[19.8,19.0],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.0,26.8],[27.8,27.0],[28.8,28.0],[29.8,29.0],[0.8,0.0],[1.0,1.8],[2.0,2.8],[3.8,3.0],[4.8,4.0],[5.0,5.8],[6.8,6.0],[7.8,7.0],[8.8,8.0],[9.0,9.8],[10.0,10.8],[11.0,11.8],[12.8,12.0],[13.8,13.0],[14.0,14.8],[15.0,15.8],[16.8,16.0],[17.0,17.8],[18.0,18.8],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.8,23.0],[24.0,24.8],[25.8,25.0],[26.0,26.8],[27.8,27.0],[28.0,28.8],[29.0,29.8],[0.8,0.0],[1.8,1.0],[2.0,2.8],[3.8,3.0],[4.0,4.8],[5.0,5.8],[6.8,6.0],[7.0,7.8],[8.8,8.0],[9.8,9.0],[10.8,10.0],[11.8,11.0],[12.8,12.0],[13.8,13.0],[14.8,14.0],[15.8,15.0],[16.0,16.8],[17.0,17.8],[18.0,18.8],[19.8,19.0],[20.8,20.0],[21.0,21.8],[22.0,22.8],[23.8,23.0],[24.8,24.0],[25.0,25.8],[26.0,26.8],[27.8,27.0],[28.0,28.8],[29.0,29.8]]}},\"id\":\"2dfcf6e9-51b7-4783-bd7d-d81aeef4cfc4\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":{\"id\":\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"8852bcda-1db6-48e0-9a47-c4033a02462c\",\"type\":\"PanTool\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"xs\",\"ys\"],\"data\":{\"xs\":[[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[0,0.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[1,1.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[2,2.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[3,3.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[4,4.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[5,5.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[6,6.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[7,7.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[8,8.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[9,9.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[10,10.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[11,11.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[12,12.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[13,13.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[14,14.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[15,15.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[16,16.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[17,17.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[18,18.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[19,19.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[20,20.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[21,21.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[22,22.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[23,23.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[24,24.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[25,25.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[26,26.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[27,27.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[28,28.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8],[29,29.8]],\"ys\":[[0.0,0.8],[1.0,1.8],[2.8,2.0],[3.0,3.8],[4.8,4.0],[5.8,5.0],[6.8,6.0],[7.8,7.0],[8.8,8.0],[9.8,9.0],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.0,13.8],[14.0,14.8],[15.0,15.8],[16.0,16.8],[17.8,17.0],[18.0,18.8],[19.0,19.8],[20.0,20.8],[21.8,21.0],[22.8,22.0],[23.8,23.0],[24.0,24.8],[25.0,25.8],[26.8,26.0],[27.0,27.8],[28.0,28.8],[29.8,29.0],[0.8,0.0],[1.0,1.8],[2.8,2.0],[3.0,3.8],[4.8,4.0],[5.0,5.8],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.8,10.0],[11.8,11.0],[12.0,12.8],[13.8,13.0],[14.8,14.0],[15.0,15.8],[16.0,16.8],[17.0,17.8],[18.0,18.8],[19.8,19.0],[20.0,20.8],[21.8,21.0],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.8,26.0],[27.0,27.8],[28.8,28.0],[29.0,29.8],[0.8,0.0],[1.0,1.8],[2.8,2.0],[3.0,3.8],[4.8,4.0],[5.8,5.0],[6.8,6.0],[7.0,7.8],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.0,11.8],[12.8,12.0],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.0,16.8],[17.0,17.8],[18.8,18.0],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.0,24.8],[25.8,25.0],[26.8,26.0],[27.0,27.8],[28.8,28.0],[29.8,29.0],[0.0,0.8],[1.8,1.0],[2.8,2.0],[3.0,3.8],[4.8,4.0],[5.0,5.8],[6.8,6.0],[7.8,7.0],[8.8,8.0],[9.8,9.0],[10.0,10.8],[11.0,11.8],[12.8,12.0],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.8,16.0],[17.0,17.8],[18.8,18.0],[19.8,19.0],[20.0,20.8],[21.8,21.0],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.0,25.8],[26.0,26.8],[27.8,27.0],[28.0,28.8],[29.8,29.0],[0.8,0.0],[1.0,1.8],[2.8,2.0],[3.0,3.8],[4.0,4.8],[5.8,5.0],[6.8,6.0],[7.8,7.0],[8.8,8.0],[9.8,9.0],[10.8,10.0],[11.8,11.0],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.0,18.8],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.0,22.8],[23.0,23.8],[24.0,24.8],[25.0,25.8],[26.8,26.0],[27.0,27.8],[28.0,28.8],[29.8,29.0],[0.8,0.0],[1.8,1.0],[2.8,2.0],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.0,6.8],[7.0,7.8],[8.8,8.0],[9.0,9.8],[10.8,10.0],[11.0,11.8],[12.8,12.0],[13.0,13.8],[14.0,14.8],[15.8,15.0],[16.8,16.0],[17.8,17.0],[18.0,18.8],[19.0,19.8],[20.8,20.0],[21.8,21.0],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.0,25.8],[26.8,26.0],[27.8,27.0],[28.0,28.8],[29.8,29.0],[0.0,0.8],[1.0,1.8],[2.0,2.8],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.8,6.0],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.0,11.8],[12.8,12.0],[13.8,13.0],[14.0,14.8],[15.0,15.8],[16.8,16.0],[17.0,17.8],[18.8,18.0],[19.8,19.0],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.8,26.0],[27.0,27.8],[28.8,28.0],[29.8,29.0],[0.0,0.8],[1.0,1.8],[2.0,2.8],[3.8,3.0],[4.8,4.0],[5.0,5.8],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.8,10.0],[11.0,11.8],[12.0,12.8],[13.8,13.0],[14.0,14.8],[15.0,15.8],[16.0,16.8],[17.8,17.0],[18.8,18.0],[19.0,19.8],[20.8,20.0],[21.8,21.0],[22.0,22.8],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.0,26.8],[27.0,27.8],[28.0,28.8],[29.8,29.0],[0.8,0.0],[1.0,1.8],[2.0,2.8],[3.8,3.0],[4.0,4.8],[5.0,5.8],[6.8,6.0],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.0,12.8],[13.8,13.0],[14.0,14.8],[15.8,15.0],[16.8,16.0],[17.8,17.0],[18.0,18.8],[19.0,19.8],[20.0,20.8],[21.8,21.0],[22.8,22.0],[23.8,23.0],[24.0,24.8],[25.0,25.8],[26.8,26.0],[27.8,27.0],[28.8,28.0],[29.0,29.8],[0.0,0.8],[1.8,1.0],[2.0,2.8],[3.0,3.8],[4.8,4.0],[5.0,5.8],[6.0,6.8],[7.0,7.8],[8.0,8.8],[9.8,9.0],[10.8,10.0],[11.8,11.0],[12.0,12.8],[13.8,13.0],[14.0,14.8],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.8,18.0],[19.0,19.8],[20.8,20.0],[21.8,21.0],[22.0,22.8],[23.8,23.0],[24.8,24.0],[25.0,25.8],[26.8,26.0],[27.0,27.8],[28.0,28.8],[29.0,29.8],[0.0,0.8],[1.8,1.0],[2.8,2.0],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.8,6.0],[7.0,7.8],[8.0,8.8],[9.0,9.8],[10.8,10.0],[11.8,11.0],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.8,16.0],[17.8,17.0],[18.0,18.8],[19.8,19.0],[20.8,20.0],[21.8,21.0],[22.0,22.8],[23.8,23.0],[24.0,24.8],[25.0,25.8],[26.0,26.8],[27.8,27.0],[28.0,28.8],[29.0,29.8],[0.0,0.8],[1.8,1.0],[2.8,2.0],[3.0,3.8],[4.0,4.8],[5.0,5.8],[6.8,6.0],[7.8,7.0],[8.8,8.0],[9.8,9.0],[10.0,10.8],[11.0,11.8],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.8,16.0],[17.0,17.8],[18.8,18.0],[19.8,19.0],[20.8,20.0],[21.8,21.0],[22.0,22.8],[23.0,23.8],[24.8,24.0],[25.0,25.8],[26.0,26.8],[27.0,27.8],[28.8,28.0],[29.0,29.8],[0.0,0.8],[1.0,1.8],[2.0,2.8],[3.8,3.0],[4.0,4.8],[5.8,5.0],[6.8,6.0],[7.8,7.0],[8.8,8.0],[9.8,9.0],[10.0,10.8],[11.0,11.8],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.0,16.8],[17.0,17.8],[18.8,18.0],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.8,26.0],[27.0,27.8],[28.8,28.0],[29.0,29.8],[0.0,0.8],[1.8,1.0],[2.0,2.8],[3.0,3.8],[4.8,4.0],[5.0,5.8],[6.0,6.8],[7.0,7.8],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.0,16.8],[17.8,17.0],[18.0,18.8],[19.8,19.0],[20.0,20.8],[21.0,21.8],[22.0,22.8],[23.8,23.0],[24.0,24.8],[25.0,25.8],[26.0,26.8],[27.8,27.0],[28.0,28.8],[29.8,29.0],[0.8,0.0],[1.8,1.0],[2.8,2.0],[3.0,3.8],[4.8,4.0],[5.8,5.0],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.8,9.0],[10.0,10.8],[11.0,11.8],[12.8,12.0],[13.8,13.0],[14.0,14.8],[15.8,15.0],[16.8,16.0],[17.0,17.8],[18.8,18.0],[19.8,19.0],[20.0,20.8],[21.8,21.0],[22.8,22.0],[23.8,23.0],[24.8,24.0],[25.8,25.0],[26.0,26.8],[27.0,27.8],[28.0,28.8],[29.8,29.0],[0.0,0.8],[1.0,1.8],[2.0,2.8],[3.8,3.0],[4.8,4.0],[5.0,5.8],[6.0,6.8],[7.0,7.8],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.8,18.0],[19.0,19.8],[20.8,20.0],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.0,26.8],[27.8,27.0],[28.8,28.0],[29.0,29.8],[0.8,0.0],[1.0,1.8],[2.8,2.0],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.8,6.0],[7.0,7.8],[8.8,8.0],[9.0,9.8],[10.8,10.0],[11.0,11.8],[12.8,12.0],[13.8,13.0],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.8,18.0],[19.0,19.8],[20.8,20.0],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.0,25.8],[26.0,26.8],[27.8,27.0],[28.8,28.0],[29.0,29.8],[0.8,0.0],[1.0,1.8],[2.8,2.0],[3.0,3.8],[4.0,4.8],[5.0,5.8],[6.8,6.0],[7.0,7.8],[8.0,8.8],[9.8,9.0],[10.8,10.0],[11.0,11.8],[12.0,12.8],[13.8,13.0],[14.0,14.8],[15.8,15.0],[16.0,16.8],[17.0,17.8],[18.8,18.0],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.0,25.8],[26.8,26.0],[27.0,27.8],[28.8,28.0],[29.8,29.0],[0.8,0.0],[1.0,1.8],[2.0,2.8],[3.0,3.8],[4.0,4.8],[5.0,5.8],[6.0,6.8],[7.0,7.8],[8.8,8.0],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.0,13.8],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.8,18.0],[19.8,19.0],[20.8,20.0],[21.0,21.8],[22.8,22.0],[23.8,23.0],[24.8,24.0],[25.8,25.0],[26.0,26.8],[27.0,27.8],[28.0,28.8],[29.0,29.8],[0.0,0.8],[1.8,1.0],[2.0,2.8],[3.0,3.8],[4.0,4.8],[5.8,5.0],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.8,9.0],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.8,13.0],[14.0,14.8],[15.0,15.8],[16.0,16.8],[17.0,17.8],[18.0,18.8],[19.0,19.8],[20.8,20.0],[21.0,21.8],[22.0,22.8],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.8,26.0],[27.8,27.0],[28.0,28.8],[29.8,29.0],[0.0,0.8],[1.8,1.0],[2.0,2.8],[3.0,3.8],[4.0,4.8],[5.0,5.8],[6.8,6.0],[7.0,7.8],[8.8,8.0],[9.8,9.0],[10.8,10.0],[11.0,11.8],[12.8,12.0],[13.0,13.8],[14.0,14.8],[15.8,15.0],[16.8,16.0],[17.0,17.8],[18.8,18.0],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.8,26.0],[27.8,27.0],[28.8,28.0],[29.8,29.0],[0.8,0.0],[1.8,1.0],[2.8,2.0],[3.0,3.8],[4.0,4.8],[5.8,5.0],[6.8,6.0],[7.0,7.8],[8.8,8.0],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.8,13.0],[14.8,14.0],[15.0,15.8],[16.0,16.8],[17.8,17.0],[18.0,18.8],[19.0,19.8],[20.8,20.0],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.0,24.8],[25.0,25.8],[26.8,26.0],[27.0,27.8],[28.0,28.8],[29.0,29.8],[0.8,0.0],[1.8,1.0],[2.8,2.0],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.0,6.8],[7.8,7.0],[8.8,8.0],[9.8,9.0],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.8,13.0],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.0,18.8],[19.8,19.0],[20.0,20.8],[21.8,21.0],[22.0,22.8],[23.8,23.0],[24.8,24.0],[25.0,25.8],[26.0,26.8],[27.8,27.0],[28.8,28.0],[29.0,29.8],[0.8,0.0],[1.8,1.0],[2.0,2.8],[3.8,3.0],[4.0,4.8],[5.8,5.0],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.8,9.0],[10.0,10.8],[11.8,11.0],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.8,17.0],[18.0,18.8],[19.8,19.0],[20.8,20.0],[21.0,21.8],[22.8,22.0],[23.8,23.0],[24.0,24.8],[25.0,25.8],[26.0,26.8],[27.0,27.8],[28.0,28.8],[29.8,29.0],[0.0,0.8],[1.8,1.0],[2.8,2.0],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.0,11.8],[12.0,12.8],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.0,16.8],[17.8,17.0],[18.8,18.0],[19.0,19.8],[20.0,20.8],[21.8,21.0],[22.8,22.0],[23.8,23.0],[24.8,24.0],[25.0,25.8],[26.8,26.0],[27.0,27.8],[28.0,28.8],[29.0,29.8],[0.0,0.8],[1.8,1.0],[2.8,2.0],[3.0,3.8],[4.0,4.8],[5.8,5.0],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.0,12.8],[13.0,13.8],[14.0,14.8],[15.0,15.8],[16.0,16.8],[17.8,17.0],[18.0,18.8],[19.8,19.0],[20.8,20.0],[21.0,21.8],[22.0,22.8],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.8,26.0],[27.0,27.8],[28.8,28.0],[29.0,29.8],[0.0,0.8],[1.0,1.8],[2.8,2.0],[3.8,3.0],[4.8,4.0],[5.8,5.0],[6.0,6.8],[7.0,7.8],[8.8,8.0],[9.8,9.0],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.0,13.8],[14.8,14.0],[15.8,15.0],[16.0,16.8],[17.8,17.0],[18.0,18.8],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.0,22.8],[23.8,23.0],[24.0,24.8],[25.8,25.0],[26.0,26.8],[27.0,27.8],[28.0,28.8],[29.8,29.0],[0.8,0.0],[1.8,1.0],[2.8,2.0],[3.0,3.8],[4.8,4.0],[5.0,5.8],[6.0,6.8],[7.8,7.0],[8.0,8.8],[9.0,9.8],[10.0,10.8],[11.8,11.0],[12.8,12.0],[13.0,13.8],[14.8,14.0],[15.0,15.8],[16.8,16.0],[17.0,17.8],[18.8,18.0],[19.8,19.0],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.0,23.8],[24.8,24.0],[25.8,25.0],[26.0,26.8],[27.8,27.0],[28.8,28.0],[29.8,29.0],[0.8,0.0],[1.0,1.8],[2.0,2.8],[3.8,3.0],[4.8,4.0],[5.0,5.8],[6.8,6.0],[7.8,7.0],[8.8,8.0],[9.0,9.8],[10.0,10.8],[11.0,11.8],[12.8,12.0],[13.8,13.0],[14.0,14.8],[15.0,15.8],[16.8,16.0],[17.0,17.8],[18.0,18.8],[19.0,19.8],[20.0,20.8],[21.0,21.8],[22.8,22.0],[23.8,23.0],[24.0,24.8],[25.8,25.0],[26.0,26.8],[27.8,27.0],[28.0,28.8],[29.0,29.8],[0.8,0.0],[1.8,1.0],[2.0,2.8],[3.8,3.0],[4.0,4.8],[5.0,5.8],[6.8,6.0],[7.0,7.8],[8.8,8.0],[9.8,9.0],[10.8,10.0],[11.8,11.0],[12.8,12.0],[13.8,13.0],[14.8,14.0],[15.8,15.0],[16.0,16.8],[17.0,17.8],[18.0,18.8],[19.8,19.0],[20.8,20.0],[21.0,21.8],[22.0,22.8],[23.8,23.0],[24.8,24.0],[25.0,25.8],[26.0,26.8],[27.8,27.0],[28.0,28.8],[29.0,29.8]]}},\"id\":\"a7a32c9c-0ba1-40c4-9059-f7281cab824b\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_alpha\":{\"value\":0.1},\"line_cap\":\"round\",\"line_color\":{\"value\":\"#1f77b4\"},\"line_width\":{\"value\":6},\"xs\":{\"field\":\"xs\"},\"ys\":{\"field\":\"ys\"}},\"id\":\"23bfb5a9-20d8-40ae-9a52-0b5dfab56286\",\"type\":\"MultiLine\"},{\"attributes\":{\"plot\":{\"id\":\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"be8326ce-270b-496d-994f-815571056489\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"74327897-96e3-4ac1-8343-a84bee2b9491\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"025da67a-3cb3-489c-9821-f010252083a5\",\"type\":\"BasicTickFormatter\"}],\"root_ids\":[\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.4\"}};\n",
" var render_items = [{\"docid\":\"c6842469-cb8c-4816-94d1-682f8014d0f5\",\"elementid\":\"e04fb131-664e-4433-a26c-417ad0759bed\",\"modelid\":\"cbad5eb3-38a8-4738-a25d-cafd052b7bf2\"}];\n",
" \n",
" Bokeh.embed.embed_items(docs_json, render_items);\n",
" };\n",
" if (document.readyState != \"loading\") fn();\n",
" else document.addEventListener(\"DOMContentLoaded\", fn);\n",
" })();\n",
" },\n",
" function(Bokeh) {\n",
" }\n",
" ];\n",
" \n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === true)) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === true) {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (force !== true) {\n",
" var cell = $(document.getElementById(\"e04fb131-664e-4433-a26c-417ad0759bed\")).parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
" \n",
" }\n",
" \n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
" }(this));\n",
"</script>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plot = figure(plot_width=800, plot_height=800)\n",
"\n",
"plot.grid.visible = False\n",
"plot.xaxis.visible = False\n",
"plot.yaxis.visible = False\n",
"\n",
"plot.multi_line(xs, ys, color=cs, line_width=6, line_alpha=.1, line_cap='round')\n",
"plot.multi_line(xs, ys, color='black')\n",
"\n",
"show(plot)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 01 - hanoi tower.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def hanoi(height, left='left', right='right', middle='middle'):\n",
" if height:\n",
" hanoi(height - 1, left, middle, right)\n",
" print(left, '=>', right)\n",
" hanoi(height - 1, middle, right, left)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"left => right\n"
]
}
],
"source": [
"hanoi(1)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"left => middle\n",
"left => right\n",
"middle => right\n"
]
}
],
"source": [
"hanoi(2)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"left => right\n",
"left => middle\n",
"right => middle\n",
"left => right\n",
"middle => left\n",
"middle => right\n",
"left => right\n"
]
}
],
"source": [
"hanoi(3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 02 - matrix chain multiplication.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def mult(chain):\n",
" n = len(chain)\n",
" \n",
" # single matrix chain has zero cost\n",
" aux = {(i, i): (0,) + chain[i] for i in range(n)}\n",
"\n",
" # i: length of subchain\n",
" for i in range(1, n):\n",
" # j: starting index of subchain\n",
" for j in range(0, n - i):\n",
" best = float('inf')\n",
"\n",
" # k: splitting point of subchain\n",
" for k in range(j, j + i):\n",
" # multiply subchains at splitting point\n",
" lcost, lname, lrow, lcol = aux[j, k]\n",
" rcost, rname, rrow, rcol = aux[k + 1, j + i]\n",
" cost = lcost + rcost + lrow * lcol * rcol\n",
" var = '(%s%s)' % (lname, rname)\n",
"\n",
" # pick the best one\n",
" if cost < best:\n",
" best = cost\n",
" aux[j, j + i] = cost, var, lrow, rcol\n",
"\n",
" return dict(zip(['cost', 'order', 'rows', 'cols'], aux[0, n - 1]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"{'cols': 40, 'cost': 18000, 'order': '((AB)C)', 'rows': 10}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mult([('A', 10, 20), ('B', 20, 30), ('C', 30, 40)])"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"{'cols': 1, 'cost': 110, 'order': '(A(B(C(DE))))', 'rows': 10}"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mult([('A', 10, 5), ('B', 5, 1), ('C', 1, 5), ('D', 5, 10), ('E', 10, 1)])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 03 - next permutation.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def permute(values):\n",
" n = len(values)\n",
" \n",
" # i: position of pivot\n",
" for i in reversed(range(n - 1)):\n",
" if values[i] < values[i + 1]:\n",
" break\n",
" else:\n",
" # very last permutation\n",
" values[:] = reversed(values[:])\n",
" return values\n",
" \n",
" # j: position of the next candidate\n",
" for j in reversed(range(i, n)):\n",
" if values[i] < values[j]:\n",
" # swap pivot and reverse the tail\n",
" values[i], values[j] = values[j], values[i]\n",
" values[i + 1:] = reversed(values[i + 1:])\n",
" break\n",
" \n",
" return values"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 2, 3, 4]\n",
"[1, 2, 4, 3]\n",
"[1, 3, 2, 4]\n",
"[1, 3, 4, 2]\n",
"[1, 4, 2, 3]\n",
"[1, 4, 3, 2]\n",
"[2, 1, 3, 4]\n",
"[2, 1, 4, 3]\n",
"[2, 3, 1, 4]\n",
"[2, 3, 4, 1]\n",
"[2, 4, 1, 3]\n",
"[2, 4, 3, 1]\n",
"[3, 1, 2, 4]\n",
"[3, 1, 4, 2]\n",
"[3, 2, 1, 4]\n",
"[3, 2, 4, 1]\n",
"[3, 4, 1, 2]\n",
"[3, 4, 2, 1]\n",
"[4, 1, 2, 3]\n",
"[4, 1, 3, 2]\n",
"[4, 2, 1, 3]\n",
"[4, 2, 3, 1]\n",
"[4, 3, 1, 2]\n",
"[4, 3, 2, 1]\n",
"[1, 2, 3, 4]\n"
]
}
],
"source": [
"x = [4, 3, 2, 1]\n",
"for i in range(25):\n",
" print(permute(x))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"['F', 'A', 'E', 'D']"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"permute(list('FADE'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 04 - counting 1-bits.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def count_of_1bits(value):\n",
" n = 0\n",
" while value:\n",
" value &= value - 1\n",
" n += 1\n",
" return n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"count_of_1bits(0)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"count_of_1bits(1)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"4"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"count_of_1bits(0b11001100)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 05 - eratosthenes sieve.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def eratosthenes(n):\n",
" n = (n + 1) >> 1\n",
" p = np.ones(n, dtype=np.int8)\n",
" i, j = 1, 3\n",
" \n",
" while i < n:\n",
" if p[i]:\n",
" p[j * j >> 1::j] = 0\n",
" i, j = i + 1, j + 2\n",
"\n",
" return p.sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10 4\n",
"100 25\n",
"1000 168\n",
"10000 1229\n",
"100000 9592\n",
"1000000 78498\n",
"10000000 664579\n"
]
}
],
"source": [
"for j in range(1, 8):\n",
" print(10 ** j, eratosthenes(10 ** j))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 06 - postfix notation.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"ops = {\n",
" '+': float.__add__,\n",
" '-': float.__sub__,\n",
" '*': float.__mul__,\n",
" '/': float.__truediv__,\n",
" '^': float.__pow__,\n",
"}\n",
"\n",
"def postfix(expression):\n",
" stack = []\n",
" \n",
" for x in expression.split():\n",
" if x in ops:\n",
" x = ops[x](stack.pop(-2), stack.pop(-1))\n",
" else:\n",
" x = float(x)\n",
" stack.append(x)\n",
" \n",
" return stack.pop()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"8.0"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"postfix('1 2 + 4 3 - + 10 5 / *')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"25.0"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"postfix('1 2 * 6 2 / + 9 7 - ^')"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"15.0"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"postfix('1 2 3 4 5 + + + +')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 07 - binary addition FSA.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from itertools import zip_longest"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# states\n",
"p0c0 = 0, {}\n",
"p1c0 = 1, {}\n",
"p0c1 = 0, {}\n",
"p1c1 = 1, {}\n",
"\n",
"# transitions between states\n",
"p0c0[1].update({(0, 0): p0c0, (1, 0): p1c0, (0, 1): p1c0, (1, 1): p0c1})\n",
"p1c0[1].update({(0, 0): p0c0, (1, 0): p1c0, (0, 1): p1c0, (1, 1): p0c1})\n",
"p0c1[1].update({(0, 0): p1c0, (1, 0): p0c1, (0, 1): p0c1, (1, 1): p1c1})\n",
"p1c1[1].update({(0, 0): p1c0, (1, 0): p0c1, (0, 1): p0c1, (1, 1): p1c1})\n",
"\n",
"def add(x, y):\n",
" x = map(int, reversed(x))\n",
" y = map(int, reversed(y))\n",
" z = []\n",
"\n",
" # simulate automaton\n",
" value, transition = p0c0\n",
" for r, s in zip_longest(x, y, fillvalue=0):\n",
" value, transition = transition[r, s]\n",
" z.append(value)\n",
"\n",
" # handle carry\n",
" z.append(transition[0, 0][0])\n",
" \n",
" return ''.join(map(str, reversed(z)))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"'10001000111100'"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"add('1100100100100', '100100011000')"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"'0b10001000111100'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bin(0b1100100100100 + 0b100100011000)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 08 - binary search.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def search(data, item):\n",
" left, right = 0, len(data) - 1\n",
" \n",
" while left <= right:\n",
" middle = (left + right) // 2\n",
" \n",
" if item < data[middle]:\n",
" right = middle - 1\n",
" elif item > data[middle]:\n",
" left = middle + 1\n",
" else:\n",
" return middle\n",
" \n",
" return -1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"data = [2, 3, 4, 8, 22, 23, 24, 25, 26, 28, 31, 39, 40, 43, 45, 49, 54, 58, 59, 60, 72, 73, 76, 87, 95, 97, 98]\n",
"data = sorted(data)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"search(data, 4)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"-1"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"search(data, 74)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"-1"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"search(data, 0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 09 - monte carlo - pi.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def pi(n, batch=1000):\n",
" t = 0\n",
" for i in range(n // batch):\n",
" p = np.random.rand(batch, 2)\n",
" p = (p * p).sum(axis=1)\n",
" t += (p <= 1).sum()\n",
" return 4 * t / n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"3.1400000000000001"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pi(10 ** 3)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"3.1418360000000001"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pi(10 ** 6)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"3.14145728"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pi(10 ** 8)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 10 - karatsuba multiplication.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np\n",
"from itertools import zip_longest"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def add(x, y):\n",
" z, carry = [], 0\n",
"\n",
" for r, s in zip_longest(x, y, fillvalue=0):\n",
" t = r + s + carry\n",
" carry = t // 10\n",
" z.append(t % 10)\n",
" if carry:\n",
" z.append(carry)\n",
"\n",
" return z"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def sub(x, y):\n",
" z, carry = [], 0\n",
"\n",
" for r, s in zip_longest(x, y, fillvalue=0):\n",
" t = r - s + carry\n",
" carry = t // 10\n",
" z.append(t % 10)\n",
"\n",
" return z"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def karatsuba(x, y):\n",
" # ensure same length\n",
" while len(x) < len(y):\n",
" x.append(0)\n",
" while len(x) > len(y):\n",
" y.append(0)\n",
"\n",
" # length and split\n",
" n = len(x)\n",
" n_2 = (n + 1) >> 1\n",
"\n",
" # trivial case\n",
" if n == 1:\n",
" return add([x[0] * y[0]], [])\n",
"\n",
" # split\n",
" x0, x1 = x[:n_2], x[n_2:]\n",
" y0, y1 = y[:n_2], y[n_2:]\n",
"\n",
" # karatsuba algorithm\n",
" z0 = karatsuba(x0, y0)\n",
" z1 = karatsuba(x1, y1)\n",
" z2 = karatsuba(add(x0, x1), add(y0, y1))\n",
" z2 = sub(sub(z2, z0), z1)\n",
"\n",
" z = add(z0, [0] * (n_2 << 1) + z1)\n",
" z = add(z, [0] * n_2 + z2)\n",
"\n",
" return z"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def mult(x, y):\n",
" print(x, '*', y, '=', int(x) * int(y), end=' = ')\n",
"\n",
" x = list(map(int, reversed(x)))\n",
" y = list(map(int, reversed(y)))\n",
" z = karatsuba(x, y)\n",
"\n",
" print(''.join(map(str, reversed(z))))"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1234 * 4321 = 5332114 = 5332114\n"
]
}
],
"source": [
"mult('1234', '4321')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"5678 * 8765 = 49767670 = 49767670\n"
]
}
],
"source": [
"mult('5678', '8765')"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"9999 * 9999 = 99980001 = 99980001\n"
]
}
],
"source": [
"mult('9999', '9999')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"60504 * 36056 = 2181532224 = 2181532224\n",
"7644 * 2034 = 15547896 = 15547896\n",
"2 * 1 = 2 = 2\n",
"939 * 700 = 657300 = 657300\n",
"977707258 * 389036934 = 380364234001866972 = 380364234001866972\n",
"1079459668 * 7762768164 = 8379595145072409552 = 08379595145072409552\n",
"4609807 * 2350979 = 10837559451053 = 10837559451053\n",
"36740 * 97490 = 3581782600 = 3581782600\n",
"29 * 19 = 551 = 0551\n",
"913789 * 733694 = 670441506566 = 670441506566\n",
"476646777 * 451303071 = 215112154242352167 = 215112154242352167\n",
"23369 * 43069 = 1006479461 = 1006479461\n",
"9185982 * 3983922 = 36596235781404 = 036596235781404\n",
"7806584211 * 8415537629 = 65696603181627775719 = 65696603181627775719\n",
"317 * 106 = 33602 = 33602\n",
"507729648 * 898501571 = 456195886371277008 = 456195886371277008\n",
"780843 * 778950 = 608237654850 = 608237654850\n",
"61 * 79 = 4819 = 4819\n",
"310094 * 443993 = 137679565342 = 137679565342\n",
"1564 * 7634 = 11939576 = 11939576\n",
"746602083 * 909270015 = 678862887208441245 = 678862887208441245\n",
"2 * 6 = 12 = 12\n",
"1798067708 * 3523547357 = 6335576720230447756 = 06335576720230447756\n",
"7 * 0 = 0 = 0\n",
"6290 * 0797 = 5013130 = 5013130\n",
"9958199 * 6994130 = 69648938371870 = 069648938371870\n",
"1661 * 0701 = 1164361 = 1164361\n",
"022046 * 410144 = 9042034624 = 09042034624\n",
"8505673479 * 1870256036 = 15907787164344869244 = 15907787164344869244\n",
"5 * 2 = 10 = 10\n"
]
}
],
"source": [
"for _ in range(30):\n",
" n = np.random.randint(1, 11)\n",
" x = ''.join(map(str, np.random.randint(0, 10, n)))\n",
" y = ''.join(map(str, np.random.randint(0, 10, n)))\n",
" mult(x, y)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 11 - McCarthy 91.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def mccarthy91(n):\n",
" k = 1\n",
" while k:\n",
" if n > 100:\n",
" n -= 10\n",
" k -= 1\n",
" else:\n",
" n += 11\n",
" k += 1\n",
" return n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"don't forget to increase stack limit for recursive version"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def mccarthy91_rec(n):\n",
" if n > 100:\n",
" return n - 10\n",
" else:\n",
" return mccarthy91_rec(mccarthy91_rec(n + 11))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"70 91\n",
"71 91\n",
"80 91\n",
"81 91\n",
"90 91\n",
"91 91\n",
"100 91\n",
"101 91\n",
"110 100\n",
"111 101\n",
"120 110\n",
"121 111\n"
]
}
],
"source": [
"for i in range(70, 130, 10):\n",
" print(i, mccarthy91(i))\n",
" print(i + 1, mccarthy91(i + 1)) "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 12 - roots of polynomial.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def roots(*coeffs):\n",
" matrix = np.eye(len(coeffs) - 1, k=-1)\n",
" matrix[:,-1] = np.array(coeffs[:0:-1]) / -coeffs[0]\n",
" return np.linalg.eigvals(matrix)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0.1])"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# 10x - 1 = 0\n",
"roots(10, -1)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([ 1., 1.])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# x^2 - 2x + 1 = 0\n",
"roots(1, -2, 1)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([ 3., -3.])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# 2x^2 - 18 = 0\n",
"roots(2, 0, -18)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0.5+0.8660254j, 0.5-0.8660254j, -1.0+0.j , -0.5+0.8660254j,\n",
" -0.5-0.8660254j])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# x^5 + x^4 + x^3 + x^2 + x + 1 = 0\n",
"roots(1, 1, 1, 1, 1, 1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 13 - extended euclidean algorithm.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def gcd(x, y):\n",
" u0, v0 = 1, 0\n",
" u1, v1 = 0, 1\n",
" while y:\n",
" q = x // y\n",
" u0, u1 = u1, u0 - q * u1\n",
" v0, v1 = v1, v0 - q * v1\n",
" x, y = y, x % y\n",
" return x, u0, v0"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(1, 3, -2)"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gcd(5, 7)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(18, -9, 40)"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gcd(2*3*7*9*11, 6*12*13)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(6, -1351389, 189739)"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gcd(32423940, 230934894)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(50, 1, -1)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gcd(150, 100)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(1, -49, 74)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gcd(151, 100)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 14 - huffman codes.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from collections import Counter"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def find_min(freq):\n",
" item = min(freq, key=lambda i: i[0])\n",
" freq.remove(item)\n",
" return item"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def huffman_codes(text):\n",
" freq = [(i, x) for x, i in Counter(text).items()]\n",
"\n",
" while len(freq) > 1:\n",
" li, lx = find_min(freq)\n",
" ri, rx = find_min(freq)\n",
" freq.append((li + ri, (lx, rx)))\n",
"\n",
" print_codes(freq.pop()[1])"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def print_codes(tree, prefix=''):\n",
" if isinstance(tree, tuple):\n",
" print_codes(tree[0], prefix + '0')\n",
" print_codes(tree[1], prefix + '1')\n",
" else:\n",
" print(tree, prefix)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a 0\n",
"b 10\n",
"c 11\n"
]
}
],
"source": [
"huffman_codes('abca')"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"i 000\n",
" 001\n",
"t 01\n",
"l 1000\n",
"v 1001\n",
"s 101\n",
"a 11\n"
]
}
],
"source": [
"huffman_codes('astala vista tasta')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 15 - breaking OTP.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## ciphertext"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"ciphertext = [\n",
" b'm\\x99QH\\xfc\\x99\\xcel\\xfc>\\x11\\xf81\\xda:\\x15\"6\\xd3b\\x07\\x7f\\xed\\x87\\xd5\\xd4\\xf0\\xbb',\n",
" b'x\\x96^\\r\\xb5\\x83\\x86u\\xeel\\x0e\\xf8,\\xce:\\x06 6\\xd0b\\nx\\xfd\\x87\\xd9\\xc9\\xe8',\n",
" b'm\\x90O^\\xfc\\x80\\xd3f\\xe7>\\x16\\xf46\\x89w\\x05r8\\xcb-\\x04',\n",
" b'`\\x97O\\r\\xbd\\x9f\\xc3%\\xe1q\\x0e\\xb15\\xdbu\\x0e5y\\xca*\\x1c7\\xec\\xc2\\xd2\\xcb',\n",
" b\"m\\x90[Y\\xfc\\x80\\xdf%\\xeb\\x7f\\x03\\xe2b\\xc1{\\x167y\\xdf'\\x16y\\xa8\\xc6\\x97\\xc2\\xed\\xa9p(\",\n",
" b'`\\x9dN\\r\\xb5\\x8b\\x86m\\xe0n\\x1f\\xb1*\\xc8i@45\\xd25\\x1d7\\xe9\\xd0\\xd6\\xdf',\n",
" b'p\\x96\\x1aL\\xfc\\x83\\xcfb\\xe7jZ\\xfe0\\x89s\\x0er8\\x9d&\\x12n',\n",
" b'p\\x96\\x1aL\\xfc\\x9b\\xcfv\\xe6q\\x14\\xb1-\\xdb:\\t<y\\xd3-\\x1dr',\n",
" b'p\\x8b\\x1aD\\xa8\\xcd\\xd2m\\xeal\\x1f\\xf7-\\xdb\\x7f@&1\\xd8b\\x1fr\\xfb\\xd4\\x97\\xc1\\xf0\\xa2t',\n",
" b'x\\x94V\\r\\xa8\\x85\\xc7q\\xafi\\x1f\\xb11\\xcc\\x7f@=+\\x9d1\\x16r\\xe5',\n",
" b'p\\x8b\\x1aO\\xa9\\x99\\x86d\\xafz\\x08\\xf4#\\xc4:\\x17;-\\xd5+\\x1d7\\xe9\\x87\\xd3\\xd4\\xfa\\xad|',\n",
" b'p\\xd8IY\\xbd\\x83\\xc2%\\xees\\x13\\xf5b\\xddr\\x05r+\\xd2#\\x01',\n",
" b'v\\x9e\\x1aL\\xfc\\x9e\\xd3w\\xe9>\\x0e\\xfe0\\xc4\\x7f\\x0e&<\\xd9b\\x00\\x7f\\xe7\\xd5\\xd2',\n",
" b'x\\x96^\\r\\x95\\xcd\\xcej\\xe3zZ\\xe6+\\xddr\\t<y\\xd0;S\\x7f\\xe9\\xc9\\xd3',\n",
" b\"~\\x8a[D\\xb2\\x9e\\x86j\\xe9>\\x0e\\xf9'\\x89}\\x0f>=\\xd8,Sd\\xe9\\xc9\\xd3\",\n",
" b'q\\x97M\\r\\xba\\x88\\xd1%\\xf6{\\x0e\\xb1*\\xc6m@&1\\xd8;St\\xfa\\xc2\\xd2\\xd6',\n",
" b'm\\x90HB\\xa9\\x8a\\xce%\\xe2gZ\\xf7+\\xc7}\\x05 *\\x9d6\\x1c7\\xfc\\xcf\\xd2\\x86\\xfb\\xa9t5',\n",
" b'n\\x90SA\\xb9\\xcd\\xcf%\\xf8{\\x1f\\xe1b\\xder\\t><\\x9d\\x0bS`\\xed\\xc2\\xc7',\n",
" b'9\\xd8_I\\xbb\\x8c\\xd4%\\xeer\\x16\\xf0,\\x89j\\x0f7y\\x9dbS7\\xa8\\x87\\x97\\x86\\xbf',\n",
"]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from string import ascii_lowercase\n",
"\n",
"# set of allowed characters\n",
"letters = set(ascii_lowercase + ' ')\n",
"\n",
"# reconstructed messages\n",
"plaintext = [''] * len(ciphertext)\n",
"\n",
"# take all the codes at the same position\n",
"for messages in zip(*ciphertext):\n",
" keys = set()\n",
" \n",
" # find viable keys\n",
" for key in range(256):\n",
" for m in messages:\n",
" if chr(m ^ key) not in letters:\n",
" break\n",
" else:\n",
" keys.add(key)\n",
"\n",
" key = keys.pop() if len(keys) == 1 else None\n",
"\n",
" # reconstruct plaintext\n",
" for i, m in enumerate(messages):\n",
" if key is not None:\n",
" plaintext[i] += chr(m ^ key)\n",
" else:\n",
" plaintext[i] += '?'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## result"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"['take?this kiss upon?t',\n",
" 'and ?n parting from?y',\n",
" 'thus?much let me av?w',\n",
" 'you ?re not wrong w?o',\n",
" 'that?my days have b?e',\n",
" 'yet ?f hope has flo?n',\n",
" 'in a?night or in a ?a',\n",
" 'in a?vision or in n?n',\n",
" 'is i? therefore the?l',\n",
" 'all ?hat we see or ?e',\n",
" 'is b?t a dream with?n',\n",
" 'i st?nd amid the ro?r',\n",
" 'of a?surf tormented?s',\n",
" 'and ? hold within m? ',\n",
" 'grai?s of the golde? ',\n",
" 'how ?ew yet how the? ',\n",
" 'thro?gh my fingers ?o',\n",
" 'whil? i weep while ? ',\n",
" ' ed?ar allan poe ? ']"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"plaintext"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 16 - no-condition swap.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"this is C code"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"```C\n",
"void swap(int *x, int *y) {\n",
" int u = *x, v = *y;\n",
" int s = (u - v) >> (sizeof(int) * 8 - 1);\n",
" *x = v * (1 + s) - u * s;\n",
" *y = u * (1 + s) - v * s;\n",
"}\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"this is Python equivalent"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def swap(x, y):\n",
" s = x < y\n",
" return x * s + y * (1 - s), y * s + x * (1 - s)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"((3, 15), (3, 15))"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"swap(3, 15), swap(15, 3)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"((-13, 5), (-13, 5))"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"swap(-13, 5), swap(5, -13)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 17 - perceptron.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np\n",
"from bokeh.plotting import figure, show, output_notebook"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## data"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"X = np.array([[0, 1, 1], [1, 0, 1], [1, 1, 1], [-1, 1, 1], [1, -1, 1]])\n",
"Y = np.array([1, 1, 1, 0, 0])\n",
"W = np.zeros(3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def perceptron(x, w):\n",
" return (x @ w >= 0).astype(int)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def train(x, y, w):\n",
" for i in range(len(x)):\n",
" # evaluate perceptron\n",
" h = perceptron(x[i, :], w)\n",
" \n",
" # misclassification\n",
" if h != y[i]:\n",
" # positive sample\n",
" if y[i] == 1: \n",
" w += x[i, :]\n",
" # negative sample\n",
" else: \n",
" w -= x[i, :]\n",
" \n",
" # evaluate\n",
" return perceptron(x, w)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## training"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"y= [1 1 1 0 0]\n",
"w= [ 0. 0. -2.] acc= 0.4\n",
"w= [ 1. 1. -2.] acc= 0.6\n",
"w= [ 2. 1. -2.] acc= 0.8\n",
"w= [ 2. 2. -1.] acc= 1.0\n",
"w= [ 2. 2. -1.] acc= 1.0\n"
]
}
],
"source": [
"print('y=', Y)\n",
"for _ in range(5):\n",
" h = train(X, Y, W)\n",
" print('w=', W, 'acc=', np.mean(h == Y))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## plot"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <div class=\"bk-root\">\n",
" <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
" <span id=\"2160c5cf-de49-4299-a4aa-5510f6f6883a\">Loading BokehJS ...</span>\n",
" </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
"\n",
" var force = true;\n",
"\n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
"\n",
"\n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
" window._bokeh_timeout = Date.now() + 5000;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
"\n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
"\n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" document.getElementById(\"2160c5cf-de49-4299-a4aa-5510f6f6883a\").textContent = \"BokehJS successfully loaded.\";\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
"\n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
"\n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"2160c5cf-de49-4299-a4aa-5510f6f6883a\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '2160c5cf-de49-4299-a4aa-5510f6f6883a' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
"\n",
" var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.js\"];\n",
"\n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" Bokeh.set_log_level(\"info\");\n",
" },\n",
" \n",
" function(Bokeh) {\n",
" \n",
" document.getElementById(\"2160c5cf-de49-4299-a4aa-5510f6f6883a\").textContent = \"BokehJS is loading...\";\n",
" },\n",
" function(Bokeh) {\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css\");\n",
" }\n",
" ];\n",
"\n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === true)) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === true) {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (force !== true) {\n",
" var cell = $(document.getElementById(\"2160c5cf-de49-4299-a4aa-5510f6f6883a\")).parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
"\n",
" }\n",
"\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
"}(this));"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"\n",
" <div class=\"bk-root\">\n",
" <div class=\"bk-plotdiv\" id=\"72eb47c3-6534-48a0-96d9-e185ca72086f\"></div>\n",
" </div>\n",
"<script type=\"text/javascript\">\n",
" \n",
" (function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
" \n",
" var force = false;\n",
" \n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
" \n",
" \n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
" window._bokeh_timeout = Date.now() + 0;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
" \n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
" \n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" document.getElementById(\"72eb47c3-6534-48a0-96d9-e185ca72086f\").textContent = \"BokehJS successfully loaded.\";\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
" \n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
" \n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"72eb47c3-6534-48a0-96d9-e185ca72086f\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '72eb47c3-6534-48a0-96d9-e185ca72086f' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
" \n",
" var js_urls = [];\n",
" \n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" (function() {\n",
" var fn = function() {\n",
" var docs_json = {\"9d8a46b9-464e-467e-8996-17316866b842\":{\"roots\":{\"references\":[{\"attributes\":{\"formatter\":{\"id\":\"a4d17122-bcc4-4028-932d-e014c4aa0de8\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"613070b0-b76a-4c08-832f-3a9b5ee2a2f8\",\"type\":\"BasicTicker\"}},\"id\":\"6257cf02-c549-4bde-8a81-798646453130\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"613070b0-b76a-4c08-832f-3a9b5ee2a2f8\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_color\":{\"field\":\"fill_color\"},\"line_color\":{\"field\":\"line_color\"},\"size\":{\"units\":\"screen\",\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2adfe167-9c80-4ae9-8b39-a0eca2da3e83\",\"type\":\"Circle\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"613070b0-b76a-4c08-832f-3a9b5ee2a2f8\",\"type\":\"BasicTicker\"}},\"id\":\"112d1507-521f-4284-8be3-2cb23deeca76\",\"type\":\"Grid\"},{\"attributes\":{\"plot\":{\"id\":\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"8fe01a96-eaa6-4007-8219-cfff7f9b3abf\",\"type\":\"PanTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"585025b1-845e-4a6d-af47-fd033c62905a\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"data_source\":{\"id\":\"26d97b99-35f3-48b3-99e9-019cd0ef2f45\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"ae747e30-2abf-4416-9077-bb3c1987293a\",\"type\":\"Line\"},\"hover_glyph\":null,\"nonselection_glyph\":{\"id\":\"83b32469-0c6c-47b4-b463-bbcb081ac382\",\"type\":\"Line\"},\"selection_glyph\":null},\"id\":\"b207ac70-511b-4be9-a70e-e76a91766dd6\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"d4926bb9-5f28-4356-9188-848147a63c34\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"overlay\":{\"id\":\"585025b1-845e-4a6d-af47-fd033c62905a\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"b614bea6-fdb2-4569-b3af-046489ad31a7\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"20c8bfc6-71b4-4ace-b412-2ad08ed23966\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"plot\":{\"id\":\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"53727b7d-2353-4473-9d74-120cf3db7d2a\",\"type\":\"SaveTool\"},{\"attributes\":{\"plot\":{\"id\":\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"e8da8fc4-101f-484a-9a28-6f237df8760c\",\"type\":\"ResetTool\"},{\"attributes\":{\"line_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"ae747e30-2abf-4416-9077-bb3c1987293a\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"83b32469-0c6c-47b4-b463-bbcb081ac382\",\"type\":\"Line\"},{\"attributes\":{\"data_source\":{\"id\":\"24796f9f-0d5c-4942-88b9-7d33c750dcc2\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"2adfe167-9c80-4ae9-8b39-a0eca2da3e83\",\"type\":\"Circle\"},\"hover_glyph\":null,\"nonselection_glyph\":{\"id\":\"70849fec-7b3f-40fb-8f91-1b175f2dcf6e\",\"type\":\"Circle\"},\"selection_glyph\":null},\"id\":\"80b7f1a6-29a2-4322-89a1-34f1b5914e54\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[-1.5,1.5],\"y\":[2.0,-1.0]}},\"id\":\"26d97b99-35f3-48b3-99e9-019cd0ef2f45\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"1d49710a-9e56-4e6c-8d74-54a526d6b617\",\"type\":\"Title\"},{\"attributes\":{\"callback\":null},\"id\":\"15aa450c-dc5f-4725-8085-3e1241143829\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"a4d17122-bcc4-4028-932d-e014c4aa0de8\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\",\"fill_color\",\"line_color\"],\"data\":{\"fill_color\":[\"green\",\"green\",\"green\",\"red\",\"red\"],\"line_color\":[\"green\",\"green\",\"green\",\"red\",\"red\"],\"x\":[0,1,1,-1,1],\"y\":[1,0,1,1,-1]}},\"id\":\"24796f9f-0d5c-4942-88b9-7d33c750dcc2\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":{\"id\":\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"0b1ef167-1944-4ba8-9ddd-2441a23ce4f6\",\"type\":\"HelpTool\"},{\"attributes\":{\"below\":[{\"id\":\"bd1f2a2e-466f-46ca-bf88-ae6166a81a4c\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"6257cf02-c549-4bde-8a81-798646453130\",\"type\":\"LinearAxis\"}],\"renderers\":[{\"id\":\"bd1f2a2e-466f-46ca-bf88-ae6166a81a4c\",\"type\":\"LinearAxis\"},{\"id\":\"53f8b72e-050a-4bb6-b3f4-f7675eb6ca10\",\"type\":\"Grid\"},{\"id\":\"6257cf02-c549-4bde-8a81-798646453130\",\"type\":\"LinearAxis\"},{\"id\":\"112d1507-521f-4284-8be3-2cb23deeca76\",\"type\":\"Grid\"},{\"id\":\"585025b1-845e-4a6d-af47-fd033c62905a\",\"type\":\"BoxAnnotation\"},{\"id\":\"80b7f1a6-29a2-4322-89a1-34f1b5914e54\",\"type\":\"GlyphRenderer\"},{\"id\":\"b207ac70-511b-4be9-a70e-e76a91766dd6\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1d49710a-9e56-4e6c-8d74-54a526d6b617\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"92255fb0-2b58-4bb8-a9b8-072a11214d69\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"6e317923-97cd-4c37-a8b1-a9240a45fb73\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"15aa450c-dc5f-4725-8085-3e1241143829\",\"type\":\"DataRange1d\"},\"y_range\":{\"id\":\"d124dd27-1723-455c-9839-3ef285c33ce1\",\"type\":\"DataRange1d\"}},\"id\":\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"92255fb0-2b58-4bb8-a9b8-072a11214d69\",\"type\":\"ToolEvents\"},{\"attributes\":{},\"id\":\"c30ac0fc-6fc6-4e00-9a8e-e4635cde2cd1\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"units\":\"screen\",\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"70849fec-7b3f-40fb-8f91-1b175f2dcf6e\",\"type\":\"Circle\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"8fe01a96-eaa6-4007-8219-cfff7f9b3abf\",\"type\":\"PanTool\"},{\"id\":\"d4926bb9-5f28-4356-9188-848147a63c34\",\"type\":\"WheelZoomTool\"},{\"id\":\"b614bea6-fdb2-4569-b3af-046489ad31a7\",\"type\":\"BoxZoomTool\"},{\"id\":\"53727b7d-2353-4473-9d74-120cf3db7d2a\",\"type\":\"SaveTool\"},{\"id\":\"e8da8fc4-101f-484a-9a28-6f237df8760c\",\"type\":\"ResetTool\"},{\"id\":\"0b1ef167-1944-4ba8-9ddd-2441a23ce4f6\",\"type\":\"HelpTool\"}]},\"id\":\"6e317923-97cd-4c37-a8b1-a9240a45fb73\",\"type\":\"Toolbar\"},{\"attributes\":{\"callback\":null},\"id\":\"d124dd27-1723-455c-9839-3ef285c33ce1\",\"type\":\"DataRange1d\"},{\"attributes\":{\"formatter\":{\"id\":\"20c8bfc6-71b4-4ace-b412-2ad08ed23966\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"c30ac0fc-6fc6-4e00-9a8e-e4635cde2cd1\",\"type\":\"BasicTicker\"}},\"id\":\"bd1f2a2e-466f-46ca-bf88-ae6166a81a4c\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":{\"id\":\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"c30ac0fc-6fc6-4e00-9a8e-e4635cde2cd1\",\"type\":\"BasicTicker\"}},\"id\":\"53f8b72e-050a-4bb6-b3f4-f7675eb6ca10\",\"type\":\"Grid\"}],\"root_ids\":[\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.4\"}};\n",
" var render_items = [{\"docid\":\"9d8a46b9-464e-467e-8996-17316866b842\",\"elementid\":\"72eb47c3-6534-48a0-96d9-e185ca72086f\",\"modelid\":\"efa79ece-28e4-4d70-ae70-4ac2c2793ec7\"}];\n",
" \n",
" Bokeh.embed.embed_items(docs_json, render_items);\n",
" };\n",
" if (document.readyState != \"loading\") fn();\n",
" else document.addEventListener(\"DOMContentLoaded\", fn);\n",
" })();\n",
" },\n",
" function(Bokeh) {\n",
" }\n",
" ];\n",
" \n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === true)) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === true) {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (force !== true) {\n",
" var cell = $(document.getElementById(\"72eb47c3-6534-48a0-96d9-e185ca72086f\")).parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
" \n",
" }\n",
" \n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
" }(this));\n",
"</script>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"output_notebook()\n",
"\n",
"color = list(map({0: 'red', 1: 'green'}.__getitem__, Y))\n",
"x0, y0 = -1.5, (-1.5 * -W[0] - W[2]) / W[1]\n",
"x1, y1 = 1.5, (1.5 * -W[0] - W[2]) / W[1]\n",
"\n",
"plot = figure()\n",
"plot.circle(x=X[:, 0], y=X[:, 1], color=color, size=10)\n",
"plot.line(x=[x0, x1], y=[y0, y1])\n",
"show(plot)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 18 - monopoly.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from bokeh.plotting import figure, show, output_notebook"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def probability(n):\n",
" # initial probabilities\n",
" p = [0, 0, 0, 0, 0, 1]\n",
" \n",
" # next field is conditioned on previous six fields\n",
" for _ in range(n):\n",
" p.append(sum(p[-6:]) / 6)\n",
"\n",
" return p[6:]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"fields = probability(24)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <div class=\"bk-root\">\n",
" <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
" <span id=\"3655099f-822b-4a5f-904f-bfd9ca0ea296\">Loading BokehJS ...</span>\n",
" </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
"\n",
" var force = true;\n",
"\n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
"\n",
"\n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
" window._bokeh_timeout = Date.now() + 5000;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
"\n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
"\n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" document.getElementById(\"3655099f-822b-4a5f-904f-bfd9ca0ea296\").textContent = \"BokehJS successfully loaded.\";\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
"\n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
"\n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"3655099f-822b-4a5f-904f-bfd9ca0ea296\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '3655099f-822b-4a5f-904f-bfd9ca0ea296' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
"\n",
" var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.js\"];\n",
"\n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" Bokeh.set_log_level(\"info\");\n",
" },\n",
" \n",
" function(Bokeh) {\n",
" \n",
" document.getElementById(\"3655099f-822b-4a5f-904f-bfd9ca0ea296\").textContent = \"BokehJS is loading...\";\n",
" },\n",
" function(Bokeh) {\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css\");\n",
" }\n",
" ];\n",
"\n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === true)) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === true) {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (force !== true) {\n",
" var cell = $(document.getElementById(\"3655099f-822b-4a5f-904f-bfd9ca0ea296\")).parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
"\n",
" }\n",
"\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
"}(this));"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"\n",
" <div class=\"bk-root\">\n",
" <div class=\"bk-plotdiv\" id=\"14c9c1f6-d54b-4b97-abe8-d794984b15ba\"></div>\n",
" </div>\n",
"<script type=\"text/javascript\">\n",
" \n",
" (function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
" \n",
" var force = false;\n",
" \n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
" \n",
" \n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
" window._bokeh_timeout = Date.now() + 0;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
" \n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
" \n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" document.getElementById(\"14c9c1f6-d54b-4b97-abe8-d794984b15ba\").textContent = \"BokehJS successfully loaded.\";\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
" \n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
" \n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"14c9c1f6-d54b-4b97-abe8-d794984b15ba\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '14c9c1f6-d54b-4b97-abe8-d794984b15ba' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
" \n",
" var js_urls = [];\n",
" \n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" (function() {\n",
" var fn = function() {\n",
" var docs_json = {\"a9924ccd-9443-45f6-9360-fb660a2b9d68\":{\"roots\":{\"references\":[{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"ed524e02-fa07-4c2f-82cd-0de0d50bfb99\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"overlay\":{\"id\":\"ed524e02-fa07-4c2f-82cd-0de0d50bfb99\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"aa931700-85b9-4890-afb3-ca516f6d5581\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"3e401167-22e2-471b-8217-1b47c303c6ec\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"plot\":{\"id\":\"aa931700-85b9-4890-afb3-ca516f6d5581\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"b6d02bb7-90cf-456b-a5ac-42dbcb7d3bb6\",\"type\":\"HelpTool\"},{\"attributes\":{\"plot\":{\"id\":\"aa931700-85b9-4890-afb3-ca516f6d5581\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"6afc6a74-5729-4633-8753-5cf780ec651b\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"db73f1ac-05cb-46b4-ab29-7fa10e0ea58b\",\"type\":\"ToolEvents\"},{\"attributes\":{},\"id\":\"53d7e903-3389-4352-a203-e10688ae016a\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"c2c484ef-6c75-4f69-acba-fccdcb21ca9b\",\"type\":\"Circle\"},{\"attributes\":{\"callback\":null},\"id\":\"242f2dd3-d112-45cd-9681-681a7efbb07f\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null,\"end\":0.5},\"id\":\"97e62014-0f19-44e9-a506-1d6e83902d76\",\"type\":\"Range1d\"},{\"attributes\":{\"below\":[{\"id\":\"514a864f-24fe-4df1-8370-48c56f86de5e\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"ac30856b-ca1c-40a6-ab16-f86b6718aad7\",\"type\":\"LinearAxis\"}],\"renderers\":[{\"id\":\"514a864f-24fe-4df1-8370-48c56f86de5e\",\"type\":\"LinearAxis\"},{\"id\":\"bd5736b4-4e05-49e7-a3b0-a94d9ca032f4\",\"type\":\"Grid\"},{\"id\":\"ac30856b-ca1c-40a6-ab16-f86b6718aad7\",\"type\":\"LinearAxis\"},{\"id\":\"09532312-128d-402c-9530-78b775775961\",\"type\":\"Grid\"},{\"id\":\"ed524e02-fa07-4c2f-82cd-0de0d50bfb99\",\"type\":\"BoxAnnotation\"},{\"id\":\"8b0ef9ba-b37c-41ab-9520-1556a9b9f1d1\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"ae518d99-6044-40a1-b7cb-32cb24f6db95\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"db73f1ac-05cb-46b4-ab29-7fa10e0ea58b\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"ea0dd2cc-3dac-44cd-88e1-46a0397e34c1\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"242f2dd3-d112-45cd-9681-681a7efbb07f\",\"type\":\"DataRange1d\"},\"y_range\":{\"id\":\"97e62014-0f19-44e9-a506-1d6e83902d76\",\"type\":\"Range1d\"}},\"id\":\"aa931700-85b9-4890-afb3-ca516f6d5581\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"755476e2-9d68-4053-a64a-b13472f7f4a7\",\"type\":\"PanTool\"},{\"id\":\"8937aae2-3508-4def-b1c3-4a960392aaf2\",\"type\":\"WheelZoomTool\"},{\"id\":\"3e401167-22e2-471b-8217-1b47c303c6ec\",\"type\":\"BoxZoomTool\"},{\"id\":\"59a772b6-f9b3-4703-8a6c-34e2d60556a6\",\"type\":\"SaveTool\"},{\"id\":\"6afc6a74-5729-4633-8753-5cf780ec651b\",\"type\":\"ResetTool\"},{\"id\":\"b6d02bb7-90cf-456b-a5ac-42dbcb7d3bb6\",\"type\":\"HelpTool\"}]},\"id\":\"ea0dd2cc-3dac-44cd-88e1-46a0397e34c1\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"ee71e1d3-08c8-44fb-ba14-abaf1dbc3eda\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"formatter\":{\"id\":\"ee71e1d3-08c8-44fb-ba14-abaf1dbc3eda\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"aa931700-85b9-4890-afb3-ca516f6d5581\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"bd4eeee3-1436-4995-be0e-6286b4cd8202\",\"type\":\"BasicTicker\"}},\"id\":\"514a864f-24fe-4df1-8370-48c56f86de5e\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":{\"id\":\"aa931700-85b9-4890-afb3-ca516f6d5581\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"8937aae2-3508-4def-b1c3-4a960392aaf2\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"ae518d99-6044-40a1-b7cb-32cb24f6db95\",\"type\":\"Title\"},{\"attributes\":{\"plot\":{\"id\":\"aa931700-85b9-4890-afb3-ca516f6d5581\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"755476e2-9d68-4053-a64a-b13472f7f4a7\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"bd4eeee3-1436-4995-be0e-6286b4cd8202\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_color\":{\"value\":\"#1f77b4\"},\"line_color\":{\"value\":\"#1f77b4\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1c869266-0713-441d-94bb-cdf814da84e6\",\"type\":\"Circle\"},{\"attributes\":{\"data_source\":{\"id\":\"659d551b-fa00-4ce2-b0b0-b9b2d09464ea\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1c869266-0713-441d-94bb-cdf814da84e6\",\"type\":\"Circle\"},\"hover_glyph\":null,\"nonselection_glyph\":{\"id\":\"c2c484ef-6c75-4f69-acba-fccdcb21ca9b\",\"type\":\"Circle\"},\"selection_glyph\":null},\"id\":\"8b0ef9ba-b37c-41ab-9520-1556a9b9f1d1\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"aa931700-85b9-4890-afb3-ca516f6d5581\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"bd4eeee3-1436-4995-be0e-6286b4cd8202\",\"type\":\"BasicTicker\"}},\"id\":\"bd5736b4-4e05-49e7-a3b0-a94d9ca032f4\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],\"y\":[0.16666666666666666,0.19444444444444445,0.22685185185185186,0.2646604938271605,0.30877057613168724,0.36023233882030176,0.25360439529035206,0.26809401672763294,0.28036894544149776,0.289288461039772,0.29339312224187397,0.29083021326023845,0.27926319233356117,0.2835396585074294,0.2861139321373955,0.2870714299200451,0.28670192473342393,0.2855867251486823,0.2847128104634229,0.2856210801517332,0.28596798375911714,0.28594365902940405,0.2857556972142972,0.28559799262777613]}},\"id\":\"659d551b-fa00-4ce2-b0b0-b9b2d09464ea\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"formatter\":{\"id\":\"53d7e903-3389-4352-a203-e10688ae016a\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"aa931700-85b9-4890-afb3-ca516f6d5581\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"6474ee69-5f02-462c-99be-837b87d0bf64\",\"type\":\"BasicTicker\"}},\"id\":\"ac30856b-ca1c-40a6-ab16-f86b6718aad7\",\"type\":\"LinearAxis\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"aa931700-85b9-4890-afb3-ca516f6d5581\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"6474ee69-5f02-462c-99be-837b87d0bf64\",\"type\":\"BasicTicker\"}},\"id\":\"09532312-128d-402c-9530-78b775775961\",\"type\":\"Grid\"},{\"attributes\":{\"plot\":{\"id\":\"aa931700-85b9-4890-afb3-ca516f6d5581\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"59a772b6-f9b3-4703-8a6c-34e2d60556a6\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"6474ee69-5f02-462c-99be-837b87d0bf64\",\"type\":\"BasicTicker\"}],\"root_ids\":[\"aa931700-85b9-4890-afb3-ca516f6d5581\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.4\"}};\n",
" var render_items = [{\"docid\":\"a9924ccd-9443-45f6-9360-fb660a2b9d68\",\"elementid\":\"14c9c1f6-d54b-4b97-abe8-d794984b15ba\",\"modelid\":\"aa931700-85b9-4890-afb3-ca516f6d5581\"}];\n",
" \n",
" Bokeh.embed.embed_items(docs_json, render_items);\n",
" };\n",
" if (document.readyState != \"loading\") fn();\n",
" else document.addEventListener(\"DOMContentLoaded\", fn);\n",
" })();\n",
" },\n",
" function(Bokeh) {\n",
" }\n",
" ];\n",
" \n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === true)) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === true) {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (force !== true) {\n",
" var cell = $(document.getElementById(\"14c9c1f6-d54b-4b97-abe8-d794984b15ba\")).parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
" \n",
" }\n",
" \n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
" }(this));\n",
"</script>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"output_notebook()\n",
"\n",
"plot = figure(y_range=(0, .5))\n",
"plot.scatter(x=range(1, 25), y=fields)\n",
"show(plot)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 19 - counting inversions.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def inversions(items):\n",
" n = len(items)\n",
" if n <= 1:\n",
" return items, 0\n",
"\n",
" # number of inversions in partitions\n",
" left, linv = inversions(items[:n // 2])\n",
" right, rinv = inversions(items[n // 2:])\n",
"\n",
" inv = linv + rinv\n",
" llen, rlen = len(left), len(right)\n",
" i, j, aux = 0, 0, []\n",
"\n",
" # merge and count inversions\n",
" for k in range(n):\n",
" if i < llen and j < rlen and left[i] > right[j]:\n",
" inv += llen - i\n",
" aux.append(right[j])\n",
" j += 1\n",
" elif i < llen:\n",
" aux.append(left[i])\n",
" i += 1\n",
" else:\n",
" aux.append(right[j])\n",
" j += 1\n",
" \n",
" return aux, inv"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[29, 25, 17, 15, 6, 8, 11, 15, 7, 5]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"items = list(np.random.randint(0, 30, 10))\n",
"items"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"([5, 6, 7, 8, 11, 15, 15, 17, 25, 29], 37)"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"inversions(items)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 20 - linearithmic multiplication.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def mult(x, y):\n",
" nx, ny = len(x), len(y)\n",
"\n",
" # auxiliary x\n",
" fx = np.zeros(nx + ny, dtype=np.float64)\n",
" fx[:nx] = list(map(int, reversed(x)))\n",
"\n",
" # auxiliary y\n",
" fy = np.zeros(nx + ny, np.float64)\n",
" fy[:ny] += list(map(int, reversed(y)))\n",
"\n",
" # convolution via FFT\n",
" fx = np.fft.fft(fx)\n",
" fy = np.fft.fft(fy)\n",
" z = np.fft.ifft(fx * fy).real.round().astype(int)\n",
"\n",
" # carry over\n",
" for i in range(nx + ny - 1):\n",
" z[i + 1] += z[i] // 10\n",
" z[i] %= 10\n",
"\n",
" return ''.join(map(str, reversed(z)))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2092214183 * 2448001885 = 05121744263807734955\n",
"7122461902 * 9593715983 = 68330876587525979666\n",
"8617908461 * 3158102416 = 27216237531550941776\n",
"3655867966 * 9064788350 = 33139669347334996100\n",
"6622180692 * 4377254226 = 28986968419392604392\n",
"6147274168 * 3384584963 = 20805971712451135784\n",
"4714353304 * 5151447888 = 24285745371176621952\n",
"9370611380 * 145283374 = 1361394037729196120\n",
"2465911620 * 2801092645 = 06907246902002034900\n",
"7836421288 * 8791219244 = 68891697631156866272\n"
]
}
],
"source": [
"for _ in range(10):\n",
" x, y = np.random.randint(1e+3, 1e+10, 2)\n",
" print(x, '*', y, '=', mult(str(x), str(y)))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
================================================
FILE: day 21 - k-means.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import numpy as np\n",
"from bokeh.plotting import figure, gridplot, show, output_notebook"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## algorithm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def kmeans(points, n_clusters):\n",
" # sample initial centroids\n",
" sample = np.random.choice(len(points), n_clusters, replace=False)\n",
" centroid = points[sample]\n",
" \n",
" loss = [-1, -2]\n",
" while not np.allclose(*loss):\n",
" # compute distance for each pair: point/centroid\n",
" distance = [np.sqrt(((points - c) ** 2).sum(1)) for c in centroid]\n",
" # new loss\n",
" loss = loss[1:] + [np.sum(distance)]\n",
" # assign new clusters\n",
" cluster = np.argmin(distance, axis=0)\n",
" # update centroids by new cluster means\n",
" for i in range(n_clusters):\n",
" centroid[i] = np.mean(points[cluster == i], axis=0)\n",
" \n",
" return cluster"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## run"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"generate clusters"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"n = 100\n",
"A = np.random.multivariate_normal([2, 0], [[1, .1], [-4, 1]], n)\n",
"B = np.random.multivariate_normal([-2, 0], [[1, -4], [.1, 1]], n)\n",
"C = np.random.multivariate_normal([2, -2], [[1, 4], [-.1, 1]], n)\n",
"D = ['red', 'green', 'blue']\n",
"\n",
"points = np.r_[A, B, C]\n",
"original_color = np.repeat(D[:3], n)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"detect k-means clusters"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"cluster = kmeans(points, 3)\n",
"new_color = [D[i] for i in cluster]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"plot original and new clusters"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <div class=\"bk-root\">\n",
" <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
" <span id=\"16889866-a9f1-4cfe-af87-3320ebc9b66a\">Loading BokehJS ...</span>\n",
" </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
"\n",
" var force = true;\n",
"\n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
"\n",
"\n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
" window._bokeh_timeout = Date.now() + 5000;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
"\n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
"\n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" document.getElementById(\"16889866-a9f1-4cfe-af87-3320ebc9b66a\").textContent = \"BokehJS successfully loaded.\";\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
"\n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
"\n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"16889866-a9f1-4cfe-af87-3320ebc9b66a\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '16889866-a9f1-4cfe-af87-3320ebc9b66a' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
"\n",
" var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.js\"];\n",
"\n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" Bokeh.set_log_level(\"info\");\n",
" },\n",
" \n",
" function(Bokeh) {\n",
" \n",
" document.getElementById(\"16889866-a9f1-4cfe-af87-3320ebc9b66a\").textContent = \"BokehJS is loading...\";\n",
" },\n",
" function(Bokeh) {\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.4.min.css\");\n",
" }\n",
" ];\n",
"\n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === true)) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === true) {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (force !== true) {\n",
" var cell = $(document.getElementById(\"16889866-a9f1-4cfe-af87-3320ebc9b66a\")).parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
"\n",
" }\n",
"\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
"}(this));"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"\n",
" <div class=\"bk-root\">\n",
" <div class=\"bk-plotdiv\" id=\"55465db3-f305-47b4-be29-e377c9099f5b\"></div>\n",
" </div>\n",
"<script type=\"text/javascript\">\n",
" \n",
" (function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
" \n",
" var force = false;\n",
" \n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
" \n",
" \n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
" window._bokeh_timeout = Date.now() + 0;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
" \n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
" \n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" document.getElementById(\"55465db3-f305-47b4-be29-e377c9099f5b\").textContent = \"BokehJS successfully loaded.\";\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
" \n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
" \n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"55465db3-f305-47b4-be29-e377c9099f5b\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '55465db3-f305-47b4-be29-e377c9099f5b' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
" \n",
" var js_urls = [];\n",
" \n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" (function() {\n",
" var fn = function() {\n",
" var docs_json = {\"2439f8e3-0f1f-4139-8ca1-54dbb2cb31f6\":{\"roots\":{\"references\":[{\"attributes\":{\"plot\":{\"id\":\"ad4db974-a026-40b9-be54-d7fd45d85706\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"ccba70ca-0bd4-4881-be52-8fb3a0cf6d2f\",\"type\":\"SaveTool\"},{\"attributes\":{\"below\":[{\"id\":\"93278224-f2d9-4215-a9bc-7fdf642a0bea\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"9dc5528c-fff7-43f6-b00f-ae5e52f76f77\",\"type\":\"LinearAxis\"}],\"plot_height\":300,\"renderers\":[{\"id\":\"93278224-f2d9-4215-a9bc-7fdf642a0bea\",\"type\":\"LinearAxis\"},{\"id\":\"be869721-d724-47f6-846e-7682cb0ea4e2\",\"type\":\"Grid\"},{\"id\":\"9dc5528c-fff7-43f6-b00f-ae5e52f76f77\",\"type\":\"LinearAxis\"},{\"id\":\"e650d43f-812d-42be-9302-1c3871e0c4ed\",\"type\":\"Grid\"},{\"id\":\"569beb5d-5d9c-4696-9631-8e5b5f0f0163\",\"type\":\"BoxAnnotation\"},{\"id\":\"e7bc11de-389c-4faa-b918-23498d7e8c4f\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"fe406dcf-1019-4a01-840b-160ef52c3035\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"76a1db81-89bb-4cda-82aa-4d85e01c9bef\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"2551660f-2f35-4f7e-bcd9-ba5f4442342e\",\"type\":\"Toolbar\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"0b06eb57-52ce-452b-bc50-af8f1573d4b3\",\"type\":\"DataRange1d\"},\"y_range\":{\"id\":\"ee6377df-b396-45ec-a02e-f7e8d6b06e1c\",\"type\":\"DataRange1d\"}},\"id\":\"ad4db974-a026-40b9-be54-d7fd45d85706\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"330891d6-418b-427d-84b5-0085a872b0eb\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"plot\":{\"id\":\"62e2bb29-f830-40ae-9f45-c696aabffa08\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"fea8b879-b1fa-424e-8358-df8a8f4b85a5\",\"type\":\"ResetTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"a78c6b62-9121-406b-abdb-02eb5611fa5e\",\"type\":\"PanTool\"},{\"id\":\"89c04bba-3aa9-4b61-adec-407ec961c1aa\",\"type\":\"WheelZoomTool\"},{\"id\":\"0e808d78-5e5c-4f16-a905-8396087b224c\",\"type\":\"BoxZoomTool\"},{\"id\":\"7d1faab0-f193-415f-b7fc-f3caee901283\",\"type\":\"SaveTool\"},{\"id\":\"fea8b879-b1fa-424e-8358-df8a8f4b85a5\",\"type\":\"ResetTool\"},{\"id\":\"519f20aa-9543-4dcb-a3a5-1c50b18374c8\",\"type\":\"HelpTool\"}]},\"id\":\"c8f555ae-2fe3-4be4-8f92-123bcd352754\",\"type\":\"Toolbar\"},{\"attributes\":{\"sizing_mode\":\"scale_width\",\"toolbar_location\":\"above\",\"tools\":[{\"id\":\"a78c6b62-9121-406b-abdb-02eb5611fa5e\",\"type\":\"PanTool\"},{\"id\":\"89c04bba-3aa9-4b61-adec-407ec961c1aa\",\"type\":\"WheelZoomTool\"},{\"id\":\"0e808d78-5e5c-4f16-a905-8396087b224c\",\"type\":\"BoxZoomTool\"},{\"id\":\"7d1faab0-f193-415f-b7fc-f3caee901283\",\"type\":\"SaveTool\"},{\"id\":\"fea8b879-b1fa-424e-8358-df8a8f4b85a5\",\"type\":\"ResetTool\"},{\"id\":\"519f20aa-9543-4dcb-a3a5-1c50b18374c8\",\"type\":\"HelpTool\"},{\"id\":\"2174abff-8029-46c7-a59f-4440652117d2\",\"type\":\"PanTool\"},{\"id\":\"7f217c80-a5e7-40fc-8ca9-1022dc625b6b\",\"type\":\"WheelZoomTool\"},{\"id\":\"d17317b5-72c3-467a-90ae-5bc3c3bf8a74\",\"type\":\"BoxZoomTool\"},{\"id\":\"ccba70ca-0bd4-4881-be52-8fb3a0cf6d2f\",\"type\":\"SaveTool\"},{\"id\":\"70bac9a0-38b4-4add-a59f-8bab1303276d\",\"type\":\"ResetTool\"},{\"id\":\"9a4e71c5-48de-402b-95d4-db993a6c4759\",\"type\":\"HelpTool\"}]},\"id\":\"b16684ad-17b0-41a9-a2e8-061110b39710\",\"type\":\"ToolbarBox\"},{\"attributes\":{},\"id\":\"9a609612-db8e-4b7d-99d1-2d17f073e542\",\"type\":\"BasicTicker\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\",\"fill_color\",\"line_color\"],\"data\":{\"fill_color\":[\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"red\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"red\",\"red\",\"red\",\"blue\",\"blue\",\"red\",\"red\",\"blue\",\"blue\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"blue\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"red\",\"blue\",\"red\",\"blue\",\"blue\",\"blue\",\"green\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"green\",\"blue\",\"green\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"green\",\"blue\",\"blue\",\"blue\",\"green\",\"green\",\"green\",\"blue\",\"blue\",\"blue\",\"green\",\"blue\",\"blue\",\"green\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"green\",\"blue\",\"green\",\"green\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"green\",\"green\",\"blue\",\"green\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"green\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"blue\",\"green\",\"blue\",\"blue\",\"green\",\"blue\",\"green\",\"blue\",\"blue\",\"blue\",\"blue\",\"green\",\"green\",\"red\",\"red\",\"green\",\"red\",\"red\",\"red\",\"green\",\"green\",\"red\",\"green\",\"red\",\"red\",\"green\",\"red\",\"red\",\"red\",\"red\",\"red\",\"green\",\"red\",\"green\",\"red\",\"red\",\"red\",\"red\",\"green\",\"green\",\"green\",\"red\",\"red\",\"red\",\"red\",\"green\",\"red\",\"green\",\"red\",\"green\",\"red\",\"green\",\"red\",\"red\",\"green\",\"red\",\"green\",\"red\",\"red\",\"green\",\"green\",\"red\",\"red\",\"green\",\"green\",\"red\",\"red\",\"red\",\"green\",\"green\",\"green\",\"red\",\"green\",\"green\",\"green\",\"green\",\"green\",\"green\",\"red\",\"green\",\"green\",\"green\",\"green\",\"red\",\"red\",\"green\",\"green\",\"red\",\"green\",\"red\",\"red\",\"green\",\"red\",\"red\",\"red\",\"green\",\"green\",\"green\",\"red\",\"green\",\"green\",\"green\",\"green\",\"green\",\"red\",\"green\",\"green\",\"red\",\"red\",\"red\",\"red\"],\"line_color\":[\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"red\",\"red\",\"red\",\"red\",\"blue\",\"red\",\"red\",\"red\",\"red\",
gitextract_c9zpuegw/ ├── .gitignore ├── README.md ├── bonus - fast convex hull.ipynb ├── day 00 - logo.ipynb ├── day 01 - hanoi tower.ipynb ├── day 02 - matrix chain multiplication.ipynb ├── day 03 - next permutation.ipynb ├── day 04 - counting 1-bits.ipynb ├── day 05 - eratosthenes sieve.ipynb ├── day 06 - postfix notation.ipynb ├── day 07 - binary addition FSA.ipynb ├── day 08 - binary search.ipynb ├── day 09 - monte carlo - pi.ipynb ├── day 10 - karatsuba multiplication.ipynb ├── day 11 - McCarthy 91.ipynb ├── day 12 - roots of polynomial.ipynb ├── day 13 - extended euclidean algorithm.ipynb ├── day 14 - huffman codes.ipynb ├── day 15 - breaking OTP.ipynb ├── day 16 - no-condition swap.ipynb ├── day 17 - perceptron.ipynb ├── day 18 - monopoly.ipynb ├── day 19 - counting inversions.ipynb ├── day 20 - linearithmic multiplication.ipynb ├── day 21 - k-means.ipynb ├── day 22 - determinant.ipynb ├── day 23 - sudoku.ipynb ├── day 24 - closest pair.ipynb ├── day 25 - conjugate gradients.ipynb ├── day 26 - karger's mincut.ipynb ├── day 27 - spiral matrix.ipynb ├── day 28 - convex hull.ipynb ├── day 29 - string searching.ipynb ├── day 30 - strassen multiplication.ipynb ├── day 31 - timeit.ipynb ├── day 32 - pagerank.ipynb ├── day 33 - reservoir sampling.ipynb ├── day 34 - aho-corasick.ipynb ├── day 35 - median.ipynb ├── day 36 - bulls and cows.ipynb ├── day 37 - longest common subsequence.ipynb ├── day 38 - burrows-wheeler.ipynb ├── day 39 - 4sum.ipynb ├── day 40 - counting ones.ipynb ├── day 41 - union-find.ipynb ├── day 42 - hamming codes.ipynb ├── day 43 - shuffle.ipynb ├── day 44 - gradient approximation.ipynb ├── day 45 - binary search tree.ipynb ├── day 46 - bézier curve.ipynb ├── day 47 - factoradic.ipynb ├── day 48 - dijkstra.ipynb ├── day 49 - ford-fulkerson.ipynb ├── day 50 - game of life.ipynb ├── day 51 - rabin-miller.ipynb ├── day 52 - RSA.ipynb ├── day 53 - RSA encryption scheme.ipynb ├── day 54 - longest unique sequence.ipynb ├── day 55 - quincunx.ipynb ├── day 56 - lzw.ipynb ├── day 57 - quicksort.ipynb ├── day 58 - integer exponentation.ipynb ├── day 59 - colored tiling.ipynb ├── day 60 - bloom filter.ipynb ├── day 61 - hanoi tower II.ipynb ├── day 62 - linked-list cycle.ipynb ├── day 63 - zig-zag.ipynb ├── day 64 - k-clique.ipynb ├── day 65 - floyd-warshall.ipynb ├── day 66 - gram-schmidt.ipynb ├── day 67 - linked-list mergesort.ipynb ├── day 68 - gale-shapley.ipynb ├── day 69 - rmsprop.ipynb ├── day 70 - deadlock.ipynb ├── day 71 - hashtable - chaining.ipynb ├── day 72 - hashtable - open addressing.ipynb ├── day 73 - bresenhams line.ipynb ├── day 74 - google interview question.ipynb ├── day 75 - merkles puzzles.ipynb ├── day 76 - 2-3 tree.ipynb ├── day 77 - unification.ipynb ├── day 78 - horn-satifiability.ipynb ├── day 79 - logistic regression.ipynb ├── day 80 - hopfield net.ipynb ├── day 81 - topological sort.ipynb ├── day 82 - flood fill.ipynb ├── day 83 - breaking AES.ipynb ├── day 84 - maze generation.ipynb ├── day 85 - coin success runs.ipynb ├── day 86 - binary heap.ipynb ├── day 87 - gray code.ipynb ├── day 88 - perlin noise.ipynb ├── day 89 - bipartiteness.ipynb ├── day 90 - simple nim - AI.ipynb ├── day 91 - variations.ipynb ├── day 92 - PCA.ipynb ├── day 93 - first and follow.ipynb ├── day 94 - earley parser.ipynb ├── day 95 - strongly connected components.ipynb ├── day 96 - floyd-steinberg.ipynb ├── day 97 - locally weighted regression.ipynb ├── day 98 - romberg integration.ipynb ├── day 99 - simplex.ipynb └── day I00 - segmented eratosthenes sieve.ipynb
Copy disabled (too large)
Download .json
Condensed preview — 104 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (14,452K chars).
[
{
"path": ".gitignore",
"chars": 19,
"preview": ".ipynb_checkpoints\n"
},
{
"path": "README.md",
"chars": 1707,
"preview": "### 100 days of algorithms\n\nThis repository contains notebooks with live code to accompany [100 days of algorithms](http"
},
{
"path": "bonus - fast convex hull.ipynb",
"chars": 3926,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 00 - logo.ipynb",
"chars": 69600,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 01 - hanoi tower.ipynb",
"chars": 2180,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 02 - matrix chain multiplication.ipynb",
"chars": 2897,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 03 - next permutation.ipynb",
"chars": 2952,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 04 - counting 1-bits.ipynb",
"chars": 2069,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 05 - eratosthenes sieve.ipynb",
"chars": 1843,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 06 - postfix notation.ipynb",
"chars": 2500,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 07 - binary addition FSA.ipynb",
"chars": 2804,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 08 - binary search.ipynb",
"chars": 2634,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 09 - monte carlo - pi.ipynb",
"chars": 2334,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 10 - karatsuba multiplication.ipynb",
"chars": 6199,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 11 - McCarthy 91.ipynb",
"chars": 2177,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 12 - roots of polynomial.ipynb",
"chars": 2860,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 13 - extended euclidean algorithm.ipynb",
"chars": 2893,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 14 - huffman codes.ipynb",
"chars": 2761,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 15 - breaking OTP.ipynb",
"chars": 5071,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## ciphertext\"\n ]\n },\n {\n \"ce"
},
{
"path": "day 16 - no-condition swap.ipynb",
"chars": 2272,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 17 - perceptron.ipynb",
"chars": 25458,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 18 - monopoly.ipynb",
"chars": 23087,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 19 - counting inversions.ipynb",
"chars": 2748,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 20 - linearithmic multiplication.ipynb",
"chars": 2739,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 21 - k-means.ipynb",
"chars": 56753,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 22 - determinant.ipynb",
"chars": 2739,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 23 - sudoku.ipynb",
"chars": 3645,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 24 - closest pair.ipynb",
"chars": 4300,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 25 - conjugate gradients.ipynb",
"chars": 2565,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 26 - karger's mincut.ipynb",
"chars": 3505,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 27 - spiral matrix.ipynb",
"chars": 2209,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 28 - convex hull.ipynb",
"chars": 28009,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 29 - string searching.ipynb",
"chars": 2730,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 30 - strassen multiplication.ipynb",
"chars": 4179,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 31 - timeit.ipynb",
"chars": 4748,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 32 - pagerank.ipynb",
"chars": 78008,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 33 - reservoir sampling.ipynb",
"chars": 2286,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 34 - aho-corasick.ipynb",
"chars": 4194,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 35 - median.ipynb",
"chars": 2786,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 36 - bulls and cows.ipynb",
"chars": 3613,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 37 - longest common subsequence.ipynb",
"chars": 2433,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 38 - burrows-wheeler.ipynb",
"chars": 2267,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 39 - 4sum.ipynb",
"chars": 2801,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 40 - counting ones.ipynb",
"chars": 3685,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 41 - union-find.ipynb",
"chars": 2431,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 42 - hamming codes.ipynb",
"chars": 4112,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 43 - shuffle.ipynb",
"chars": 2539,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 44 - gradient approximation.ipynb",
"chars": 3884,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 45 - binary search tree.ipynb",
"chars": 34365,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 46 - bézier curve.ipynb",
"chars": 57927,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 47 - factoradic.ipynb",
"chars": 2566,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 48 - dijkstra.ipynb",
"chars": 39978,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 49 - ford-fulkerson.ipynb",
"chars": 192284,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n "
},
{
"path": "day 50 - game of life.ipynb",
"chars": 62147,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 51 - rabin-miller.ipynb",
"chars": 3766,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 52 - RSA.ipynb",
"chars": 6780,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 53 - RSA encryption scheme.ipynb",
"chars": 7658,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 54 - longest unique sequence.ipynb",
"chars": 7558,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 55 - quincunx.ipynb",
"chars": 25673,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 56 - lzw.ipynb",
"chars": 5047,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 57 - quicksort.ipynb",
"chars": 3459,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 58 - integer exponentation.ipynb",
"chars": 4340,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 59 - colored tiling.ipynb",
"chars": 4815,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 60 - bloom filter.ipynb",
"chars": 4196,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 61 - hanoi tower II.ipynb",
"chars": 5592,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 62 - linked-list cycle.ipynb",
"chars": 4520,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 63 - zig-zag.ipynb",
"chars": 4176,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 64 - k-clique.ipynb",
"chars": 145908,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 65 - floyd-warshall.ipynb",
"chars": 57811,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 66 - gram-schmidt.ipynb",
"chars": 5839,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 67 - linked-list mergesort.ipynb",
"chars": 6266,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 68 - gale-shapley.ipynb",
"chars": 4594,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 69 - rmsprop.ipynb",
"chars": 51152,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 70 - deadlock.ipynb",
"chars": 3695,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 71 - hashtable - chaining.ipynb",
"chars": 8775,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 72 - hashtable - open addressing.ipynb",
"chars": 7762,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 73 - bresenhams line.ipynb",
"chars": 164999,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 74 - google interview question.ipynb",
"chars": 3395,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 75 - merkles puzzles.ipynb",
"chars": 5754,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 76 - 2-3 tree.ipynb",
"chars": 28153,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 77 - unification.ipynb",
"chars": 9018,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 78 - horn-satifiability.ipynb",
"chars": 4940,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 79 - logistic regression.ipynb",
"chars": 383923,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 80 - hopfield net.ipynb",
"chars": 6295,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 81 - topological sort.ipynb",
"chars": 27656,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 82 - flood fill.ipynb",
"chars": 280052,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 83 - breaking AES.ipynb",
"chars": 5657,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 84 - maze generation.ipynb",
"chars": 30946,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 85 - coin success runs.ipynb",
"chars": 5153,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 86 - binary heap.ipynb",
"chars": 6826,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 87 - gray code.ipynb",
"chars": 59681,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 88 - perlin noise.ipynb",
"chars": 6358069,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 89 - bipartiteness.ipynb",
"chars": 139529,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 90 - simple nim - AI.ipynb",
"chars": 113791,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 91 - variations.ipynb",
"chars": 3984,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 92 - PCA.ipynb",
"chars": 64686,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": false\n },\n \"out"
},
{
"path": "day 93 - first and follow.ipynb",
"chars": 7255,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 94 - earley parser.ipynb",
"chars": 16052,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"## algorithm\"\n ]\n },\n {\n \"cel"
},
{
"path": "day 95 - strongly connected components.ipynb",
"chars": 82890,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 96 - floyd-steinberg.ipynb",
"chars": 4931124,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {},\n \"outputs\": [\n {\n \"data\":"
},
{
"path": "day 97 - locally weighted regression.ipynb",
"chars": 215396,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {},\n \"outputs\": [\n {\n \"data\":"
},
{
"path": "day 98 - romberg integration.ipynb",
"chars": 8169,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day 99 - simplex.ipynb",
"chars": 6436,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
},
{
"path": "day I00 - segmented eratosthenes sieve.ipynb",
"chars": 5018,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"collapsed\": true\n },\n \"outp"
}
]
About this extraction
This page contains the full source code of the coells/100days GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 104 files (13.5 MB), approximately 3.5M tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.