Skip to content

Commit 38e6ed3

Browse files
committed
update based on comments
1 parent 52d7eff commit 38e6ed3

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

lectures/greek_square.md

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,20 @@ kernelspec:
1111
name: python3
1212
---
1313

14-
+++ {"user_expressions": []}
15-
1614
# Computing Square Roots
1715

1816

1917
## Introduction
2018

2119

22-
This lecture can be viewed as a sequel to this QuantEcon lecture {doc}`eigen_I`
20+
This lecture can be viewed as a sequel to {doc}`eigen_I`
2321

2422
It provides an example of how eigenvectors isolate *invariant subspaces* that help construct and analyze solutions of linear difference equations.
2523

2624
When vector $x_t$ starts in an invariant subspace, iterating the different equation keeps $x_{t+j}$
2725
in that subspace for all $j \geq 1$.
2826

29-
Invariant subspace methods are used throughout applied economic dynamics, for example, in this QuantEcon lecture {doc}`money_inflation`
27+
Invariant subspace methods are used throughout applied economic dynamics, for example, in the lecture {doc}`money_inflation`
3028

3129
Our approach here is to illustrate the method with an ancient example, one that ancient Greek mathematicians used to compute square roots of positive integers.
3230

@@ -76,7 +74,7 @@ $\{y_t\}_{t=0}^\infty$.
7674
7775
There is one equation each for $t = 0, 1, 2, \ldots$.
7876
79-
We could follow an approach taken in this QuantEcon lecture {doc}`present values<pv>` and stack all of these equations into a single matrix equation that we would then solve by using matrix inversion.
77+
We could follow an approach taken in the lecture on {doc}`present values<pv>` and stack all of these equations into a single matrix equation that we would then solve by using matrix inversion.
8078
8179
```{note}
8280
In the present instance, the matrix equation would multiply a countably infinite dimensional square matrix by a countably infinite dimensional vector. With some qualifications, matrix multiplication and inversion tools apply to such an equation.
@@ -172,11 +170,9 @@ If we choose $(y_{-1}, y_{-2})$ to set $(\eta_1, \eta_2) = (1, 0)$, then $y_t =
172170
173171
If we choose $(y_{-1}, y_{-2})$ to set $(\eta_1, \eta_2) = (0, 1)$, then $y_t = \delta_2^t$ for all $t \geq 0$.
174172
175-
Soon we'll relate the preceding calculations to components an eigen decomposition of a transition
176-
matrix that represents difference equation {eq}`eq:2diff1` in a very convenient way.
173+
Soon we'll relate the preceding calculations to components an eigen decomposition of a transition matrix that represents difference equation {eq}`eq:2diff1` in a very convenient way.
177174
178-
We'll turn to that after we describe how Ancient Greeks figured out how to compute square roots of
179-
positive integers that are not perfect squares.
175+
We'll turn to that after we describe how Ancient Greeks figured out how to compute square roots of positive integers that are not perfect squares.
180176
181177
182178
## Algorithm of the Ancient Greeks
@@ -201,8 +197,7 @@ $$ (eq:second_order)
201197
202198
together with a pair of integers that are initial conditions for $y_{-1}, y_{-2}$.
203199
204-
First, we'll deploy some techniques for solving the difference equations that are also deployed in this QuantEcon lecture about the multiplier-accelerator model:
205-
<https://python.quantecon.org/samuelson.html>
200+
First, we'll deploy some techniques for solving the difference equations that are also deployed in {doc}`dynam:samuelson`
206201
207202
208203
@@ -212,7 +207,7 @@ $$
212207
c(x) \equiv x^2 - 2 x + (1 - \sigma) = 0
213208
$$ (eq:cha_eq0)
214209
215-
+++
210+
216211
217212
(Notice how this is an instance of equation {eq}`eq:2diff6` above.)
218213
@@ -425,8 +420,6 @@ print(f"For η_1, η_2 = (1, 0), sqrt_σ = {sqrt_σ:.5f}")
425420
426421
We find that convergence is immediate.
427422
428-
+++
429-
430423
Next, we'll represent the preceding analysis by first vectorizing our second-order difference equation {eq}`eq:second_order` and then using eigendecompositions of an associated state transition matrix.
431424
432425
## Vectorizing the difference equation
@@ -650,8 +643,6 @@ $$ (eq:deactivate2)
650643
651644
Let's verify {eq}`eq:deactivate1` and {eq}`eq:deactivate2` below
652645
653-
+++
654-
655646
To deactivate $\lambda_1$ we use {eq}`eq:deactivate1`
656647
657648
```{code-cell} ipython3
@@ -665,8 +656,6 @@ np.round(V_inv @ xd_1, 8)
665656
666657
We find $x_{1,0}^* = 0$.
667658
668-
+++
669-
670659
Now we deactivate $\lambda_2$ using {eq}`eq:deactivate2`
671660
672661
```{code-cell} ipython3
@@ -691,6 +680,10 @@ ratios_λ1 = xs_λ1[1, 1:] / xs_λ1[1, :-1]
691680
ratios_λ2 = xs_λ2[1, 1:] / xs_λ2[1, :-1]
692681
```
693682
683+
The following graph shows the ratios $y_t / y_{t-1}$ for the two cases.
684+
685+
We find that the ratios converge to $\lambda_2$ in the first case and $\lambda_1$ in the second case.
686+
694687
```{code-cell} ipython3
695688
:tags: [hide-input]
696689
@@ -730,5 +723,4 @@ This lecture sets the stage for many other applications of the *invariant subsp
730723
All of these exploit very similar equations based on eigen decompositions.
731724
732725
We shall encounter equations very similar to {eq}`eq:deactivate1` and {eq}`eq:deactivate2`
733-
in this QuantEcon lecture {doc}`money_inflation`
734-
and in many other places in dynamic economic theory.
726+
in {doc}`money_inflation` and in many other places in dynamic economic theory.

0 commit comments

Comments
 (0)