Skip to content

Commit 3703575

Browse files
authoredApr 28, 2024··
Merge pull request #430 from QuantEcon/scalar_dynamic-suggestion
[scalar_dynamic] Update editorial suggestions
2 parents a6e263f + 516c2af commit 3703575

File tree

2 files changed

+56
-54
lines changed

2 files changed

+56
-54
lines changed
 

‎lectures/_toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ parts:
4242
- caption: Nonlinear Dynamics
4343
numbered: true
4444
chapters:
45-
- file: solow
4645
- file: scalar_dynam
46+
- file: solow
4747
- file: cobweb
4848
- file: olg
4949
- file: commod_price

‎lectures/scalar_dynam.md

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,31 @@ kernelspec:
2020
(scalar_dynam)=
2121
# Dynamics in One Dimension
2222

23-
```{admonition} Migrated lecture
24-
:class: warning
25-
26-
This lecture has moved from our [Intermediate Quantitative Economics with Python](https://python.quantecon.org/intro.html) lecture series and is now a part of [A First Course in Quantitative Economics](https://intro.quantecon.org/intro.html).
27-
```
2823

2924
## Overview
3025

31-
In this lecture we give a quick introduction to discrete time dynamics in one dimension.
26+
In economics many variables depend on their past values
27+
28+
For example, it seems reasonable to believe that inflation last year with affects inflation this year.
29+
30+
(Perhaps high inflation last year will lead people to demand higher wages to
31+
compensate, which will feed into higher prices this year.)
32+
33+
Letting $\pi_t$ be inflation this year and $\pi_{t-1}$ be inflation last year, we
34+
can write this relationship in a general form as
3235

33-
* In one-dimensional models, the state of the system is described by a single variable.
34-
* The variable is a number (that is, a point in $\mathbb R$).
36+
$$ \pi_t = f(\pi_{t-1}) $$
3537

36-
While most quantitative models have two or more state variables, the
37-
one-dimensional setting is a good place to learn the foundations of dynamics
38-
and understand key concepts.
38+
where $f$ is some function describing the relationship between the variables.
39+
40+
This equation is an example of one-dimensional discrete time dynamic system.
41+
42+
In this lecture we cover the foundations of one-dimensional discrete time
43+
dynamics.
44+
45+
(While most quantitative models have two or more state variables, the
46+
one-dimensional setting is a good place to learn foundations
47+
and understand key concepts.)
3948

4049
Let's start with some standard imports:
4150

@@ -44,6 +53,7 @@ import matplotlib.pyplot as plt
4453
import numpy as np
4554
```
4655

56+
4757
## Some definitions
4858

4959
This section sets out the objects of interest and the kinds of properties we study.
@@ -78,7 +88,7 @@ $$
7888
f^2(x) = \sqrt{\sqrt{x}} = x^{1/4}
7989
$$
8090

81-
Similarly, if $n$ is an integer, then $f^n$ is $n$ compositions of $f$ with
91+
Similarly, if $n$ is a positive integer, then $f^n$ is $n$ compositions of $f$ with
8292
itself.
8393

8494
In the example above, $f^n(x) = x^{1/(2^n)}$.
@@ -103,10 +113,6 @@ form a dynamic system, since $g(1) = 2$.
103113

104114
* $g$ does not always send points in $S$ back into $S$.
105115

106-
107-
108-
### Dynamic systems
109-
110116
We care about dynamic systems because we can use them to study dynamics!
111117

112118
Given a dynamic system consisting of set $S$ and function $g$, we can create
@@ -137,7 +143,7 @@ Recalling that $g^n$ is the $n$ compositions of $g$ with itself,
137143
we can write the trajectory more simply as
138144

139145
$$
140-
x_t = g^t(x_0) \quad \text{ for } t \geq 0.
146+
x_t = g^t(x_0) \quad \text{ for } t = 0, 1, 2, \ldots
141147
$$
142148

143149
In all of what follows, we are going to assume that $S$ is a subset of
@@ -149,10 +155,10 @@ Equation {eq}`sdsod` is sometimes called a **first order difference equation**
149155

150156

151157

152-
### Example: A Linear Model
158+
### Example: a linear model
153159

154160
One simple example of a dynamic system is when $S=\mathbb R$ and $g(x)=ax +
155-
b$, where $a, b$ are fixed constants.
161+
b$, where $a, b$ are constants (sometimes called ``parameters'').
156162

157163
This leads to the **linear difference equation**
158164

@@ -174,14 +180,14 @@ a^2 x_0 + a b + b, \quad \text{etc.}
174180
```
175181

