GitHub

@@ -4,7 +4,7 @@ jupytext:

44

extension: .md

55

format_name: myst

66

format_version: 0.13

7-

jupytext_version: 1.16.1

7+

jupytext_version: 1.16.4

88

kernelspec:

99

display_name: Python 3 (ipykernel)

1010

language: python

@@ -66,7 +66,7 @@ Let's start with some standard imports:

66666767

```{code-cell} ipython3

6868

import matplotlib.pyplot as plt

69-

from numba import njit, float64

69+

from numba import jit, float64

7070

from numba.experimental import jitclass

7171

import numpy as np

7272

from quantecon.optimize import brentq

@@ -525,7 +525,7 @@ planning problem.

525525

$c_0$ instead of $\mu_0$ in the following code.)

526526527527

```{code-cell} ipython3

528-

@njit

528+

@jit

529529

def shooting(pp, c0, k0, T=10):

530530

'''

531531

Given the initial condition of capital k0 and an initial guess

@@ -610,7 +610,7 @@ When $K_{T+1}$ gets close enough to $0$ (i.e., within an error

610610

tolerance bounds), we stop.

611611612612

```{code-cell} ipython3

613-

@njit

613+

@jit

614614

def bisection(pp, c0, k0, T=10, tol=1e-4, max_iter=500, k_ter=0, verbose=True):

615615616616

# initial boundaries for guess c0

@@ -804,7 +804,7 @@ over time.

804804

Let's calculate and plot the saving rate.

805805806806

```{code-cell} ipython3

807-

@njit

807+

@jit

808808

def saving_rate(pp, c_path, k_path):

809809

'Given paths of c and k, computes the path of saving rate.'

810810

production = pp.f(k_path[:-1])

@@ -912,7 +912,7 @@ $$ (eq:tildeC)

912912

A positive fixed point $C = \tilde C(K)$ exists only if $f\left(K\right)+\left(1-\delta\right)K-f^{\prime-1}\left(\frac{1}{\beta}-\left(1-\delta\right)\right)>0$

913913914914

```{code-cell} ipython3

915-

@njit

915+

@jit

916916

def C_tilde(K, pp):

917917918918

return pp.f(K) + (1 - pp.δ) * K - pp.f_prime_inv(1 / pp.β - 1 + pp.δ)

@@ -931,11 +931,11 @@ K = \tilde K(C)

931931

$$ (eq:tildeK)

932932933933

```{code-cell} ipython3

934-

@njit

934+

@jit

935935

def K_diff(K, C, pp):

936936

return pp.f(K) - pp.δ * K - C

937937938-

@njit

938+

@jit

939939

def K_tilde(C, pp):

940940941941

res = brentq(K_diff, 1e-6, 100, args=(C, pp))

@@ -951,7 +951,7 @@ It is thus the intersection of the two curves $\tilde{C}$ and $\tilde{K}$ that w

951951

We can compute $K_s$ by solving the equation $K_s = \tilde{K}\left(\tilde{C}\left(K_s\right)\right)$

952952953953

```{code-cell} ipython3

954-

@njit

954+

@jit

955955

def K_tilde_diff(K, pp):

956956957957

K_out = K_tilde(C_tilde(K, pp), pp)

@@ -1003,7 +1003,7 @@ In addition to the three curves, Figure {numref}`stable_manifold` plots arrows

10031003

---

10041004

mystnb:

10051005

figure:

1006-

caption: "Stable Manifold and Phase Plane"

1006+

caption: Stable Manifold and Phase Plane

10071007

name: stable_manifold

10081008

tags: [hide-input]

10091009

---

Read the original on github.com ↗