Skip to content

Commit 64145a0

Browse files
committed
Post-lecture fixes
1 parent 70466cd commit 64145a0

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

src/04_Nonlinear_equations.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ where we used $f(x_\ast) = 0$.
11351135
We summarise
11361136
11371137
!!! info "Theorem 4: Convergence of Newton's method"
1138-
Let $f$ be a $C^2$ function and $x_\ast$ a root of $f$.
1138+
Let $f$ be a twice differentiable ($C^2$) function and $x_\ast$ a root of $f$.
11391139
If $f'(x_\ast) \neq 0$ and $f''(x_\ast) \neq 0$, then
11401140
Newton's method converges quadratically for every $x^{(0)}$
11411141
sufficiently close to $x_\ast$. The rate is

src/05_Interpolation.jl

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ end;
155155
# ╔═╡ 8be732e2-927b-4c56-8cab-9079c7598e86
156156
scatter(temperature, rate; label="data", xlabel="temperature", ylabel="rate")
157157

158-
# ╔═╡ b73ea6d2-5751-4926-a28d-418deb60da2a
158+
# ╔═╡ b37a4828-c65e-44be-a20c-787a7309fb21
159159
md"""
160160
### Monomial basis
161161
@@ -164,17 +164,28 @@ given $n+1$ data points $(x_1, y_1)$ up to $(x_{n+1}, y_{n+1})$
164164
we want to find a $n$-th degree polynomial
165165
```math
166166
\tag{3}
167-
p_n(x) = \sum_{j=0}^n c_j x^j,
167+
p_n(x) = \sum_{\textcolor{red}{j=0}}^n c_j x^j,
168168
```
169169
which is an interpolating function,
170170
i.e. satisfies $p_n(x_i) = y_i$
171171
for all $i = 1, \ldots, n + 1$.
172-
The fundamential theorem of algebra
173-
ensures that such a polynomial of degree $n$,
172+
Fundamental results from algebra
173+
ensure that such a polynomial of degree $n$,
174174
which goes through all $n+1$ data points can always be found.
175175
Moreover this polynomial (thus its coefficients $c_j$)
176176
is uniquely defined by the data.
177+
"""
178+
179+
# ╔═╡ 20a76496-f1a0-4690-8522-a13cf4656e6d
180+
md"""
181+
!!! danger "Indexing conventions: Starting at $0$ or $1$"
182+
Note that in the definition of the polynomial (Equation (3)) the sum starts now from $j=0$ whereas in equation (1) it started from $j=1$.
183+
184+
When discussing numerical methods (such as here interpolations) it is sometimes more convenient to start indexing from $0$ and sometimes to start from $1$. Please be aware of this and read sums in this notebook carefully. Occasionally we use color to highlight the start of a sum explicitly.
185+
"""
177186