176182
Continuing in this way, and using our knowledge of {doc}`geometric series
177-
<geom_series>`, we find that, for any $t \geq 0$,
183+
<geom_series>`, we find that, for any $t = 0, 1, 2, \ldots$,
178184

179185
```{math}
180186
:label: sdslinmod
181187
x_t = a^t x_0 + b \frac{1 - a^t}{1 - a}
182188
```
183189

184-
We have an exact expression for $x_t$ for all $t$ and hence a full
190+
We have an exact expression for $x_t$ for all non-negative integer $t$ and hence a full
185191
understanding of the dynamics.
186192

187193
Notice in particular that $|a| < 1$, then, by {eq}`sdslinmod`, we have
@@ -192,32 +198,32 @@ Notice in particular that $|a| < 1$, then, by {eq}`sdslinmod`, we have
192198
x_t \to \frac{b}{1 - a} \text{ as } t \to \infty
193199
```
194200

195-
regardless of $x_0$
201+
regardless of $x_0$.
196202

197203
This is an example of what is called global stability, a topic we return to
198204
below.
199205

200206

201207

202208

203-
### Example: A Nonlinear Model
209+
### Example: a nonlinear model
204210

205211
In the linear example above, we obtained an exact analytical expression for
206-
$x_t$ in terms of arbitrary $t$ and $x_0$.
212+
$x_t$ in terms of arbitrary non-negative integer $t$ and $x_0$.
207213

208214
This made analysis of dynamics very easy.
209215

210216
When models are nonlinear, however, the situation can be quite different.
211217

