Fixed for new code organization and book format

These haven't been run in awhile; I updated them so they
have the same look and feel as the book, and fixed a few
imports and pep 8 compliance as well.
This commit is contained in:
Roger Labbe 2018-11-02 16:11:20 -07:00
parent 81eff753b5
commit 17f38c69f2
5 changed files with 190 additions and 1408 deletions

File diff suppressed because one or more lines are too long

View File

@ -3,277 +3,23 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style>\n",
"@import url('http://fonts.googleapis.com/css?family=Source+Code+Pro');\n",
"@import url('http://fonts.googleapis.com/css?family=Lora');\n",
"\n",
"//@import url('http://fonts.googleapis.com/css?family=Open+Sans');\n",
"//@import url('http://fonts.googleapis.com/css?family=Vollkorn');\n",
"//@import url('http://fonts.googleapis.com/css?family=Karla');\n",
"//@import url('http://fonts.googleapis.com/css?family=Poppins');\n",
"//@import url('http://fonts.googleapis.com/css?family=Arimo');\n",
"//@import url('http://fonts.googleapis.com/css?family=Roboto');\n",
"//@import url('http://fonts.googleapis.com/css?family=Lato');\n",
"//@import url('http://fonts.googleapis.com/css?family=Domine');\n",
"//@import url('http://fonts.googleapis.com/css?family=Chivo');\n",
"//@import url('http://fonts.googleapis.com/css?family=Cardo');\n",
"//@import url('http://fonts.googleapis.com/css?family=Arvo');\n",
"//@import url('http://fonts.googleapis.com/css?family=Crimson+Text');\n",
"//@import url('http://fonts.googleapis.com/css?family=Ubuntu');\n",
"//@import url('http://fonts.googleapis.com/css?family=Fontin');\n",
"//@import url('http://fonts.googleapis.com/css?family=Raleway');\n",
"//@import url('http://fonts.googleapis.com/css?family=Merriweather');\n",
"\n",
"\n",
".CodeMirror pre {\n",
" font-family: 'Source Code Pro', Consolas, monocco, monospace;\n",
"}\n",
" div.cell{\n",
" width: 850px;\n",
" margin-left: 0% !important;\n",
" margin-right: auto;\n",
" }\n",
" div.text_cell_render{\n",
" font-family: 'Lora';\n",
" //font-family: 'Open Sans';\n",
" //font-family: 'Karla',verdana,arial,sans-serif;\n",
" //font-family: 'Roboto',verdana,arial,sans-serif;\n",
" //font-family: 'Lato',verdana,arial,sans-serif;\n",
" //font-family: 'Domine',verdana,arial,sans-serif;\n",
" //font-family: 'Chivo',verdana,arial,sans-serif;\n",
" //font-family: 'Cardo',verdana,arial,sans-serif;\n",
" //font-family: 'Arvo',verdana,arial,sans-serif;\n",
" //font-family: 'Poppins',verdana,arial,sans-serif; \n",
" //font-family: 'Ubuntu',verdana,arial,sans-serif;\n",
" //font-family: 'Fontin',verdana,arial,sans-serif;\n",
" //font-family: 'Raleway',verdana,arial,sans-serif;\n",
" //font-family: 'Merriweather',verdana,arial,sans-serif;\n",
" //font-family: 'Crimson Text', verdana,arial,sans-serif;\n",
" //font-family: verdana,arial,sans-serif;\n",
" //font-family: arial,sans-serif;\n",
" line-height: 125%;\n",
" font-size: 130%;\n",
" text-align: justify;\n",
" text-justify:inter-word;\n",
" }\n",
" div.text_cell code {\n",
" background: transparent;\n",
" color: #000000;\n",
" font-weight: 400;\n",
" font-size: 12pt;\n",
" //font-style: bold;\n",
" font-family: 'Source Code Pro', Consolas, monocco, monospace;\n",
" }\n",
" h1 {\n",
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
"\t}\n",
"\t\n",
" div.input_area {\n",
" background: #F6F6F9;\n",
" border: 1px solid #586e75; \n",
" }\n",
"\n",
" .text_cell_render h1 {\n",
" font-weight: 200;\n",
" font-size: 30pt;\n",
" line-height: 100%;\n",
" color:#c76c0c;\n",
" margin-bottom: 0.5em;\n",
" margin-top: 1em;\n",
" display: block;\n",
" white-space: wrap;\n",
" text-align: left;\n",
" } \n",
" h2 {\n",
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
" text-align: left;\n",
" }\n",
" .text_cell_render h2 {\n",
" font-weight: 200;\n",
" font-size: 16pt;\n",
" font-style: italic;\n",
" line-height: 100%;\n",
" color:#c76c0c;\n",
" margin-bottom: 0.5em;\n",
" margin-top: 1.5em;\n",
" display: block;\n",
" white-space: wrap;\n",
" text-align: left;\n",
" } \n",
" h3 {\n",
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
" }\n",
" .text_cell_render h3 {\n",
" font-weight: 200;\n",
" font-size: 14pt;\n",
" line-height: 100%;\n",
" color:#d77c0c;\n",
" margin-bottom: 0.5em;\n",
" margin-top: 2em;\n",
" display: block;\n",
" white-space: wrap;\n",
" text-align: left;\n",
" }\n",
" h4 {\n",
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
" }\n",
" .text_cell_render h4 {\n",
" font-weight: 100;\n",
" font-size: 14pt;\n",
" color:#d77c0c;\n",
" margin-bottom: 0.5em;\n",
" margin-top: 0.5em;\n",
" display: block;\n",
" white-space: nowrap;\n",
" }\n",
" h5 {\n",
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
" }\n",
"\n",
" .text_cell_render h5 {\n",
" font-weight: 200;\n",
" font-style: normal;\n",
" color: #1d3b84;\n",
" font-size: 16pt;\n",
" margin-bottom: 0em;\n",
" margin-top: 0.5em;\n",
" display: block;\n",
" white-space: nowrap;\n",
" }\n",
" div.output_subarea.output_text.output_pyout {\n",
" overflow-x: auto;\n",
" overflow-y: scroll;\n",
" max-height: 50000px;\n",
" }\n",
" div.output_subarea.output_stream.output_stdout.output_text {\n",
" overflow-x: auto;\n",
" overflow-y: scroll;\n",
" max-height: 50000px;\n",
" }\n",
" div.output_wrapper{\n",
" margin-top:0.2em;\n",
" margin-bottom:0.2em;\n",
"}\n",
"\n",
" code{\n",
" font-size: 6pt;\n",
"\n",
" }\n",
" .rendered_html code{\n",
" background-color: transparent;\n",
" }\n",
" ul{\n",
" margin: 2em;\n",
" }\n",
" ul li{\n",
" padding-left: 0.5em; \n",
" margin-bottom: 0.5em; \n",
" margin-top: 0.5em; \n",
" }\n",
" ul li li{\n",
" padding-left: 0.2em; \n",
" margin-bottom: 0.2em; \n",
" margin-top: 0.2em; \n",
" }\n",
" ol{\n",
" margin: 2em;\n",
" }\n",
" ol li{\n",
" padding-left: 0.5em; \n",
" margin-bottom: 0.5em; \n",
" margin-top: 0.5em; \n",
" }\n",
" ul li{\n",
" padding-left: 0.5em; \n",
" margin-bottom: 0.5em; \n",
" margin-top: 0.2em; \n",
" }\n",
" a:link{\n",
" font-weight: bold;\n",
" color:#447adb;\n",
" }\n",
" a:visited{\n",
" font-weight: bold;\n",
" color: #1d3b84;\n",
" }\n",
" a:hover{\n",
" font-weight: bold;\n",
" color: #1d3b84;\n",
" }\n",
" a:focus{\n",
" font-weight: bold;\n",
" color:#447adb;\n",
" }\n",
" a:active{\n",
" font-weight: bold;\n",
" color:#447adb;\n",
" }\n",
" .rendered_html :link {\n",
" text-decoration: underline; \n",
" }\n",
" .rendered_html :hover {\n",
" text-decoration: none; \n",
" }\n",
" .rendered_html :visited {\n",
" text-decoration: none;\n",
" }\n",
" .rendered_html :focus {\n",
" text-decoration: none;\n",
" }\n",
" .rendered_html :active {\n",
" text-decoration: none;\n",
" }\n",
" .warning{\n",
" color: rgb( 240, 20, 20 )\n",
" } \n",
" hr {\n",
" color: #f3f3f3;\n",
" background-color: #f3f3f3;\n",
" height: 1px;\n",
" }\n",
" blockquote{\n",
" display:block;\n",
" background: #fcfcfc;\n",
" border-left: 5px solid #c76c0c;\n",
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
" width:680px;\n",
" padding: 10px 10px 10px 10px;\n",
" text-align:justify;\n",
" text-justify:inter-word;\n",
" }\n",
" blockquote p {\n",
" margin-bottom: 0;\n",
" line-height: 125%;\n",
" font-size: 100%;\n",
" }\n",
"</style>\n",
"<script>\n",
" MathJax.Hub.Config({\n",
" TeX: {\n",
" extensions: [\"AMSmath.js\"],\n",
" equationNumbers: { autoNumber: \"AMS\", useLabelIds: true}\n",
" },\n",
" tex2jax: {\n",
" inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n",
" displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n",
" },\n",
" displayAlign: 'center', // Change this to 'center' to center equations.\n",
" \"HTML-CSS\": {\n",
" scale:95,\n",
" availableFonts: [],\n",
" preferredFont:null,\n",
" webFont: \"TeX\",\n",
" styles: {'.MathJax_Display': {\"margin\": 4}}\n",
" }\n",
" });\n",
"</script>\n"
" <style>\n",
" .output_wrapper, .output {\n",
" height:auto !important;\n",
" max-height:100000px; \n",
" }\n",
" .output_scroll {\n",
" box-shadow:none !important;\n",
" webkit-box-shadow:none !important;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
@ -288,8 +34,10 @@
"#format the book\n",
"%matplotlib inline\n",
"from __future__ import division, print_function\n",
"import sys;sys.path.insert(0,'..')\n",
"from book_format import load_style;load_style('..')"
"import sys\n",
"sys.path.insert(0, '..')\n",
"import book_format\n",
"book_format.set_style()"
]
},
{
@ -428,9 +176,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 0
"nbformat_minor": 1
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,284 +2,30 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style>\n",
"@import url('http://fonts.googleapis.com/css?family=Source+Code+Pro');\n",
"@import url('http://fonts.googleapis.com/css?family=Lora');\n",
"\n",
"//@import url('http://fonts.googleapis.com/css?family=Open+Sans');\n",
"//@import url('http://fonts.googleapis.com/css?family=Vollkorn');\n",
"//@import url('http://fonts.googleapis.com/css?family=Karla');\n",
"//@import url('http://fonts.googleapis.com/css?family=Poppins');\n",
"//@import url('http://fonts.googleapis.com/css?family=Arimo');\n",
"//@import url('http://fonts.googleapis.com/css?family=Roboto');\n",
"//@import url('http://fonts.googleapis.com/css?family=Lato');\n",
"//@import url('http://fonts.googleapis.com/css?family=Domine');\n",
"//@import url('http://fonts.googleapis.com/css?family=Chivo');\n",
"//@import url('http://fonts.googleapis.com/css?family=Cardo');\n",
"//@import url('http://fonts.googleapis.com/css?family=Arvo');\n",
"//@import url('http://fonts.googleapis.com/css?family=Crimson+Text');\n",
"//@import url('http://fonts.googleapis.com/css?family=Ubuntu');\n",
"//@import url('http://fonts.googleapis.com/css?family=Fontin');\n",
"//@import url('http://fonts.googleapis.com/css?family=Raleway');\n",
"//@import url('http://fonts.googleapis.com/css?family=Merriweather');\n",
"\n",
"\n",
".CodeMirror pre {\n",
" font-family: 'Source Code Pro', Consolas, monocco, monospace;\n",
"}\n",
" div.cell{\n",
" width: 850px;\n",
" margin-left: 0% !important;\n",
" margin-right: auto;\n",
" }\n",
" div.text_cell_render{\n",
" font-family: 'Lora';\n",
" //font-family: 'Open Sans';\n",
" //font-family: 'Karla',verdana,arial,sans-serif;\n",
" //font-family: 'Roboto',verdana,arial,sans-serif;\n",
" //font-family: 'Lato',verdana,arial,sans-serif;\n",
" //font-family: 'Domine',verdana,arial,sans-serif;\n",
" //font-family: 'Chivo',verdana,arial,sans-serif;\n",
" //font-family: 'Cardo',verdana,arial,sans-serif;\n",
" //font-family: 'Arvo',verdana,arial,sans-serif;\n",
" //font-family: 'Poppins',verdana,arial,sans-serif; \n",
" //font-family: 'Ubuntu',verdana,arial,sans-serif;\n",
" //font-family: 'Fontin',verdana,arial,sans-serif;\n",
" //font-family: 'Raleway',verdana,arial,sans-serif;\n",
" //font-family: 'Merriweather',verdana,arial,sans-serif;\n",
" //font-family: 'Crimson Text', verdana,arial,sans-serif;\n",
" //font-family: verdana,arial,sans-serif;\n",
" //font-family: arial,sans-serif;\n",
" line-height: 125%;\n",
" font-size: 130%;\n",
" text-align: justify;\n",
" text-justify:inter-word;\n",
" }\n",
" div.text_cell code {\n",
" background: transparent;\n",
" color: #000000;\n",
" font-weight: 400;\n",
" font-size: 12pt;\n",
" //font-style: bold;\n",
" font-family: 'Source Code Pro', Consolas, monocco, monospace;\n",
" }\n",
" h1 {\n",
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
"\t}\n",
"\t\n",
" div.input_area {\n",
" background: #F6F6F9;\n",
" border: 1px solid #586e75; \n",
" }\n",
"\n",
" .text_cell_render h1 {\n",
" font-weight: 200;\n",
" font-size: 30pt;\n",
" line-height: 100%;\n",
" color:#c76c0c;\n",
" margin-bottom: 0.5em;\n",
" margin-top: 1em;\n",
" display: block;\n",
" white-space: wrap;\n",
" text-align: left;\n",
" } \n",
" h2 {\n",
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
" text-align: left;\n",
" }\n",
" .text_cell_render h2 {\n",
" font-weight: 200;\n",
" font-size: 16pt;\n",
" font-style: italic;\n",
" line-height: 100%;\n",
" color:#c76c0c;\n",
" margin-bottom: 0.5em;\n",
" margin-top: 1.5em;\n",
" display: block;\n",
" white-space: wrap;\n",
" text-align: left;\n",
" } \n",
" h3 {\n",
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
" }\n",
" .text_cell_render h3 {\n",
" font-weight: 200;\n",
" font-size: 14pt;\n",
" line-height: 100%;\n",
" color:#d77c0c;\n",
" margin-bottom: 0.5em;\n",
" margin-top: 2em;\n",
" display: block;\n",
" white-space: wrap;\n",
" text-align: left;\n",
" }\n",
" h4 {\n",
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
" }\n",
" .text_cell_render h4 {\n",
" font-weight: 100;\n",
" font-size: 14pt;\n",
" color:#d77c0c;\n",
" margin-bottom: 0.5em;\n",
" margin-top: 0.5em;\n",
" display: block;\n",
" white-space: nowrap;\n",
" }\n",
" h5 {\n",
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
" }\n",
"\n",
" .text_cell_render h5 {\n",
" font-weight: 200;\n",
" font-style: normal;\n",
" color: #1d3b84;\n",
" font-size: 16pt;\n",
" margin-bottom: 0em;\n",
" margin-top: 0.5em;\n",
" display: block;\n",
" white-space: nowrap;\n",
" }\n",
" div.output_subarea.output_text.output_pyout {\n",
" overflow-x: auto;\n",
" overflow-y: scroll;\n",
" max-height: 50000px;\n",
" }\n",
" div.output_subarea.output_stream.output_stdout.output_text {\n",
" overflow-x: auto;\n",
" overflow-y: scroll;\n",
" max-height: 50000px;\n",
" }\n",
" div.output_wrapper{\n",
" margin-top:0.2em;\n",
" margin-bottom:0.2em;\n",
"}\n",
"\n",
" code{\n",
" font-size: 6pt;\n",
"\n",
" }\n",
" .rendered_html code{\n",
" background-color: transparent;\n",
" }\n",
" ul{\n",
" margin: 2em;\n",
" }\n",
" ul li{\n",
" padding-left: 0.5em; \n",
" margin-bottom: 0.5em; \n",
" margin-top: 0.5em; \n",
" }\n",
" ul li li{\n",
" padding-left: 0.2em; \n",
" margin-bottom: 0.2em; \n",
" margin-top: 0.2em; \n",
" }\n",
" ol{\n",
" margin: 2em;\n",
" }\n",
" ol li{\n",
" padding-left: 0.5em; \n",
" margin-bottom: 0.5em; \n",
" margin-top: 0.5em; \n",
" }\n",
" ul li{\n",
" padding-left: 0.5em; \n",
" margin-bottom: 0.5em; \n",
" margin-top: 0.2em; \n",
" }\n",
" a:link{\n",
" font-weight: bold;\n",
" color:#447adb;\n",
" }\n",
" a:visited{\n",
" font-weight: bold;\n",
" color: #1d3b84;\n",
" }\n",
" a:hover{\n",
" font-weight: bold;\n",
" color: #1d3b84;\n",
" }\n",
" a:focus{\n",
" font-weight: bold;\n",
" color:#447adb;\n",
" }\n",
" a:active{\n",
" font-weight: bold;\n",
" color:#447adb;\n",
" }\n",
" .rendered_html :link {\n",
" text-decoration: underline; \n",
" }\n",
" .rendered_html :hover {\n",
" text-decoration: none; \n",
" }\n",
" .rendered_html :visited {\n",
" text-decoration: none;\n",
" }\n",
" .rendered_html :focus {\n",
" text-decoration: none;\n",
" }\n",
" .rendered_html :active {\n",
" text-decoration: none;\n",
" }\n",
" .warning{\n",
" color: rgb( 240, 20, 20 )\n",
" } \n",
" hr {\n",
" color: #f3f3f3;\n",
" background-color: #f3f3f3;\n",
" height: 1px;\n",
" }\n",
" blockquote{\n",
" display:block;\n",
" background: #fcfcfc;\n",
" border-left: 5px solid #c76c0c;\n",
" font-family: 'Open sans',verdana,arial,sans-serif;\n",
" width:680px;\n",
" padding: 10px 10px 10px 10px;\n",
" text-align:justify;\n",
" text-justify:inter-word;\n",
" }\n",
" blockquote p {\n",
" margin-bottom: 0;\n",
" line-height: 125%;\n",
" font-size: 100%;\n",
" }\n",
"</style>\n",
"<script>\n",
" MathJax.Hub.Config({\n",
" TeX: {\n",
" extensions: [\"AMSmath.js\"],\n",
" equationNumbers: { autoNumber: \"AMS\", useLabelIds: true}\n",
" },\n",
" tex2jax: {\n",
" inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n",
" displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n",
" },\n",
" displayAlign: 'center', // Change this to 'center' to center equations.\n",
" \"HTML-CSS\": {\n",
" scale:95,\n",
" availableFonts: [],\n",
" preferredFont:null,\n",
" webFont: \"TeX\",\n",
" styles: {'.MathJax_Display': {\"margin\": 4}}\n",
" }\n",
" });\n",
"</script>\n"
" <style>\n",
" .output_wrapper, .output {\n",
" height:auto !important;\n",
" max-height:100000px; \n",
" }\n",
" .output_scroll {\n",
" box-shadow:none !important;\n",
" webkit-box-shadow:none !important;\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
@ -288,8 +34,10 @@
"#format the book\n",
"%matplotlib inline\n",
"from __future__ import division, print_function\n",
"import sys;sys.path.insert(0,'..')\n",
"from book_format import load_style;load_style('..')"
"import sys\n",
"sys.path.insert(0, '..')\n",
"import book_format\n",
"book_format.set_style()"
]
},
{
@ -325,17 +73,15 @@
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"estimate of sin(.3) is 0.30452025\n",
"exact value of sin(.3) is 0.295520206661\n"
"exact value of sin(.3) is 0.29552020666133955\n"
]
}
],
@ -374,9 +120,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 0
"nbformat_minor": 1
}