Skip to content

Commit 073a2ce

Browse files
committed
Deploying to gh-pages from @ 6076a7d 🚀
1 parent 99c67aa commit 073a2ce

82 files changed

Lines changed: 6109 additions & 5993 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.tmp.py‎

Lines changed: 199 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from numpy import *
22
from numpy.linalg import *
3-
from scipy.integrate import solve_ivp
3+
from scipy.linalg import *
44
from matplotlib.pyplot import *
5+
from mpl_toolkits.mplot3d import *
6+
from scipy.integrate import solve_ivp
57
# Python 3.x Standard Library
68
import gc
79
import os
@@ -61,110 +63,206 @@ def set_ratio(ratio=1.0, bottom=0.1, top=0.1, left=0.1, right=0.1):
6163
height_in = (1.0 - left - right)/(1.0 - bottom - top) * width_in / ratio
6264
pp.gcf().set_size_inches((width_in, height_in))
6365
pp.gcf().subplots_adjust(bottom=bottom, top=1.0-top, left=left, right=1.0-right)
64-
65-
width
6666
def Q(f, xs, ys):
6767
X, Y = meshgrid(xs, ys)
68-
fx = vectorize(lambda x, y: f([x, y])[0])
69-
fy = vectorize(lambda x, y: f([x, y])[1])
68+
v = vectorize
69+
fx = v(lambda x, y: f([x, y])[0])
70+
fy = v(lambda x, y: f([x, y])[1])
7071
return X, Y, fx(X, Y), fy(X, Y)
71-
def fun(t, y):
72-
return y * y
73-
t0, tf, y0 = 0.0, 3.0, array([1.0])
74-
result = solve_ivp(fun, t_span=[t0, tf], y0=y0)
75-
figure()
76-
plot(result["t"], result["y"][0], "k")
77-
xlim(t0, tf); xlabel("$t$"); ylabel("$x(t)$")
78-
tight_layout()
79-
save("images/finite-time-blowup")
80-
tf = 1.0
81-
r = solve_ivp(fun, [t0, tf], y0,
82-
dense_output=True)
83-
figure()
84-
t = linspace(t0, tf, 1000)
85-
plot(t, r["sol"](t)[0], "k")
86-
ylim(0.0, 10.0); grid();
87-
xlabel("$t$"); ylabel("$x(t)$")
88-
tight_layout()
89-
save("images/finite-time-blowup-2")
90-
def f(x1x2):
91-
x1, x2 = x1x2
92-
dx1 = 1.0 if x1 < 0.0 else -1.0
93-
return array([dx1, 0.0])
94-
figure()
95-
x1 = x2 = linspace(-1.0, 1.0, 20)
72+
a = 2.0; x0 = 1.0
73+
figure()
74+
t = linspace(0.0, 3.0, 1000)
75+
plot(t, exp(a*t)*x0, "k")
76+
xlabel("$t$"); ylabel("$x(t)$"); title(f"$a={a}$")
77+
grid(); axis([0.0, 2.0, 0.0, 10.0])
78+
tight_layout()
79+
save("images/scalar-LTI-2")
80+
figure()
81+
plot(real(a), imag(a), "x", color="k")
82+
gca().set_aspect(1.0)
83+
xlim(-3,3); ylim(-3,3);
84+
plot([-3,3], [0,0], "k")
85+
plot([0, 0], [-3, 3], "k")
86+
xticks([-2,-1,0,1,2]); yticks([-2,-1,0,1,2])
87+
title(f"$a={a}$"); grid(True)
88+
tight_layout()
89+
save("images/scalar-LTI-2-poles")
90+
a = 1.0; x0 = 1.0
91+
figure()
92+
t = linspace(0.0, 3.0, 1000)
93+
plot(t, exp(a*t)*x0, "k")
94+
xlabel("$t$"); ylabel("$x(t)$"); title(f"$a={a}$")
95+
grid(); axis([0.0, 2.0, 0.0, 10.0])
96+
tight_layout()
97+
save("images/scalar-LTI-1")
98+
figure()
99+
plot(real(a), imag(a), "x", color="k")
100+
gca().set_aspect(1.0)
101+
xlim(-3,3); ylim(-3,3);
102+
plot([-3,3], [0,0], "k")
103+
plot([0, 0], [-3, 3], "k")
104+
xticks([-2,-1,0,1,2]); yticks([-2,-1,0,1,2])
105+
title(f"$a={a}$"); grid(True)
106+
tight_layout()
107+
save("images/scalar-LTI-1-poles")
108+
a = 0.0; x0 = 1.0
109+
figure()
110+
t = linspace(0.0, 3.0, 1000)
111+
plot(t, exp(a*t)*x0, "k")
112+
xlabel("$t$"); ylabel("$x(t)$"); title(f"$a={a}$")
113+
grid(); axis([0.0, 2.0, 0.0, 10.0])
114+
tight_layout()
115+
save("images/scalar-LTI-0")
116+
figure()
117+
plot(real(a), imag(a), "x", color="k")
118+
gca().set_aspect(1.0)
119+
xlim(-3,3); ylim(-3,3);
120+
plot([-3,3], [0,0], "k")
121+
plot([0, 0], [-3, 3], "k")
122+
xticks([-2,-1,0,1,2]); yticks([-2,-1,0,1,2])
123+
title(f"$a={a}$"); grid(True)
124+
tight_layout()
125+
save("images/scalar-LTI-0-poles")
126+
a = -1.0; x0 = 1.0
127+
figure()
128+
t = linspace(0.0, 3.0, 1000)
129+
plot(t, exp(a*t)*x0, "k")
130+
xlabel("$t$"); ylabel("$x(t)$"); title(f"$a={a}$")
131+
grid(); axis([0.0, 2.0, 0.0, 10.0])
132+
tight_layout()
133+
save("images/scalar-LTI-m1")
134+
figure()
135+
plot(real(a), imag(a), "x", color="k")
136+
gca().set_aspect(1.0)
137+
xlim(-3,3); ylim(-3,3);
138+
plot([-3,3], [0,0], "k")
139+
plot([0, 0], [-3, 3], "k")
140+
xticks([-2,-1,0,1,2]); yticks([-2,-1,0,1,2])
141+
title(f"$a={a}$"); grid(True)
142+
tight_layout()
143+
save("images/scalar-LTI-m1-poles")
144+
a = -2.0; x0 = 1.0
145+
figure()
146+
t = linspace(0.0, 3.0, 1000)
147+
plot(t, exp(a*t)*x0, "k")
148+
xlabel("$t$"); ylabel("$x(t)$"); title(f"$a={a}$")
149+
grid(); axis([0.0, 2.0, 0.0, 10.0])
150+
tight_layout()
151+
save("images/scalar-LTI-m2")
152+
figure()
153+
plot(real(a), imag(a), "x", color="k")
96154
gca().set_aspect(1.0)
97-
quiver(*Q(f, x1, x2), color="k")
155+
xlim(-3,3); ylim(-3,3);
156+
plot([-3,3], [0,0], "k")
157+
plot([0, 0], [-3, 3], "k")
158+
xticks([-2,-1,0,1,2]); yticks([-2,-1,0,1,2])
159+
title(f"$a={a}$"); grid(True)
98160
tight_layout()
99-
save("images/discont")
100-
def sigma(x):
101-
return 1 / (1 + exp(-x))
161+
save("images/scalar-LTI-m2-poles")
162+
a1 = -1.0; a2 = 2.0; x10 = x20 = 1.0
102163
figure()
103-
x = linspace(-7.0, 7.0, 1000)
104-
plot(x, sigma(x), label="$y=\sigma(x)$")
164+
t = linspace(0.0, 3.0, 1000)
165+
x1 = exp(a1*t)*x10; x2 = exp(a2*t)*x20
166+
xn = sqrt(x1**2 + x2**2)
167+
plot(t, xn , "k")
168+
plot(t, x1, "k--")
169+
plot(t, x2 , "k--")
170+
xlabel("$t$"); ylabel("$\|x(t)\|$"); title(f"$a_1={a1}, \; a_2={a2}$")
171+
grid(); axis([0.0, 2.0, 0.0, 10.0])
172+
tight_layout()
173+
save("images/scalar-LTI-m1p2")
174+
figure()
175+
plot(real(a1), imag(a1), "x", color="k")
176+
plot(real(a2), imag(a2), "x", color="k")
177+
gca().set_aspect(1.0)
178+
xlim(-3,3); ylim(-3,3);
179+
plot([-3,3], [0,0], "k")
180+
plot([0, 0], [-3, 3], "k")
181+
xticks([-2,-1,0,1,2]); yticks([-2,-1,0,1,2])
182+
title(f"$a_1={a1}, \; a_2={a2}$")
105183
grid(True)
106-
xlim(-5, 5)
107-
xticks([-5.0, 0.0, 5.0])
108-
yticks([0.0, 0.5, 1.0])
109-
xlabel("$x$")
110-
ylabel("$y$")
111-
legend()
112-
pp.gcf().subplots_adjust(bottom=0.2)
113-
save("images/sigmoid")
114-
alpha = 2 / 3; beta = 4 / 3; delta = gamma = 1.0
115-
116-
def fun(t, y):
117-
x, y = y
118-
u = alpha * x - beta * x * y
119-
v = delta * x * y - gamma * y
120-
return array([u, v])
121-
tf = 3.0
122-
result = solve_ivp(
123-
fun,
124-
t_span=(0.0, tf),
125-
y0=[1.5, 1.5],
126-
max_step=0.01)
127-
x, y = result["y"][0], result["y"][1]
128-
def display_streamplot():
129-
ax = gca()
130-
xr = yr = linspace(0.0, 2.0, 1000)
131-
def f(y):
132-
return fun(0, y)
133-
streamplot(*Q(f, xr, yr), color="grey")
134-
def display_reference_solution():
135-
for xy in zip(x, y):
136-
x_, y_ = xy
137-
gca().add_artist(Circle((x_, y_),
138-
0.2, color="#d3d3d3"))
139-
gca().add_artist(Circle((x[0], y[0]), 0.1,
140-
color="#808080"))
141-
plot(x, y, "k")
142-
def display_alternate_solution():
143-
result = solve_ivp(fun,
144-
t_span=[0.0, tf],
145-
y0=[1.5, 1.575],
146-
max_step=0.01)
147-
x, y = result["y"][0], result["y"][1]
148-
plot(x, y, "k--")
149-
figure()
150-
display_streamplot()
151-
display_reference_solution()
152-
display_alternate_solution()
153-
axis([0,2,0,2]); axis("square")
154-
save("images/continuity")
155-
def fun(t, y):
156-
x = y[0]
157-
dx = sqrt(abs(y))
158-
return [dx]
159-
tspan = [0.0, 3.0]
160-
t = linspace(tspan[0], tspan[1], 1000)
161-
figure()
162-
for x0 in [0.1, 0.01, 0.001, 0.0001, 0.0]:
163-
r = solve_ivp(fun, tspan, [x0],
164-
dense_output=True)
165-
plot(t, r["sol"](t)[0],
166-
label=f"$x_0 = {x0}$")
167-
xlabel("$t$"); ylabel("$x(t)$")
168-
legend()
169-
pp.gcf().subplots_adjust(bottom=0.2)
170-
save("images/eps")
184+
tight_layout()
185+
save("images/scalar-LTI-m1p2-poles")
186+
a1 = -1.0; a2 = -2.0; x10 = x20 = 1.0
187+
figure()
188+
t = linspace(0.0, 3.0, 1000)
189+
x1 = exp(a1*t)*x10; x2 = exp(a2*t)*x20
190+
xn = sqrt(x1**2 + x2**2)
191+
plot(t, xn , "k")
192+
plot(t, x1, "k--")
193+
plot(t, x2 , "k--")
194+
xlabel("$t$"); ylabel("$\|x(t)\|$"); title(f"$a_1={a1}, \; a_2={a2}$")
195+
grid(); axis([0.0, 2.0, 0.0, 10.0])
196+
tight_layout()
197+
save("images/scalar-LTI-m1m2")
198+
figure()
199+
plot(real(a1), imag(a1), "x", color="k")
200+
plot(real(a2), imag(a2), "x", color="k")
201+
gca().set_aspect(1.0)
202+
xlim(-3,3); ylim(-3,3);
203+
plot([-3,3], [0,0], "k")
204+
plot([0, 0], [-3, 3], "k")
205+
xticks([-2,-1,0,1,2]); yticks([-2,-1,0,1,2])
206+
title(f"$a_1={a1}, \; a_2={a2}$")
207+
grid(True)
208+
tight_layout()
209+
save("images/scalar-LTI-m1m2-poles")
210+
a = 1.0j; x0=1.0
211+
figure()
212+
t = linspace(0.0, 20.0, 1000)
213+
plot(t, real(exp(a*t)*x0), label="$\Re(x(t))$")
214+
plot(t, imag(exp(a*t)*x0), label="$\mathrm{Im}(x(t))$")
215+
xlabel("$t$")
216+
legend(); grid()
217+
tight_layout()
218+
save("images/scalar-LTI-alt-1")
219+
fig = figure()
220+
ax = fig.add_subplot(111, projection="3d")
221+
zticks = ax.set_zticks
222+
ax.plot(t, real(exp(a*t)*x0), imag(exp(a*t)*x0))
223+
xticks([0.0, 20.0]); yticks([]); zticks([])
224+
ax.set_xlabel("$t$")
225+
ax.set_ylabel("$\Re(x(t))$")
226+
ax.set_zlabel("$\mathrm{Im}(x(t))$")
227+
tight_layout()
228+
save("images/scalar-LTI-3d")
229+
figure()
230+
plot(real(a), imag(a), "x", color="k")
231+
gca().set_aspect(1.0)
232+
xlim(-3,3); ylim(-3,3);
233+
plot([-3,3], [0,0], "k")
234+
plot([0, 0], [-3, 3], "k")
235+
xticks([-2,-1,0,1,2]); yticks([-2,-1,0,1,2])
236+
title(f"$a={a}$"); grid(True)
237+
tight_layout()
238+
save("images/scalar-LTI-1j-poles")
239+
a = -0.5 + 1.0j; x0=1.0
240+
figure()
241+
t = linspace(0.0, 20.0, 1000)
242+
plot(t, real(exp(a*t)*x0), label="$\Re(x(t))$")
243+
plot(t, imag(exp(a*t)*x0), label="$\mathrm{Im}(x(t))$")
244+
xlabel("$t$")
245+
legend(); grid()
246+
tight_layout()
247+
save("images/scalar-LTI-alt-2")
248+
fig = figure()
249+
ax = fig.add_subplot(111, projection="3d")
250+
zticks = ax.set_zticks
251+
ax.plot(t, real(exp(a*t)*x0), imag(exp(a*t)*x0))
252+
xticks([0.0, 20.0]); yticks([]); zticks([])
253+
ax.set_xlabel("$t$")
254+
ax.set_ylabel("$\Re(x(t))$")
255+
ax.set_zlabel("$\mathrm{Im}(x(t))$")
256+
tight_layout()
257+
save("images/scalar-LTI-3d-2")
258+
figure()
259+
plot(real(a), imag(a), "x", color="k")
260+
gca().set_aspect(1.0)
261+
xlim(-3,3); ylim(-3,3);
262+
plot([-3,3], [0,0], "k")
263+
plot([0, 0], [-3, 3], "k")
264+
xticks([-2,-1,0,1,2]); yticks([-2,-1,0,1,2])
265+
title(f"$a={a}$")
266+
grid(True)
267+
tight_layout()
268+
save("images/scalar-LTI-m11j-poles")

