Skip to content

Commit a065a5e

Browse files
committed
add section headers
1 parent cb270f2 commit a065a5e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

julia/chapter6.md

+7
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ using FundamentalsNumericalComputation
109109
FNC.init_format()
110110
```
111111

112+
### Section 6.1
112113
(demo-basics-first-julia)=
113114
``````{dropdown} Solving an IVP
114115
The `DifferentialEquations` package offers solvers for IVPs. Let's use it to define and solve an initial-value problem for $u'=\sin[(u+t)^2]$ over $t \in [0,4]$, such that $u(0)=-1$.
@@ -208,6 +209,7 @@ plot(t, u, l=:black, ribbon=(lower, upper),
208209
In this case the actual condition number is one, because the initial difference between solutions is the largest over all time. Hence the exponentially growing bound $e^{b-a}$ is a gross overestimate.
209210
``````
210211

212+
### Section 6.2
211213
(demo-euler-converge-julia)=
212214
``````{dropdown} Convergence of Euler's method
213215
We consider the IVP $u'=\sin[(u+t)^2]$ over $0\le t \le 4$, with $u(0)=-1$.
@@ -269,6 +271,7 @@ plot!(n, 0.05 * (n / n[1]) .^ (-1), l=:dash, label=L"O(n^{-1})")
269271
```
270272
``````
271273

274+
### Section 6.3
272275
(demo-systems-predator-julia)=
273276
``````{dropdown} Predator-prey model
274277
We encode the predator–prey equations via a function.
@@ -395,6 +398,7 @@ plot(sol, idxs=[1, 2], label=[L"\theta_1" L"\theta_2"],
395398
The coupling makes the pendulums swap energy back and forth.
396399
``````
397400

401+
### Section 6.4
398402
(demo-rk-converge-julia)=
399403
``````{dropdown} Convergence of Runge–Kutta methods
400404
We solve the IVP $u'=\sin[(u+t)^2]$ over $0\le t \le 4$, with $u(0)=-1$.
@@ -442,6 +446,7 @@ plot!(4n, 1e-10 * (n / n[end]) .^ (-4), l=:dash, label=L"O(n^{-4})")
442446
The fourth-order variant is more efficient in this problem over a wide range of accuracy.
443447
``````
444448

449+
### Section 6.5
445450
(demo-adapt-basic-julia)=
446451
``````{dropdown} Adaptive step size
447452
Let's run adaptive RK on $u'=e^{t-u\sin u}$.
@@ -501,6 +506,7 @@ annotate!(tf, 1e5, latexstring(@sprintf("t = %.6f ", tf)), :right)
501506
```
502507
``````
503508

509+
### Section 6.6
504510
(demo-implicit-ab4-julia)=
505511
``````{dropdown} Convergence of Adams–Bashforth
506512
We study the convergence of AB4 using the IVP $u'=\sin[(u+t)^2]$ over $0\le t \le 4$, with $u(0)=-1$. As usual, `solve` is called to give an accurate reference solution.
@@ -581,6 +587,7 @@ plt
581587
So AB4, which is supposed to be _more_ accurate than AM2, actually needs something like 8 times as many steps to get a reasonable-looking answer!
582588
``````
583589

590+
### Section 6.7
584591
(demo-zs-LIAF-julia)=
585592
``````{dropdown} Instability
586593
We'll measure the error at the time $t=1$.

python/chapter6.md

+6
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ title("Exponential convergence of solutions")
225225
In this case the actual condition number is one, because the initial difference between solutions is the largest over all time. Hence, the exponentially growing upper bound $e^{b-a}$ is a gross overestimate.
226226
``````
227227

228+
### Section 6.2
228229
(demo-euler-converge-python)=
229230
``````{dropdown} Convergence of Euler's method
230231
We consider the IVP $u'=\sin[(u+t)^2]$ over $0\le t \le 4$, with $u(0)=-1$.
@@ -285,6 +286,7 @@ legend()
285286
```
286287
``````
287288

289+
### Section 6.3
288290
(demo-systems-predator-python)=
289291
``````{dropdown} Predator-prey model
290292
We encode the predator–prey equations via a function.
@@ -390,6 +392,7 @@ title("Coupled pendulums");
390392
The coupling makes the pendulums swap energy back and forth.
391393
``````
392394

395+
### Section 6.4
393396
(demo-rk-converge-python)=
394397
``````{dropdown} Convergence of Runge–Kutta methods
395398
We solve the IVP $u'=\sin[(u+t)^2]$ over $0\le t \le 4$, with $u(0)=-1$. We start by getting a reference solution to validate against.
@@ -435,6 +438,7 @@ title("Convergence of RK methods");
435438
The fourth-order variant is more efficient in this problem over a wide range of accuracy.
436439
``````
437440

441+
### Section 6.5
438442
(demo-adapt-basic-python)=
439443
``````{dropdown} Adaptive step size
440444
Let's run adaptive RK on $u'=e^{t-u\sin u}$.
@@ -496,6 +500,7 @@ legend();
496500
```
497501
``````
498502

503+
### Section 6.6
499504
(demo-implicit-ab4-python)=
500505
``````{dropdown} Convergence of Adams–Bashforth
501506
We study the convergence of AB4 using the IVP $u'=\sin[(u+t)^2]$ over $0\le t \le 4$, with $u(0)=-1$. As usual, `solve_ivp` is called to give an accurate reference solution.
@@ -582,6 +587,7 @@ legend()
582587
So AB4, which is supposed to be _more_ accurate than AM2, actually needs something like 8 times as many steps to get a reasonable-looking answer!
583588
``````
584589

590+
### Section 6.7
585591
(demo-zs-LIAF-python)=
586592
``````{dropdown} Instability
587593
We'll measure the error at the time $t=1$.

0 commit comments

Comments
 (0)