Skip to content

Commit bfb0b9f

Browse files
committed
Rectifying the notations in the lecture
This commit rectifies the notations and replaces the greek letters (alpha and beta) with (a and b)
1 parent e4fdac9 commit bfb0b9f

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

lectures/samuelson.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ that we set
553553
```{code-cell} ipython3
554554
# This is a 'manual' method
555555
556-
def y_nonstochastic(y_0=100, y_1=80, α=.92, β=.5, γ=10, n=80):
556+
def y_nonstochastic(y_0=100, y_1=80, a=.92, b=.5, γ=10, n=80):
557557
558558
"""Takes values of parameters and computes the roots of characteristic
559559
polynomial. It tells whether they are real or complex and whether they
@@ -564,8 +564,8 @@ def y_nonstochastic(y_0=100, y_1=80, α=.92, β=.5, γ=10, n=80):
564564
565565
roots = []
566566
567-
ρ1 = α + β
568-
ρ2 = -β
567+
ρ1 = a + b
568+
ρ2 = -b
569569
570570
print(f'ρ_1 is {ρ1}')
571571
print(f'ρ_2 is {ρ2}')
@@ -687,16 +687,16 @@ print(f"ρ1, ρ2 = {ρ1}, {ρ2}")
687687
##=== This method uses numpy to calculate roots ===#
688688
689689
690-
def y_nonstochastic(y_0=100, y_1=80, α=.9, β=.8, γ=10, n=80):
690+
def y_nonstochastic(y_0=100, y_1=80, a=.9, b=.8, γ=10, n=80):
691691
692692
""" Rather than computing the roots of the characteristic
693693
polynomial by hand as we did earlier, this function
694694
enlists numpy to do the work for us
695695
"""
696696
697697
# Useful constants
698-
ρ1 = α + β
699-
ρ2 = -β
698+
ρ1 = a + b
699+
ρ2 = -b
700700
701701
categorize_solution(ρ1, ρ2)
702702
@@ -754,7 +754,7 @@ b = b.real
754754
755755
print(f"a, b = {a}, {b}")
756756
757-
ytemp = y_nonstochastic(α=a, β=b, y_0=20, y_1=30)
757+
ytemp = y_nonstochastic(a=a, b=b, y_0=20, y_1=30)
758758
plot_y(ytemp)
759759
```
760760

@@ -773,8 +773,8 @@ sympy.solve(z**2 - r1*z - r2, z)
773773
```
774774

775775
```{code-cell} ipython3
776-
a = Symbol("α")
777-
b = Symbol("β")
776+
a = Symbol("a")
777+
b = Symbol("b")
778778
r1 = a + b
779779
r2 = -b
780780
@@ -788,16 +788,16 @@ model that emerges when we add a random shock process to aggregate
788788
demand
789789

790790
```{code-cell} ipython3
791-
def y_stochastic(y_0=0, y_1=0, α=0.8, β=0.2, γ=10, n=100, σ=5):
791+
def y_stochastic(y_0=0, y_1=0, a=0.8, b=0.2, γ=10, n=100, σ=5):
792792
793793
"""This function takes parameters of a stochastic version of
794794
the model and proceeds to analyze the roots of the characteristic
795795
polynomial and also generate a simulation.
796796
"""
797797
798798
# Useful constants
799-
ρ1 = α + β
800-
ρ2 = -β
799+
ρ1 = a + b
800+
ρ2 = -b
801801
802802
# Categorize solution
803803
categorize_solution(ρ1, ρ2)
@@ -854,7 +854,7 @@ a = a.real
854854
b = b.real
855855
856856
print(f"a, b = {a}, {b}")
857-
plot_y(y_stochastic(y_0=40, y_1 = 42, α=a, β=b, σ=2, n=100))
857+
plot_y(y_stochastic(y_0=40, y_1 = 42, a=a, b=b, σ=2, n=100))
858858
```
859859

