Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lectures/complex_and_trig.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ $z = 1 + \sqrt{3} i$.
```{code-cell} python3
# Abbreviate useful values and functions
π = np.pi
zeros = np.zeros
ones = np.ones


# Set parameters
r = 2
Expand All @@ -135,9 +134,9 @@ fig = plt.figure(figsize=(8, 8))
ax = plt.subplot(111, projection='polar')

ax.plot((0, θ), (0, r), marker='o', color='b') # Plot r
ax.plot(zeros(x_range.shape), x_range, color='b') # Plot x
ax.plot(np.zeros(x_range.shape), x_range, color='b') # Plot x
ax.plot(θ_range, x / np.cos(θ_range), color='b') # Plot y
ax.plot(θ_range, ones(θ_range.shape) * 0.1, color='r') # Plot θ
ax.plot(θ_range, np.full(θ_range.shape, 0.1), color='r') # Plot θ

ax.margins(0) # Let the plot starts at origin

Expand Down
8 changes: 4 additions & 4 deletions lectures/inventory_dynamics.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ legend_args = {'ncol': 3,
'mode': 'expand'}

ax.plot(X, label="inventory")
ax.plot(s * np.ones(sim_length), 'k--', label="$s$")
ax.plot(S * np.ones(sim_length), 'k-', label="$S$")
ax.plot(np.full(sim_length, s), 'k--', label="$s$")
ax.plot(np.full(sim_length, S), 'k-', label="$S$")
ax.set_ylim(0, S+10)
ax.set_xlabel("time")
ax.legend(**legend_args)
Expand All @@ -156,8 +156,8 @@ the probabilities of different outcomes:
sim_length=200
fig, ax = plt.subplots()

ax.plot(s * np.ones(sim_length), 'k--', label="$s$")
ax.plot(S * np.ones(sim_length), 'k-', label="$S$")
ax.plot(np.full(sim_length, s), 'k--', label="$s$")
ax.plot(np.full(sim_length, S), 'k-', label="$S$")
ax.set_ylim(0, S+10)
ax.legend(**legend_args)

Expand Down
4 changes: 2 additions & 2 deletions lectures/lake_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ class LakeModel:
--------
xbar : steady state vector of employment and unemployment rates
"""
x = 0.5 * np.ones(2)
x = np.full(2, 0.5)
error = tol + 1
while error > tol:
new_x = self.A_hat @ x
Expand Down Expand Up @@ -1049,7 +1049,7 @@ class LakeModelModified:
--------
xbar : steady state vector of employment and unemployment rates
"""
x = 0.5 * np.ones(2)
x = np.full(2, 0.5)
error = tol + 1
while error > tol:
new_x = self.A_hat @ x
Expand Down
4 changes: 2 additions & 2 deletions lectures/markov_asset.md
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ Consider the following primitives
```{code-cell} python3
n = 5
P = np.full((n, n), 0.0125)
P += np.diag(0.95 - 0.0125 * np.ones(5))
P[range(n), range(n)] += 1 - P.sum(1)
# State values of the Markov chain
s = np.array([0.95, 0.975, 1.0, 1.025, 1.05])
γ = 2.0
Expand Down Expand Up @@ -1011,7 +1011,7 @@ First, let's enter the parameters:
```{code-cell} python3
n = 5
P = np.full((n, n), 0.0125)
P += np.diag(0.95 - 0.0125 * np.ones(5))
P[range(n), range(n)] += 1 - P.sum(1)
s = np.array([0.95, 0.975, 1.0, 1.025, 1.05]) # State values
mc = qe.MarkovChain(P, state_values=s)

Expand Down
4 changes: 2 additions & 2 deletions lectures/multivariate_normal.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ test scores $\sigma_{y}$.
```{code-cell} python3
def construct_moments_IQ(n, μθ, σθ, σy):

μ_IQ = np.ones(n+1) * μθ
μ_IQ = np.full(n+1, μθ)

D_IQ = np.zeros((n+1, n+1))
D_IQ[range(n), range(n)] = σy
Expand Down Expand Up @@ -1710,7 +1710,7 @@ A_inv = np.linalg.inv(A)

```{code-cell} python3
# compute the mean vectors of b and y
μb = np.ones(T) * 𝛼0
μb = np.full(T, 𝛼0)
μb[0] += 𝛼1 * μy_tilde[1] + 𝛼2 * μy_tilde[0]
μb[1] += 𝛼2 * μy_tilde[1]

Expand Down
2 changes: 1 addition & 1 deletion lectures/samuelson.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def param_plot():
# Draw (t1, t2) points
ρ1 = np.linspace(-2, 2, 100)
ax.plot(ρ1, -abs(ρ1) + 1, c='black')
ax.plot(ρ1, np.ones_like(ρ1) * -1, c='black')
ax.plot(ρ1, np.full_like(ρ1, -1), c='black')
ax.plot(ρ1, -(ρ1**2 / 4), c='black')

# Turn normal axes off
Expand Down