Skip to content

Commit fb83b3c

Browse files
committed
Updating spiderman.ipynb
1 parent b8e3cff commit fb83b3c

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

code/spiderman.ipynb

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"source": [
77
"# Modeling and Simulation in Python\n",
88
"\n",
9-
"Chapter 10 Example: Spiderman\n",
9+
"Chapter 10 Example: Spider-Man\n",
1010
"\n",
1111
"Copyright 2017 Allen Downey\n",
1212
"\n",
@@ -80,7 +80,7 @@
8080
"\n",
8181
"Initially, Spider-Man is at the top of a nearby builing. I'll create a `Condition` object to contain the quantities we'll need:\n",
8282
"\n",
83-
"1. According to [the Spider-Man Wiki](http://spiderman.wikia.com/wiki/Peter_Parker_(Earth-616)) Spider-Man weighs 76 kg.\n",
83+
"1. According to [the Spider-Man Wiki](http://spiderman.wikia.com/wiki/Peter_Parker_(Earth-616), Spider-Man weighs 76 kg.\n",
8484
"\n",
8585
"2. Let's assume his terminal velocity is 60 m/s.\n",
8686
"\n",
@@ -103,7 +103,7 @@
103103
" area = 1 * m**2,\n",
104104
" rho = 1.2 * kg/m**3,\n",
105105
" v_term = 60 * m / s,\n",
106-
" duration = 60 * s,\n",
106+
" duration = 30 * s,\n",
107107
" length = 100 * m,\n",
108108
" angle = (270 - 45) * degree,\n",
109109
" k = 20 * N / m)"
@@ -138,12 +138,12 @@
138138
" \"\"\"\n",
139139
" unpack(condition)\n",
140140
" \n",
141-
" A = Vector(0, height)\n",
141+
" H = Vector(0, height)\n",
142142
" \n",
143143
" theta = angle.to(radian)\n",
144144
" x, y = pol2cart(theta, length)\n",
145145
" L = Vector(x, y)\n",
146-
" P = A + L\n",
146+
" P = H + L\n",
147147
" V = Vector(0*m/s, 0*m/s)\n",
148148
" \n",
149149
" init = State(x=P.x, y=P.y, vx=V.x, vy=V.y)\n",
@@ -153,7 +153,7 @@
153153
" \n",
154154
" return System(init=init, g=g, mass=mass, rho=rho,\n",
155155
" C_d=C_d, area=area, length=length,\n",
156-
" A=A, k=k, ts=ts)"
156+
" H=H, k=k, ts=ts)"
157157
]
158158
},
159159
{
@@ -208,7 +208,7 @@
208208
"\n",
209209
" P = Vector(x, y)\n",
210210
" V = Vector(vx, vy)\n",
211-
" L = P - A\n",
211+
" L = P - H\n",
212212
" \n",
213213
" f_spring = -k * (L.mag - length) * L.hat()\n",
214214
" a_spring = f_spring / mass\n",
@@ -251,12 +251,10 @@
251251
{
252252
"cell_type": "code",
253253
"execution_count": null,
254-
"metadata": {
255-
"collapsed": true
256-
},
254+
"metadata": {},
257255
"outputs": [],
258256
"source": [
259-
"run_odeint(system, slope_func)"
257+
"%time run_odeint(system, slope_func)"
260258
]
261259
},
262260
{
@@ -372,7 +370,7 @@
372370
"newfig()\n",
373371
"decorate(xlabel='x position (m)',\n",
374372
" ylabel='y position (m)',\n",
375-
" xlim=[-105, 105],\n",
373+
" xlim=[-80, 80],\n",
376374
" ylim=[0, 381],\n",
377375
" legend=False)\n",
378376
"\n",

0 commit comments

Comments
 (0)