‎0-1-Introduction.html‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@ <h2 data-background-color="None">🧭 Examples</h2>
131131
data-background-color="None"></h2>
132132
<h3 style="background-color:#ffffff90"
133133
id="mechanical-systems">Mechanical Systems</h3>
134-
<h3 style="background-color:#ffffff90"
134+
<h6 style="background-color:#ffffff90"
135135
id="photo-by-enginakyurt-on-unsplash">Photo by <a
136136
href="https://unsplash.com/@enginakyurt?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">enginakyurt</a>
137137
on <a
138-
href="https://unsplash.com/s/photos/pendulum?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></h3>
138+
href="https://unsplash.com/s/photos/pendulum?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></h6>
139139
</section>
140140
<section id="section-1" class="slide level2 display"
141141
data-background="images/static/jeremy-cai-B8UTPKlHNyw-unsplash.jpg"
@@ -157,7 +157,8 @@ <h2 data-background-color="None">🧭 Examples</h2>
157157
<h2 class="display"
158158
data-background="images/static/Forrester-World-Model.png"
159159
data-background-color="None"></h2>
160-
<h3 id="world-dynamics-forrester">World Dynamics (Forrester)</h3>
160+
<h3 style="background-color:#f0f0f0ff"
161+
id="world-dynamics-forrester">World Dynamics (Forrester)</h3>
161162
</section>
162163
<section id="section-3" class="slide level2 display"
163164
data-background="images/static/daniel-schludi-mAGZNECMcUg-unsplash.jpg"
@@ -235,6 +236,7 @@ <h2 data-background-color="None">Manufacturing</h2>
235236
href="https://unsplash.com/es/@raymondo600?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Ray
236237
Harrington</a> on <a
237238
href="https://unsplash.com/s/photos/eurofighter-typhoon?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></h4>
239+
<h4 style="margin-bottom:80vh" id="section-6"></h4>
238240
</section>
239241
<section class="slide level2" data-background-color="None">
240242
<h2 data-background-color="None"></h2>
@@ -278,7 +280,7 @@ <h2 data-background-color="None">Learn More</h2>
278280
Typhoon Photos</a></p></li>
279281
</ul>
280282
</section>
281-
<section id="section-6" class="slide level2 display"
283+
<section id="section-7" class="slide level2 display"
282284
data-background="images/justin-hu-oSyF_-CfXxA-unsplash.jpg"
283285
data-background-color="None">
284286
<h2 class="display"
@@ -291,6 +293,7 @@ <h3 style="background-color:#ffffff90" id="boeing-737-max">Boeing 737
291293
href="https://unsplash.com/@phanto_sea?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Justin
292294
Hu</a> on <a
293295
href="https://unsplash.com/s/photos/boeing-737-max?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></h4>
296+
<h4 style="margin-bottom:80vh" id="section-8"></h4>
294297
</section>
295298
<section id="boeing-737-max-1" class="slide level2"
296299
data-background-color="None">

