Skip to content

Commit

Permalink
Merge branch 'example_spelling' of https://github.com/QuantEcon/lectu…
Browse files Browse the repository at this point in the history
…re-python-intro into example_spelling
  • Loading branch information
longye-tian committed Jul 28, 2024
2 parents e283e8e + 6887527 commit 8f206ad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
21 changes: 14 additions & 7 deletions lectures/lp_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ We provide a standard form of a linear program and methods to transform other fo

We tell how to solve a linear programming problem using [SciPy](https://scipy.org/) and [Google OR-Tools](https://developers.google.com/optimization).

```{seealso}
In another lecture, we will employ the linear programming method to solve the
{doc}`optimal transport problem <tools:opt_transport>`.
```

Let's start with some standard imports.

```{code-cell} ipython3
Expand Down Expand Up @@ -91,6 +96,8 @@ $$

The following graph illustrates the firm's constraints and iso-revenue lines.

Iso-revenue lines show all the combinations of materials and labor that produce the same revenue.

```{code-cell} ipython3
---
tags: [hide-input]
Expand Down Expand Up @@ -335,7 +342,7 @@ OR-Tools tells us that the best investment strategy is:

3. At the beginning of the third year, the bank balance should be $ \$75,072.245 $.

4. At the end of the third year, the mutual fund will get payouts from the annuity and corporate bond and repay its loan from the bank. At the end it will own $ \$141018.24 $, so that it's total net rate of return over the three periods is $ 41.02\%$.
4. At the end of the third year, the mutual fund will get payouts from the annuity and corporate bond and repay its loan from the bank. At the end it will own $ \$141,018.24 $, so that it's total net rate of return over the three periods is $ 41.02\%$.



Expand Down Expand Up @@ -542,14 +549,14 @@ c_ex2 = np.array([1.30*3, 0, 0, 1.06, 1.30])
A_ex2 = np.array([[1, 1, 0, 0, 0],
[1, -rate, 1, 0, 1],
[1, 0, -rate, 1, 0]])
b_ex2 = np.array([100000, 0, 0])
b_ex2 = np.array([100_000, 0, 0])
# Bounds on decision variables
bounds_ex2 = [( 0, None),
(-20000, None),
(-20000, None),
(-20000, None),
( 0, 50000)]
(-20_000, None),
(-20_000, None),
(-20_000, None),
( 0, 50_000)]
```
Let's solve the problem and check the status using `success` attribute.
Expand Down Expand Up @@ -581,7 +588,7 @@ SciPy tells us that the best investment strategy is:
3. At the beginning of the third year, the mutual fund should borrow $ \$20,000$ from the bank and invest in the annuity.
4. At the end of the third year, the mutual fund will get payouts from the annuity and corporate bond and repay its loan from the bank. At the end it will own $ \$141018.24 $, so that it's total net rate of return over the three periods is $ 41.02\% $.
4. At the end of the third year, the mutual fund will get payouts from the annuity and corporate bond and repay its loan from the bank. At the end it will own $ \$141,018.24 $, so that it's total net rate of return over the three periods is $ 41.02\% $.
Expand Down
7 changes: 5 additions & 2 deletions lectures/solow.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ $$
Production functions with this property include

* the **Cobb-Douglas** function $F(K, L) = A K^{\alpha}
L^{1-\alpha}$ with $0 \leq \alpha \leq 1$ and
L^{1-\alpha}$ with $0 \leq \alpha \leq 1$.
* the **CES** function $F(K, L) = \left\{ a K^\rho + b L^\rho \right\}^{1/\rho}$
with $a, b, \rho > 0$.
with $a, b, \rho > 0$.

Here, $\alpha$ is the output elasticity of capital and $\rho$ is a parameter that determines the elasticity of substitution between capital and labor.

We assume a closed economy, so aggregate domestic investment equals aggregate domestic
saving.
Expand All @@ -81,6 +83,7 @@ Setting $k_t := K_t / L$ and using homogeneity of degree one now yields

$$
k_{t+1}
= s \frac{F(K_t, L)}{L} + (1 - \delta) \frac{K_t}{L}
= s \frac{F(K_t, L)}{L} + (1 - \delta) k_t
= s F(k_t, 1) + (1 - \delta) k_t
$$
Expand Down

0 comments on commit 8f206ad

Please sign in to comment.