Skip to content

Commit af31025

Browse files
authored
misc (#97)
1 parent 31c076a commit af31025

File tree

1 file changed

+139
-41
lines changed

1 file changed

+139
-41
lines changed

lectures/scalar_dynam.md

Lines changed: 139 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ kernelspec:
2525

2626
## Overview
2727

28-
In this lecture we give a quick introduction to discrete time dynamics in one
29-
dimension.
28+
In this lecture we give a quick introduction to discrete time dynamics in one dimension.
3029

31-
In one-dimensional models, the state of the system is described by a single variable.
30+
* In one-dimensional models, the state of the system is described by a single variable.
31+
* The variable is a number (that is, a point in $\mathbb R$).
3232

33-
Although most interesting dynamic models have two or more state variables, the
34-
one-dimensional setting is a good place to learn the foundations of dynamics and build
35-
intuition.
33+
While most quantitative models have two or more state variables, the
34+
one-dimensional setting is a good place to learn the foundations of dynamics
35+
and understand key concepts.
3636

3737
Let's start with some standard imports:
3838

@@ -47,51 +47,122 @@ import numpy as np
4747

4848
This section sets out the objects of interest and the kinds of properties we study.
4949

50-
### Difference Equations
50+
### Composition of Functions
5151

52-
A **time homogeneous first order difference equation** is an equation of the
53-
form
52+
For this lecture you should know the following.
53+
54+
If
55+
56+
* $g$ is a function from $A$ to $B$ and
57+
* $f$ is a function from $B$ to $C$,
58+
59+
then the **composition** $f \circ g$ of $f$ and $g$ is defined by
60+
61+
$$
62+
(f \circ g)(x) = f(g(x))
63+
$$
64+
65+
For example, if
66+
67+
* $A=B=C=\mathbb R$, the set of real numbers,
68+
* $g(x)=x^2$ and $f(x)=\sqrt{x}$, then $(f \circ g)(x) = \sqrt{x^2} = |x|$.
69+
70+
If $f$ is a function from $A$ to itself, then $f^2$ is the composition of $f$
71+
with itself.
72+
73+
For example, if $A = (0, \infty)$, the set of positive numbers, and $f(x) =
74+
\sqrt{x}$, then
75+
76+
$$
77+
f^2(x) = \sqrt{\sqrt{x}} = x^{1/4}
78+
$$
79+
80+
Similarly, if $n$ is an integer, then $f^n$ is $n$ compositions of $f$ with
81+
itself.
82+
83+
In the example above, $f^n(x) = x^{1/(2^n)}$.
84+
85+
86+
87+
### Dynamic Systems
88+
89+
A **(discrete time) dynamic system** is a set $S$ and a function $g$ that sends
90+
set $S$ back into to itself.
91+
92+
93+
Examples of dynamic systems include
94+
95+
* $S = (0, 1)$ and $g(x) = \sqrt{x}$
96+
* $S = (0, 1)$ and $g(x) = x^2$
97+
* $S = \mathbb Z$ (the integers) and $g(x) = 2 x$
98+
99+
100+
On the other hand, if $S = (-1, 1)$ and $g(x) = x+1$, then $S$ and $g$ do not
101+
form a dynamic system, since $g(1) = 2$.
102+
103+
* $g$ does not always send points in $S$ back into $S$.
104+
105+
106+
107+
### Dynamic Systems
108+
109+
We care about dynamic systems because we can use them to study dynamics!
110+
111+
Given a dynamic system consisting of set $S$ and function $g$, we can create
112+
a sequence $\{x_t\}$ of points in $S$ by setting
54113

55114
```{math}
56115
:label: sdsod
116+
x_{t+1} = g(x_t)
117+
\quad \text{ with }
118+
x_0 \text{ given}.
119+
```
57120

58-
x_{t+1} = g(x_t)
121+
This means that we choose some number $x_0$ in $S$ and then take
122+
123+
```{math}
124+
:label: sdstraj
125+
x_0, \quad
126+
x_1 = g(x_0), \quad
127+
x_2 = g(x_1) = g(g(x_0)), \quad \text{etc.}
59128
```
60129

61-
where $g$ is a function from some subset $S$ of $\mathbb R$ to itself.
130+
This sequence $\{x_t\}$ is called the **trajectory** of $x_0$ under $g$.
62131

63-
Here $S$ is called the **state space** and $x$ is called the **state variable**.
132+
In this setting, $S$ is called the **state space** and $x_t$ is called the
133+
**state variable**.
64134

65-
In the definition,
135+
Recalling that $g^n$ is the $n$ compositions of $g$ with itself,
136+
we can write the trajectory more simply as
66137

67-
* time homogeneity means that $g$ is the same at each time $t$
68-
* first order means dependence on only one lag (i.e., earlier states such as $x_{t-1}$ do not enter into {eq}`sdsod`).
138+
$$
139+
x_t = g^t(x_0) \quad \text{ for } t \geq 0.
140+
$$
69141

70-
If $x_0 \in S$ is given, then {eq}`sdsod` recursively defines the sequence
142+
In all of what follows, we are going to assume that $S$ is a subset of
143+
$\mathbb R$, the real numbers.
71144

72-
```{math}
73-
:label: sdstraj
145+
Equation {eq}`sdsod` is sometimes called a **first order difference equation**
74146

75-
x_0, \quad
76-
x_1 = g(x_0), \quad
77-
x_2 = g(x_1) = g(g(x_0)), \quad \text{etc.}
78-
```
147+
* first order means dependence on only one lag (i.e., earlier states such as $x_{t-1}$ do not enter into {eq}`sdsod`).
79148

80-
This sequence is called the **trajectory** of $x_0$ under $g$.
81149

82-
If we define $g^n$ to be $n$ compositions of $g$ with itself, then we can write the trajectory more simply as $x_t = g^t(x_0)$ for $t \geq 0$.
83150

84151
### Example: A Linear Model
85152

86-
One simple example is the **linear difference equation**
153+
One simple example of a dynamic system is when $S=\mathbb R$ and $g(x)=ax +
154+
b$, where $a, b$ are fixed constants.
155+
156+
This leads to the **linear difference equation**
87157

88158
$$
89-
x_{t+1} = a x_t + b, \qquad S = \mathbb R
159+
x_{t+1} = a x_t + b
160+
\quad \text{ with }
161+
x_0 \text{ given}.
90162
$$
91163

92-
where $a, b$ are fixed constants.
93164

94-
In this case, given $x_0$, the trajectory {eq}`sdstraj` is
165+
The trajectory of $x_0$ is
95166

96167
```{math}
97168
:label: sdslinmodpath
@@ -101,16 +172,14 @@ a x_0 + b, \quad
101172
a^2 x_0 + a b + b, \quad \text{etc.}
102173
```
103174

104-
Continuing in this way, and using our knowledge of {doc}`geometric series <geom_series>`, we find that, for any $t \geq 0$,
175+
Continuing in this way, and using our knowledge of {doc}`geometric series
176+
<geom_series>`, we find that, for any $t \geq 0$,
105177

106178
```{math}
107179
:label: sdslinmod
108-
109-
x_t = a^t x_0 + b \frac{1 - a^t}{1 - a}
180+
x_t = a^t x_0 + b \frac{1 - a^t}{1 - a}
110181
```
111182

112-
This is about all we need to know about the linear model.
113-
114183
We have an exact expression for $x_t$ for all $t$ and hence a full
115184
understanding of the dynamics.
116185

@@ -127,10 +196,13 @@ regardless of $x_0$
127196
This is an example of what is called global stability, a topic we return to
128197
below.
129198

199+
200+
201+
130202
### Example: A Nonlinear Model
131203

132-
In the linear example above, we obtained an exact analytical expression for $x_t$
133-
in terms of arbitrary $t$ and $x_0$.
204+
In the linear example above, we obtained an exact analytical expression for
205+
$x_t$ in terms of arbitrary $t$ and $x_0$.
134206

135207
This made analysis of dynamics very easy.
136208

@@ -152,9 +224,19 @@ the algebra gets messy quickly.
152224

153225
Analyzing the dynamics of this model requires a different method (see below).
154226

155-
### Stability
156227

157-
A **steady state** of the difference equation $x_{t+1} = g(x_t)$ is a
228+
229+
230+
231+
232+
## Stability
233+
234+
Consider a fixed dynamic system consisting of set $S \subset \mathbb R$ and
235+
$g$ mapping $S$ to $S$.
236+
237+
### Steady States
238+
239+
A **steady state** of this system is a
158240
point $x^*$ in $S$ such that $x^* = g(x^*)$.
159241

160242
In other words, $x^*$ is a **fixed point** of the function $g$ in
@@ -169,7 +251,11 @@ definition to check that
169251
* if $a = 1$ and $b \not= 0$, then the linear model has no steady
170252
state in $\mathbb R$.
171253

172-
A steady state $x^*$ of $x_{t+1} = g(x_t)$ is called
254+
255+
256+
### Global Stability
257+
258+
A steady state $x^*$ of the dynamic system is called
173259
**globally stable** if, for all $x_0 \in S$,
174260

175261
$$
@@ -184,7 +270,10 @@ For example, in the linear model $x_{t+1} = a x_t + b$ with $a
184270

185271
This follows directly from {eq}`sdslinmod`.
186272

187-
A steady state $x^*$ of $x_{t+1} = g(x_t)$ is called
273+
274+
### Local Stability
275+
276+
A steady state $x^*$ of the dynamic system is called
188277
**locally stable** if there exists an $\epsilon > 0$ such that
189278

190279
$$
@@ -197,6 +286,12 @@ Obviously every globally stable steady state is also locally stable.
197286

198287
We will see examples below where the converse is not true.
199288

289+
290+
291+
292+
293+
294+
200295
## Graphical Analysis
201296

202297
As we saw above, analyzing the dynamics for nonlinear models is nontrivial.
@@ -215,9 +310,12 @@ We begin with some plotting code that you can ignore at first reading.
215310
The function of the code is to produce 45 degree diagrams and time series
216311
plots.
217312

313+
314+
218315
```{code-cell} ipython
219316
---
220-
tags: [output_scroll]
317+
tags: [hide-input,
318+
output_scroll]
221319
---
222320
def subplots(fs):
223321
"Custom subplots with axes throught the origin"
@@ -516,4 +614,4 @@ and back again.
516614
In the current context, the series is said to exhibit **damped oscillations**.
517615

518616
```{solution-end}
519-
```
617+
```

0 commit comments

Comments
 (0)