187+
# ╔═╡ 17e97fad-6290-4ef6-9124-c9a816346564
188+
md"""
178189
To find this polynomial a
179190
natural idea is thus to employ the monomials $1, x, x^2, \ldots x^n$
180191
directly as the basis for our interpolation:
@@ -192,15 +203,15 @@ leads to the linear system in the $n+1$ unknowns $c_0, c_1, \ldots, c_n$
192203
1 & x_1 & \ldots & x_1^n \\
193204
1 & x_2 & \ldots & x_2^n \\
194205
\vdots \\
195-
1 &x_n & \ldots & x_n^n \\
206+
1 &x_{n+1} & \ldots & x_{n+1}^n \\
196207
\end{array}\right)}_{= \mathbf{V}}
197208
\,
198209
\underbrace{
199-
\left(\begin{array}{c} c_1\\c_2\\\vdots\\c_n\end{array}\right)
210+
\left(\begin{array}{c} c_0\\c_1\\\vdots\\c_n\end{array}\right)
200211
}_\textbf{c}
201212
=
202213
\underbrace{
203-
\left(\begin{array}{c} y_1\\y_2\\\vdots\\y_n\end{array}\right)
214+
\left(\begin{array}{c} y_1\\y_2\\\vdots\\y_{n+1}\end{array}\right)
204215
}_\textbf{y},
205216
```
206217
where the $(n+1)\times(n+1)$ matrix $\mathbf{V}$ is called the **Vandermonde matrix**. Assuming the data points $(x_i, y_i)$ to be distinct, we know that only one interpolating polynomial exists. The linear system (4) has therefore exactly one solution and the matrix $V$ is thus always invertible, $\det(\textbf{V}) \neq 0$.
@@ -232,6 +243,9 @@ thus a polynomial degree of $(n_data_monomial - 1)
232243

233244
# ╔═╡ ac94e6f2-ebf0-4ee8-b21f-d9d20c656dd5
234245
begin
246+
# We wish to find an interpolating polynomial for the mapping
247+
# temperature to reaction rate.
248+
235249
x = temperature[1:n_data_monomial]
236250
y = rate[1:n_data_monomial]
237251

@@ -356,7 +370,7 @@ In particular the nodal property (6) makes it extremely convenient to use a Lagr
356370
is given by
357371
```math
358372
\tag{7}
359-
p_n(x) = \sum_{i=1}^{n+1} y_i L_i(x)
373+
p_n(x) = \sum_{\textcolor{red}{i=1}}^{n+1} y_i L_i(x)
360374
```
361375
362376
> **Proof:**
@@ -1069,7 +1083,7 @@ therefore
10691083
```
10701084
"""
10711085

1072-
# ╔═╡ 2c4256d0-bcd7-42b4-ad85-aedea7063aae
1086+
# ╔═╡ 34ce3c0d-0769-44a6-a80f-155581f129a7
10731087
md"""
10741088
We summarise in a Theorem:
10751089
@@ -1092,7 +1106,10 @@ However, we obtain that the interpolation error
10921106
goes as $O(h^2)$ as $n\to \infty$.
10931107
This is an example of **quadratic convergence**.
10941108
More generally we define
1109+
"""
10951110

1111+
# ╔═╡ a30c9fe0-1467-4ba9-86b3-3ea044798851
1112+
md"""
10961113
!!! info "Definition: Algebraic convergence"
10971114
If an approximation has an error with asymptotic
10981115
behaviour $O(h^m)$ as $h\to0$ with $m$ integer
@@ -3198,7 +3215,9 @@ version = "1.4.1+2"
31983215
# ╠═9e933ebe-1805-46fa-9e0a-a64c03a71c5c
31993216
# ╠═f9f4ddec-fd3d-4624-ace4-f316b9cfa1e4
32003217
# ╠═8be732e2-927b-4c56-8cab-9079c7598e86
3201-
# ╟─b73ea6d2-5751-4926-a28d-418deb60da2a
3218+
# ╟─b37a4828-c65e-44be-a20c-787a7309fb21
3219+
# ╟─20a76496-f1a0-4690-8522-a13cf4656e6d
3220+
# ╟─17e97fad-6290-4ef6-9124-c9a816346564
32023221
# ╟─2dfef7e4-23ca-49fa-bb95-f9c7219cdf22
32033222
# ╟─2a088353-0b78-45a8-b354-6ced35b1c7f9
32043223
# ╠═ac94e6f2-ebf0-4ee8-b21f-d9d20c656dd5
@@ -3252,7 +3271,8 @@ version = "1.4.1+2"
32523271
# ╠═f6055e59-1ddd-4148-8a85-95f4501e3f9f
32533272
# ╟─193131ad-e016-4f2a-b1cb-a544bc497c95
32543273
# ╟─d0a8b733-af40-41f7-a900-bf0ec6b17ed3
3255-
# ╟─2c4256d0-bcd7-42b4-ad85-aedea7063aae
3274+
# ╟─34ce3c0d-0769-44a6-a80f-155581f129a7
3275+
# ╟─a30c9fe0-1467-4ba9-86b3-3ea044798851
32563276
# ╟─7e317807-d3ee-4197-91fb-9fc03f7297e8
32573277
# ╠═eb96f944-74ac-4cc0-9322-825df83f34f2
32583278
# ╟─9d175a21-71e0-4df8-bbd5-f4eedbeb1384

0 commit comments

Comments
 (0)