860860
## Government spending
@@ -865,8 +865,8 @@ in government expenditures
865865
```{code-cell} ipython3
866866
def y_stochastic_g(y_0=20,
867867
y_1=20,
868-
α=0.8,
869-
β=0.2,
868+
a=0.8,
869+
b=0.2,
870870
γ=10,
871871
n=100,
872872
σ=2,
@@ -879,8 +879,8 @@ def y_stochastic_g(y_0=20,
879879
"""
880880
881881
# Useful constants
882-
ρ1 = α + β
883-
ρ2 = -β
882+
ρ1 = a + b
883+
ρ2 = -b
884884
885885
# Categorize solution
886886
categorize_solution(ρ1, ρ2)
@@ -984,9 +984,9 @@ class Samuelson():
984984
Initial condition for Y_0
985985
y_1 : scalar
986986
Initial condition for Y_1
987-
α : scalar
987+
a : scalar
988988
Marginal propensity to consume
989-
β : scalar
989+
b : scalar
990990
Accelerator coefficient
991991
n : int
992992
Number of iterations
@@ -1007,20 +1007,20 @@ class Samuelson():
10071007
def __init__(self,
10081008
y_0=100,
10091009
y_1=50,
1010-
α=1.3,
1011-
β=0.2,
1010+
a=1.3,
1011+
b=0.2,
10121012
γ=10,
10131013
n=100,
10141014
σ=0,
10151015
g=0,
10161016
g_t=0,
10171017
duration=None):
10181018
1019-
self.y_0, self.y_1, self.α, self.β = y_0, y_1, α, β
1019+
self.y_0, self.y_1, self.a, self.b = y_0, y_1, a, b
10201020
self.n, self.g, self.g_t, self.duration = n, g, g_t, duration
10211021
self.γ, self.σ = γ, σ
1022-
self.ρ1 = α + β
1023-
self.ρ2 = -β
1022+
self.ρ1 = a + b
1023+
self.ρ2 = -b
10241024
self.roots = np.roots([1, -self.ρ1, -self.ρ2])
10251025
10261026
def root_type(self):
@@ -1122,7 +1122,7 @@ class Samuelson():
11221122
ax.grid()
11231123
11241124
# Add parameter values to plot
1125-
paramstr = f'$\\alpha={self.α:.2f}$ \n $\\beta={self.β:.2f}$ \n \
1125+
paramstr = f'$a={self.a:.2f}$ \n $b={self.b:.2f}$ \n \
11261126
$\\gamma={self.γ:.2f}$ \n $\\sigma={self.σ:.2f}$ \n \
11271127
$\\rho_1={self.ρ1:.2f}$ \n $\\rho_2={self.ρ2:.2f}$'
11281128
props = dict(fc='white', pad=10, alpha=0.5)
@@ -1163,7 +1163,7 @@ class Samuelson():
11631163
Now we'll put our Samuelson class to work on an example
11641164

11651165
```{code-cell} ipython3
1166-
sam = Samuelson(α=0.8, β=0.5, σ=2, g=10, g_t=20, duration='permanent')
1166+
sam = Samuelson(a=0.8, b=0.5, σ=2, g=10, g_t=20, duration='permanent')
11671167
sam.summary()
11681168
```
11691169

@@ -1197,10 +1197,10 @@ Here is how we map the Samuelson model into an instance of a
11971197
"""This script maps the Samuelson model in the the
11981198
``LinearStateSpace`` class
11991199
"""
1200-
α = 0.8
1201-
β = 0.9
1202-
ρ1 = α + β
1203-
ρ2 = -β
1200+
a = 0.8
1201+
b = 0.9
1202+
ρ1 = a + b
1203+
ρ2 = -b
12041204
γ = 10
12051205
σ = 1
12061206
g = 10
@@ -1211,8 +1211,8 @@ A = [[1, 0, 0],
12111211
[0, 1, 0]]
12121212
12131213
G = [[γ + g, ρ1, ρ2], # this is Y_{t+1}
1214-
[γ, α, 0], # this is C_{t+1}
1215-
[0, β, -β]] # this is I_{t+1}
1214+
[γ, a, 0], # this is C_{t+1}
1215+
[0, b, -b]] # this is I_{t+1}
12161216
12171217
μ_0 = [1, 100, 50]
12181218
C = np.zeros((3,1))
@@ -1272,21 +1272,21 @@ class SamuelsonLSS(LinearStateSpace):
12721272
def __init__(self,
12731273
y_0=100,
12741274
y_1=50,
1275-
α=0.8,
1276-
β=0.9,
1275+
a=0.8,
1276+
b=0.9,
12771277
γ=10,
12781278
σ=1,
12791279
g=10):
12801280
1281-
self.α, self.β = α, β
1281+
self.a, self.b = a, b
12821282
self.y_0, self.y_1, self.g = y_0, y_1, g
12831283
self.γ, self.σ = γ, σ
12841284
12851285
# Define intial conditions
12861286
self.μ_0 = [1, y_0, y_1]
12871287
1288-
self.ρ1 = α + β
1289-
self.ρ2 = -β
1288+
self.ρ1 = a + b
1289+
self.ρ2 = -b
12901290
12911291
# Define transition matrix
12921292
self.A = [[1, 0, 0],
@@ -1295,8 +1295,8 @@ class SamuelsonLSS(LinearStateSpace):
12951295
12961296
# Define output matrix
12971297
self.G = [[γ + g, self.ρ1, self.ρ2], # this is Y_{t+1}
1298-
[γ, α, 0], # this is C_{t+1}
1299-
[0, β, -β]] # this is I_{t+1}
1298+
[γ, a, 0], # this is C_{t+1}
1299+
[0, b, -b]] # this is I_{t+1}
13001300
13011301
self.C = np.zeros((3, 1))
13021302
self.C[1] = σ # stochastic
@@ -1403,15 +1403,15 @@ multiplier model
14031403
accelerator
14041404

14051405
```{code-cell} ipython3
1406-
pure_multiplier = SamuelsonLSS(α=0.95, β=0)
1406+
pure_multiplier = SamuelsonLSS(a=0.95, b=0)
14071407
```
14081408

14091409
```{code-cell} ipython3
14101410
pure_multiplier.plot_simulation()
14111411
```
14121412

14131413
```{code-cell} ipython3
1414-
pure_multiplier = SamuelsonLSS(α=0.8, β=0)
1414+
pure_multiplier = SamuelsonLSS(a=0.8, b=0)
14151415
```
14161416

14171417
```{code-cell} ipython3

0 commit comments

Comments
 (0)