Skip to content

Commit ecbbb79

Browse files
committed
Updating notebooks
1 parent b426cf9 commit ecbbb79

26 files changed

Lines changed: 5266 additions & 848 deletions

‎code/chap01.ipynb‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,13 @@
8888
"source": [
8989
"### Importing modsim\n",
9090
"\n",
91-
"The following cell imports `modsim`, which is a collection of functions we will use throughout the book. Whenever you start the notebook, you will have to run the following cell. It does two things:\n",
91+
"The following cell imports `modsim`, which is a collection of functions we will use throughout the book. Whenever you start the notebook, you will have to run the following cell. It does three things:\n",
9292
"\n",
9393
"1. It uses a Jupyter \"magic command\" to specify whether figures should appear in the notebook, or pop up in a new window.\n",
9494
"\n",
95-
"2. It imports everything defined in `modsim`.\n",
95+
"2. It configures Jupyter to display some values that would otherwise be invisible. \n",
96+
"\n",
97+
"3. It imports everything defined in `modsim`.\n",
9698
"\n",
9799
"Select the following cell and press SHIFT-ENTER to run it."
98100
]
@@ -119,7 +121,7 @@
119121
"cell_type": "markdown",
120122
"metadata": {},
121123
"source": [
122-
"The first time you run this on a new installation of Python, it might produce a warning message in pink. That's probably ok, but if you get a message that says `modsim.py depends on Python 3.6 features`, that means you have an older version of Python, and some features in `modsim.py` won't work correctly.\n",
124+
"The first time you run this on a new installation of Python, it might produce a warning message in pink. That's probably ok, but if you get a message that says `modsim.py depends on Python 3.7 features`, that means you have an older version of Python, and some features in `modsim.py` won't work correctly.\n",
123125
"\n",
124126
"If you need a newer version of Python, I recommend installing Anaconda. You'll find more information in the preface of the book."
125127
]
@@ -259,7 +261,9 @@
259261
"2. The last line usually tells you what type of error happened, and sometimes additional information.\n",
260262
"3. The previous lines are a \"traceback\" of what was happening when the error occurred. The first section of the traceback shows the code you wrote. The following sections are often from Python libraries.\n",
261263
"\n",
262-
"In this example, you should get a `DimensionalityError`, which is defined by Pint to indicate that you have violated a rules of dimensional analysis: you cannot add quantities with different dimensions."
264+
"In this example, you should get a `DimensionalityError`, which is defined by Pint to indicate that you have violated a rules of dimensional analysis: you cannot add quantities with different dimensions.\n",
265+
"\n",
266+
"Before you go on, you might want to delete the erroneous code so the notebook can run without errors."
263267
]
264268
},
265269
{
@@ -317,8 +321,7 @@
317321
"metadata": {},
318322
"outputs": [],
319323
"source": [
320-
"v = a * t\n",
321-
"v"
324+
"v = a * t"
322325
]
323326
},
324327
{
@@ -475,7 +478,7 @@
475478
"name": "python",
476479
"nbconvert_exporter": "python",
477480
"pygments_lexer": "ipython3",
478-
"version": "3.6.4"
481+
"version": "3.6.5"
479482
}
480483
},
481484
"nbformat": 4,

‎code/chap02.ipynb‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,11 +579,18 @@
579579
"cell_type": "markdown",
580580
"metadata": {},
581581
"source": [
582-
"After 60 minutes, you might see that the number of bike at Olin is negative. We'll fix that problem soon.\n",
582+
"After 60 minutes, you might see that the number of bike at Olin is negative. We'll fix that problem in the next notebook.\n",
583583
"\n",
584584
"But first, we want to plot the results."
585585
]
586586
},
587+
{
588+
"cell_type": "code",
589+
"execution_count": null,
590+
"metadata": {},
591+
"outputs": [],
592+
"source": []
593+
},
587594
{
588595
"cell_type": "markdown",
589596
"metadata": {},

‎code/chap09.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@
624624
"name": "python",
625625
"nbconvert_exporter": "python",
626626
"pygments_lexer": "ipython3",
627-
"version": "3.6.4"
627+
"version": "3.6.5"
628628
}
629629
},
630630
"nbformat": 4,

‎code/chap11.ipynb‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@
317317
" I: TimeSeries\n",
318318
" R: TimeSeries\n",
319319
" \"\"\"\n",
320-
" plot(S, '--', color='blue', label='Susceptible')\n",
321-
" plot(I, '-', color='red', label='Infected')\n",
322-
" plot(R, ':', color='green', label='Recovered')\n",
320+
" plot(S, '--', label='Susceptible')\n",
321+
" plot(I, '-', label='Infected')\n",
322+
" plot(R, ':', label='Recovered')\n",
323323
" decorate(xlabel='Time (days)',\n",
324324
" ylabel='Fraction of population')"
325325
]
@@ -426,7 +426,7 @@
426426
"source": [
427427
"## Exercises\n",
428428
"\n",
429-
"**Exercise** Suppose the time between contacts is 4 days and the recovery time is 5 days. Simulate this scenario for 14 days and plot the results."
429+
"**Exercise** Suppose the time between contacts is 4 days and the recovery time is 5 days. Simulate this scenario for 14 weeks and plot the results."
430430
]
431431
},
432432
{

0 commit comments

Comments
 (0)