212-
For example, recall how we [previously studied](https://python-programming.quantecon.org/python_oop.html#example-the-solow-growth-model) the law of motion for the Solow growth model, a simplified version of which is
218+
For example, in a later lecture {doc}`solow`, we will study the Solow-Swan growth model, which has dynamics
213219

214220
```{math}
215221
:label: solow_lom2
216222
217223
k_{t+1} = s z k_t^{\alpha} + (1 - \delta) k_t
218224
```
219225

220-
Here $k$ is capital stock and $s, z, \alpha, \delta$ are positive
226+
Here $k$ is the per capita capital stock and $s, z, \alpha, \delta$ are positive
221227
parameters with $0 < \alpha, \delta < 1$.
222228

223229
If you try to iterate like we did in {eq}`sdslinmodpath`, you will find that
@@ -232,7 +238,7 @@ Analyzing the dynamics of this model requires a different method (see below).
232238

233239
## Stability
234240

235-
Consider a fixed dynamic system consisting of set $S \subset \mathbb R$ and
241+
Consider a dynamic system consisting of set $S \subset \mathbb R$ and
236242
$g$ mapping $S$ to $S$.
237243

238244
(scalar-dynam:steady-state)=
@@ -247,9 +253,9 @@ $S$.
247253
For example, for the linear model $x_{t+1} = a x_t + b$, you can use the
248254
definition to check that
249255

250-
* $x^* := b/(1-a)$ is a steady state whenever $a \not= 1$.
256+
* $x^* := b/(1-a)$ is a steady state whenever $a \not= 1$,
251257
* if $a = 1$ and $b=0$, then every $x \in \mathbb R$ is a
252-
steady state.
258+
steady state,
253259
* if $a = 1$ and $b \not= 0$, then the linear model has no steady
254260
state in $\mathbb R$.
255261

@@ -304,13 +310,13 @@ There is no single way to tackle all nonlinear models.
304310
However, there is one technique for one-dimensional models that provides a
305311
great deal of intuition.
306312

307-
This is a graphical approach based on **45 degree diagrams**.
313+
This is a graphical approach based on **45-degree diagrams**.
308314

309-
Let's look at an example: the Solow model with dynamics given in {eq}`solow_lom2`.
315+
Let's look at an example: the Solow-Swan model with dynamics given in {eq}`solow_lom2`.
310316

311317
We begin with some plotting code that you can ignore at first reading.
312318

313-
The function of the code is to produce 45 degree diagrams and time series
319+
The function of the code is to produce 45-degree diagrams and time series
314320
plots.
315321

316322

@@ -341,6 +347,8 @@ def plot45(g, xmin, xmax, x0, num_arrows=6, var='x'):
341347
fig, ax = subplots()
342348
ax.set_xlim(xmin, xmax)
343349
ax.set_ylim(xmin, xmax)
350+
ax.set_xlabel(r'${}_t$'.format(var), fontsize=14)
351+
ax.set_ylabel(r'${}_{}$'.format(var, str('{t+1}')), fontsize=14)
344352
345353
hw = (xmax - xmin) * 0.01
346354
hl = 2 * hw
@@ -404,29 +412,23 @@ def ts_plot(g, xmin, xmax, x0, ts_length=6, var='x'):
404412
plt.show()
405413
```
406414

407-
Let's create a 45 degree diagram for the Solow model with a fixed set of
408-
parameters
409-
410-
```{code-cell} ipython
411-
A, s, alpha, delta = 2, 0.3, 0.3, 0.4
412-
```
413-
414-
Here's the update function corresponding to the model.
415+
Let's create a 45-degree diagram for the Solow-Swan model with a fixed set of
416+
parameters. Here's the update function corresponding to the model.
415417

416418
```{code-cell} ipython
417-
def g(k):
419+
def g(k, A = 2, s = 0.3, alpha = 0.3, delta = 0.4):
418420
return A * s * k**alpha + (1 - delta) * k
419421
```
420422

421-
Here is the 45 degree plot.
423+
Here is the 45-degree plot.
422424

423425
```{code-cell} ipython
424426
xmin, xmax = 0, 4 # Suitable plotting region.
425427
426428
plot45(g, xmin, xmax, 0, num_arrows=0)
427429
```
428430

429-
The plot shows the function $g$ and the 45 degree line.
431+
The plot shows the function $g$ and the 45-degree line.
430432

431433
Think of $k_t$ as a value on the horizontal axis.
432434

@@ -435,11 +437,11 @@ value on the vertical axis.
435437

436438
Clearly,
437439

438-
* If $g$ lies above the 45 degree line at this point, then we have $k_{t+1} > k_t$.
439-
* If $g$ lies below the 45 degree line at this point, then we have $k_{t+1} < k_t$.
440-
* If $g$ hits the 45 degree line at this point, then we have $k_{t+1} = k_t$, so $k_t$ is a steady state.
440+
* If $g$ lies above the 45-degree line at this point, then we have $k_{t+1} > k_t$.
441+
* If $g$ lies below the 45-degree line at this point, then we have $k_{t+1} < k_t$.
442+
* If $g$ hits the 45-degree line at this point, then we have $k_{t+1} = k_t$, so $k_t$ is a steady state.
441443

442-
For the Solow model, there are two steady states when $S = \mathbb R_+ =
444+
For the Solow-Swan model, there are two steady states when $S = \mathbb R_+ =
443445
[0, \infty)$.
444446

445447
* the origin $k=0$
@@ -453,7 +455,7 @@ $$
453455

454456
### Trajectories
455457

456-
By the preceding discussion, in regions where $g$ lies above the 45 degree line, we know that the trajectory is increasing.
458+
By the preceding discussion, in regions where $g$ lies above the 45-degree line, we know that the trajectory is increasing.
457459

458460
The next figure traces out a trajectory in such a region so we can see this more clearly.
459461

@@ -465,7 +467,7 @@ k0 = 0.25
465467
plot45(g, xmin, xmax, k0, num_arrows=5, var='k')
466468
```
467469

468-
We can plot the time series of capital corresponding to the figure above as
470+
We can plot the time series of per capita capital corresponding to the figure above as
469471
follows:
470472

471473
```{code-cell} ipython
@@ -478,7 +480,7 @@ Here's a somewhat longer view:
478480
ts_plot(g, xmin, xmax, k0, ts_length=20, var='k')
479481
```
480482

481-
When capital stock is higher than the unique positive steady state, we see that
483+
When per capita capital stock is higher than the unique positive steady state, we see that
482484
it declines:
483485

484486
```{code-cell} ipython
@@ -495,7 +497,7 @@ ts_plot(g, xmin, xmax, k0, var='k')
495497

496498
### Complex dynamics
497499

498-
The Solow model is nonlinear but still generates very regular dynamics.
500+
The Solow-Swan model is nonlinear but still generates very regular dynamics.
499501

500502
One model that generates irregular dynamics is the **quadratic map**
501503

@@ -504,7 +506,7 @@ g(x) = 4 x (1 - x),
504506
\qquad x \in [0, 1]
505507
$$
506508

507-
Let's have a look at the 45 degree diagram.
509+
Let's have a look at the 45-degree diagram.
508510

509511
```{code-cell} ipython
510512
xmin, xmax = 0, 1
@@ -551,7 +553,7 @@ Try to illustrate this graphically by looking at a range of initial conditions.
551553
What differences do you notice in the cases $a \in (-1, 0)$ and $a
552554
\in (0, 1)$?
553555
554-
Use $a=0.5$ and then $a=-0.5$ and study the trajectories
556+
Use $a=0.5$ and then $a=-0.5$ and study the trajectories.
555557
556558
Set $b=1$ throughout.
557559
```

0 commit comments

Comments
 (0)
Please sign in to comment.