‎0-1-Introduction.ipynb‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
{
7979
"cell_type": "markdown",
8080
"metadata": {},
81-
"source": "### Photo by [enginakyurt](https://unsplash.com/@enginakyurt?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/pendulum?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)\n"
81+
"source": "###### Photo by [enginakyurt](https://unsplash.com/@enginakyurt?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/pendulum?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)\n"
8282
},
8383
{
8484
"cell_type": "markdown",
@@ -212,6 +212,11 @@
212212
"metadata": {},
213213
"source": "#### Photo by [Ray Harrington](https://unsplash.com/es/@raymondo600?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/eurofighter-typhoon?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)\n"
214214
},
215+
{
216+
"cell_type": "markdown",
217+
"metadata": {},
218+
"source": "#### \n"
219+
},
215220
{
216221
"cell_type": "markdown",
217222
"metadata": {},
@@ -282,6 +287,11 @@
282287
"metadata": {},
283288
"source": "#### Photo by [Justin Hu](https://unsplash.com/@phanto_sea?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/boeing-737-max?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)\n"
284289
},
290+
{
291+
"cell_type": "markdown",
292+
"metadata": {},
293+
"source": "#### \n"
294+
},
285295
{
286296
"cell_type": "markdown",
287297
"metadata": {},

0 commit comments

Comments
 (0)