Skip to content

Commit a200adf

Browse files
committed
Post-lecture fixes
1 parent 687cda6 commit a200adf

File tree

1 file changed

+44
-32
lines changed

1 file changed

+44
-32
lines changed

src/04_Nonlinear_equations.jl

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ we first need to **rewrite the non-linear equation** ${f}(\mathbf{x}) = \mathbf{
232232
```math
233233
{f}(\mathbf{x}_\ast) = 0 \qquad \Longleftrightarrow \qquad \mathbf{x}_\ast = {g}(\mathbf{x}_\ast).
234234
```
235-
On $\mathbf{g}$ we then apply fixed-point iteration.
235+
On ${g}$ we then apply fixed-point iteration.
236236
237237
We saw one example how to achieve this rewriting in the discussion
238238
of the "Intersecting circle and parabola" example in the [section above](#Root-finding-and-fixed-point-problems), where we first defined a root-finding problem and then two equivalent fixed-point problems for the same task.
@@ -355,7 +355,7 @@ See also the discussion in [Revision and preliminaries](https://teaching.matmat.
355355
Sometimes being fully precise in the big O notation will be too distracting. In this case we will use a generic "$O(\text{small})$" to remind ourselves that there are additional terms and we will specify in the surrounding text what this term stands for.
356356
"""
357357

358-
# ╔═╡ 01db98ec-daf2-4779-9f31-c3271039f44c
358+
# ╔═╡ 7ca9192e-e584-480f-8d20-ac8fe3e3d46d
359359
md"""
360360
Using (3), the fact that $g(x_\ast) = x_\ast$,
361361
and the key fixed-point iterations equation, $x^{(k+1)} = g(x^{(k)})$,
@@ -370,33 +370,48 @@ e^{(k+1)}
370370
```
371371
Taking moduli on both sides:
372372
```math
373+
\tag{$\ast$}
373374
|e^{(k+1)}| = |g'(x_\ast)| \ |e^{(k)}| + O(|e^{(k)}|^2)
374375
```
376+
A related relation also holds between the error in the $k$-th
377+
and $(k-1)$-st iteration, just by subtracting $1$ in the iteration
378+
count on both sides, i.e.
379+
```math
380+
|e^{(k)}| = |g'(x_\ast)| \ |e^{(k-1)}| + O(|e^{(k-1)}|^2).
381+
```
382+
Combining both expressions we obtain
383+
```math
384+
|e^{(k+1)}| = |g'(x_\ast)|^2 \ |e^{(k-1)}| + O(\text{small}),
385+
```
386+
where $O(\text{small})$ is a term that is at least quadratic in $|e^{(k)}|$ and at least quadratic in $|e^{(k-1)}|$.
375387
376-
We employ this relation now in a recursive argument.
377-
Assume we choose a good initial guess,
378-
then $x^{(0)}$ is close enough to $x_\ast$, such that $O((e^{(0)})^2)$
379-
is neglibile compared to $|g'(x_\ast)| \ |e^{(0)}|$.
380-
Similarly, provided that the iteration makes progress,
381-
$O((e^{(1)})^2)$ is in turn
382-
smaller than $|g'(x_\ast)| \ |e^{(1)}|$ and so forth.
383-
Therefore
388+
Continuing in a recursive fashion:
384389
```math
385390
\begin{aligned}
386391
|e^{(k+1)}| &= |g'(x_\ast)| \ |e^{(k)}| + O(\text{small}) \\
387392
&= |g'(x_\ast)|^2 \ |e^{(k-1)}| + O(\text{small}) \\
388393
&= \ldots \\
389-
&= |g'(x_\ast)|^{k+1} \ |e^{(0)}| + O(\text{small})
394+
&= |g'(x_\ast)|^{k+1} \ |e^{(0)}| + O(\text{small}),
390395
\end{aligned}
391396
```
392-
In other words as $k \to \infty$, i.e. the iteration progresses,
393-
$|e^{(k+1)}|$ approaches zero
394-
if $|g'(x_\ast)| < 1$.
397+
where the $O(\text{small})$ is at least quadratic in all errors $|e^{(k)}|$ to $|e^{(0)}|$.
398+
"""
399+
400+
# ╔═╡ 15c5b579-25f2-4d37-960b-031e80a7a1aa
401+
md"""
402+
From this we conclude:
403+
- If $|g'(x_\ast)| > 1$, then $|g'(x_\ast)|^k$ grows to infinity as the number of iteration $k$ grows, therefore the error $|e^{(k+1)}|$ has to grow: **the fixed-point iterations diverge.**
404+
- Furthermore if $|g'(x_\ast)| < 1$ and if the terms hidden in $O(\text{small})$ can be neglected, then $|e^{(k+1)}|$ is getting smaller and smaller as the number of iterations $k$ increases: **the fixed-point iterations converge**.
405+
- Now we ask under which conditions the terms in $O(\text{small})$ can be neglected. This is indeed the case if $|e^{(0)}|$ is sufficiently small, i.e. **if our starting point $x^{(0)}$ is sufficiently close to the fixed point $x_\ast$**.
406+
- To see this, assume $|g'(x_\ast)| < 1$. As a result $|e^{(1)}| < |g'(x_\ast)| \ |e^{(0)}| + O(|e^{(0)}|^2)$ by ($\ast$) for $k=1$. Therefore if $|e^{(0)}|$ is sufficiently small, then $|e^{(0)}|^2 = |x_\ast - x^{(0)}|^2$ is small compared to $|g'(x_\ast)| \ |e^{(0)}|$, meaning that the terms hidden in $O(|e^{(0)}|^2)$ can be neglected. As a result $|e^{(1)}|^2$ is even smaller than $|e^{(0)}|^2$, such that also the terms in $O(|e^{(1)}|^2)$ can be neglected and so forth. We conclude that all terms at least quadratic in the error term $|e^{(k)}|$ to $|e^{(0)}|$ can be neglected, i.e. that the entire set of terms $O(\text{small})$ is neglibile.
407+
- Note that for $|g'(x_\ast)| = 1$ our theory does not allow us to conclude neither convergence, nor divergence.
408+
409+
We summarise in a Theorem:
395410
"""
396411

397412
# ╔═╡ 9176b666-41f7-436e-b5ad-61b196a8b35b
398413
md"""
399-
!!! note "Theorem 1 (scalar version)"
414+
!!! note "Theorem 0 (scalar version of Theorem 1)"
400415
Let $g : \mathbb{R} \to \mathbb{R}$
401416
be a once differentiable function
402417
and $x_\ast \in \mathbb{R}$ be a fixed point of $g$.
@@ -414,7 +429,7 @@ We will generalise this theorem to the vector case in the following secition.
414429
md"""
415430
#### Higher dimensions
416431
417-
We now consider the generalisation of the above argument to the vector setting,
432+
We now consider the generalisation of the above argument to the multi-dimensional setting,
418433
i.e. finding a fixed-point $\mathbf{x}_\ast = {g}(\mathbf{x}_\ast) \in \mathbb{R}^n$ of a function ${g} : \mathbb{R}\to\mathbb{R}$.
419434
To make a similar argument to the scalar case, we need to consider again the Talyor expansion of ${g}(\mathbf{x}^{(k)}) = {g}(\mathbf{x}_\ast + \mathbf{e}^{(k)})$ around $\mathbf{x}_\ast$, where as before $\mathbf{e}^{(k)} = \mathbf{x}^{(k)} - \mathbf{x}_\ast$.
420435
@@ -450,9 +465,8 @@ is the collection of all partial derivatives of ${g}$ *evaluated at $\mathbf{x}$
450465
\end{array}\right).
451466
```
452467
See also the discussion on multi-dimensional Talyor approximations in [Revision and preliminaries](https://teaching.matmat.org/numerical-analysis/03_Preliminaries.html).
453-
454468
Note that the Jacobian (just like any derivative) is a function of an independent
455-
variable (here $\textbf{x}_\ast$).
469+
variable (here $\textbf{x}$).
456470
457471
Since the Jacobian very much plays the role of a generalised derivative
458472
of a multidimensional function ${g}$, we will sometimes also
@@ -547,7 +561,6 @@ The definition of the matrix norm implies in particular that
547561
# ╔═╡ 9c9719e3-ec6c-4bdc-b05b-ab4bd4119cb9
548562
md"""
549563
We now take vector norms on either side of (5) and make use of this last inequality to obtain to first order
550-
551564
```math
552565
\|\mathbf{e}^{(k+1)}\| \leq \left\| \mathbf{J}_{g}(\mathbf{x}_\ast) \right\| \, \left\| \mathbf{e}^{(k)} \right\| + O(\text{small})
553566
```
@@ -556,13 +569,15 @@ Under the assumption that our initial guess $\mathbf{x}^{(0)}$ is sufficiently c
556569
to $\mathbf{x}_\ast$ we can again follow a recursive argument to obtain
557570
```math
558571
\begin{aligned}
559-
\|\mathbf{e}^{(k+1)}\| &= \left\| \mathbf{J}_{g}(\mathbf{x}_\ast) \right\|^{k+1} \ \|\mathbf{e}^{(0)}\| + O(\text{small})
572+
\|\mathbf{e}^{(k+1)}\| &\leq \left\| \mathbf{J}_{g}(\mathbf{x}_\ast) \right\|^{k+1} \ \|\mathbf{e}^{(0)}\| + O(\text{small})
560573
\end{aligned}
561574
```
562575
where $O(\text{small})$ is a small term that we do not make more precise for simplicity.
563576
564-
We are again faced with the conclusion that as $k \to \infty$, i.e. the iteration progresses, that the error norm $\|\mathbf{e}^{(k+1)}\|$ approaches zero
565-
if $\left\| \mathbf{J}_{g}(\mathbf{x}_\ast) \right\| < 1$.
577+
Similar to the one-dimensional case we conclude:
578+
- If $\left\| \mathbf{J}_{g}(\mathbf{x}_\ast) \right\| < 1$ and the initial guess $\mathbf{x}^{(0)}$ is sufficiently close to the final fixed point $\mathbf{x}_\ast$, then as $k \to \infty$, i.e. as the iteration progresses, the error norm $\|\mathbf{e}^{(k+1)}\|$ approaches zero: **the fixed-point iterations converge**.
579+
580+
However, in contrast to the one-dimensional setting **we cannot conclude divergence** if $\left\| \mathbf{J}_{g}(\mathbf{x}_\ast) \right\| > 1$. This is because we only obtain an *inequality* relating $\|\mathbf{e}^{(k+1)}\|$ to $\|\mathbf{e}^{(0)}\|$, whereas in the one-dimensional case this equation was an equality.
566581
567582
The following theorem summarises our argument
568583
"""
@@ -722,7 +737,7 @@ In a given step $\mathbf{x}^{(k)}$ we have in general not yet achieved our goal,
722737
i.e. ${g}(\mathbf{x}^{(k)}) \neq \mathbf{x}^{(k)}$.
723738
An idea is thus to consider exactly the descrepancy
724739
```math
725-
\mathbf{r}^{(k)} = {g}(\mathbf{x}^{(k)}) - \mathbf{x}^{(k)},
740+
\mathbf{r}^{(k)} = {g}(\mathbf{x}^{(k)}) - \mathbf{x}^{(k)} = \mathbf{x}^{(k+1)} - \mathbf{x}^{(k)},
726741
```
727742
the so-called **residual**. A natural stopping criterion is thus
728743
"""
@@ -805,9 +820,6 @@ function fixed_point_iterations(g, xstart; tol=1e-6, maxiter=100)
805820
(; fixed_point=xᵏ, residual=rᵏ, n_iter=k, history_x, history_r)
806821
end
807822

808-
# ╔═╡ 685cf9f0-9869-49aa-b232-cc7009c2a484
809-
fixed_point_iterations(gC, [0.5, 0.5]; tol=1e-6, maxiter=100)
810-
811823
# ╔═╡ 54f314c1-d1cf-41f1-96e5-5aca90d82b95
812824
fixed_point_iterations_simple(gC, [0.4, 0.3]; tol=1e-14)
813825

@@ -821,14 +833,14 @@ md"""
821833
- To explain this, let us consider the **scalar case** $g : \mathbb{R} \to \mathbb{R}$.
822834
In this setting we can derive the **residual-error relationship** *(see derivation below)*
823835
```math
824-
\tag{5}
836+
\tag{6}
825837
|x^{(k)} - x_\ast| = \frac{1}{|1 - g'(\xi^{(k)})|} |r^{(k)}|.
826838
```
827839
for some $\xi^{(k)} \in [x_\ast, x^{(k)}]$.
828840
Note, that this is just a **conceptional expression** as determining
829841
$\xi^{(k)}$ is in general *as hard* as finding $x_\ast$.
830842
But it will be useful in some theoretical arguments.
831-
- For converging fiterations $x^{(k)} \to x_\ast$ as $k \to \infty$.
843+
- For converging iterations $x^{(k)} \to x_\ast$ as $k \to \infty$.
832844
Therefore the interval $[x_\ast, x^{(k)}]$ gets smaller and smaller,
833845
such that necessarily $\xi^{(k)} \to x_\ast$
834846
and $g'(\xi^{(k)}) \to g'(x_\ast)$ as $k \to \infty$.
@@ -1024,7 +1036,7 @@ md"""
10241036
#### Visual inspection: Residual ratio
10251037
10261038
One caveat with this analysis is that we cheated a little by assuming that we already *know* the solution. An alternative approach is to **build upon our
1027-
residual-error relationship**, i.e. for the scalar case (5)
1039+
residual-error relationship**, i.e. for the scalar case (6)
10281040
```math
10291041
|x^{(k)} - x_\ast| = \frac{1}{|1 - g'(\xi^{(k)})|} r^{(k)}.
10301042
```
@@ -1317,7 +1329,7 @@ md"""
13171329
= \frac{1}{q!} \left|g^{(q)}(x_\ast)\right|
13181330
```
13191331
1320-
Recall the residual-error relationship (5)
1332+
Recall the residual-error relationship (6)
13211333
```math
13221334
|x^{(k)} - x_\ast| = \frac{1}{|1 - g'(\xi^{(k)})|} r^{(k)}.
13231335
```
@@ -3081,7 +3093,8 @@ version = "1.13.0+0"
30813093
# ╟─e49a6345-827f-4dcb-b2b3-1c385a7efdf5
30823094
# ╟─5e21e4c5-5538-40cf-a955-837809f7c3c3
30833095
# ╟─05989b7d-e694-4860-9a8e-6e6cb52aea8b
3084-
# ╟─01db98ec-daf2-4779-9f31-c3271039f44c
3096+
# ╟─7ca9192e-e584-480f-8d20-ac8fe3e3d46d
3097+
# ╟─15c5b579-25f2-4d37-960b-031e80a7a1aa
30853098
# ╟─9176b666-41f7-436e-b5ad-61b196a8b35b
30863099
# ╟─511fcf1a-5ea8-4827-9d24-6a43e7dcccd6
30873100
# ╟─c7068f2e-7313-44bc-85a4-785f4d4adc60
@@ -3095,7 +3108,6 @@ version = "1.13.0+0"
30953108
# ╟─29931ae9-bcb7-4ec0-b397-a89c491d950e
30963109
# ╠═5409350b-4845-46e5-ac3a-f7342fc28d3d
30973110
# ╠═9d7ca2e1-41b0-4651-a734-31bf883cee37
3098-
# ╠═685cf9f0-9869-49aa-b232-cc7009c2a484
30993111
# ╟─fffd0bd2-7b66-4a21-8311-2965e974d88b
31003112
# ╠═50639d02-55d5-4fcb-8335-13fd7f6b7624
31013113
# ╠═da60beec-74e7-4b3f-aa09-27b806054896

0 commit comments

Comments
 (0)