Skip to content

Commit 9aa2c64

Browse files
committed
update source files to use latest tomyst(PR#69)
1 parent 5dd03d6 commit 9aa2c64

28 files changed

+961
-591
lines changed

conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
'IPython.sphinxext.ipython_console_highlighting',
4141
# Custom Sphinx Extensions
4242
'sphinxcontrib.jupyter',
43-
'myst_parser',
43+
'myst_nb',
4444
]
4545

4646
# Retired Extensions but may be useful in Future
@@ -483,3 +483,4 @@
483483

484484
# Set Destination path
485485
tomyst_static_file_path = ['source/rst/_static']
486+
tomyst_parser = "myst_nb"

source/rst/404.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
---
2+
jupytext:
3+
text_representation:
4+
extension: .md
5+
format_name: myst
6+
kernelspec:
7+
display_name: Python 3
8+
language: python
9+
name: python3
10+
---
11+
112
# Page Not Found
213

314
```{raw} html

source/rst/about_lectures.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
---
2+
jupytext:
3+
text_representation:
4+
extension: .md
5+
format_name: myst
6+
kernelspec:
7+
display_name: Python 3
8+
language: python
9+
name: python3
10+
---
11+
112
# About Lectures
213

314
This is one of a series of online texts on modern quantitative

source/rst/about_py.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
---
2+
jupytext:
3+
text_representation:
4+
extension: .md
5+
format_name: myst
6+
kernelspec:
7+
display_name: Python 3
8+
language: python
9+
name: python3
10+
---
11+
112
```{raw} html
213
<div id="qe-notebook-header" align="right" style="text-align:right;">
314
<a href="https://quantecon.org/" title="quantecon.org">
@@ -161,7 +172,7 @@ NumPy provides the basic array data type plus some simple processing operations.
161172

162173
For example, let's build some arrays
163174

164-
```{code-block} python3
175+
```{code-cell} python3
165176
import numpy as np # Load the library
166177
167178
a = np.linspace(-np.pi, np.pi, 100) # Create even grid from -π to π
@@ -171,7 +182,7 @@ c = np.sin(a) # Apply sin to each element of a
171182

172183
Now let's take the inner product
173184

174-
```{code-block} python3
185+
```{code-cell} python3
175186
b @ c
176187
```
177188

@@ -183,7 +194,7 @@ The [SciPy](http://www.scipy.org) library is built on top of NumPy and provides
183194

184195
For example, let's calculate $\int_{-2}^2 \phi(z) dz$ where $\phi$ is the standard normal density.
185196

186-
```{code-block} python3
197+
```{code-cell} python3
187198
from scipy.stats import norm
188199
from scipy.integrate import quad
189200
@@ -251,7 +262,7 @@ single: SymPy
251262

252263
The [SymPy](http://www.sympy.org/) library provides this functionality from within the Python shell.
253264

254-
```{code-block} python3
265+
```{code-cell} python3
255266
from sympy import Symbol
256267
257268
x, y = Symbol('x'), Symbol('y') # Treat 'x' and 'y' as algebraic symbols
@@ -260,32 +271,32 @@ x + x + x + y
260271

261272
We can manipulate expressions
262273

263-
```{code-block} python3
274+
```{code-cell} python3
264275
expression = (x + y)**2
265276
expression.expand()
266277
```
267278

268279
solve polynomials
269280

270-
```{code-block} python3
281+
```{code-cell} python3
271282
from sympy import solve
272283
273284
solve(x**2 + x + 2)
274285
```
275286

276287
and calculate limits, derivatives and integrals
277288

278-
```{code-block} python3
289+
```{code-cell} python3
279290
from sympy import limit, sin, diff
280291
281292
limit(1 / x, x, 0)
282293
```
283294

284-
```{code-block} python3
295+
```{code-cell} python3
285296
limit(sin(x) / x, x, 0)
286297
```
287298

288-
```{code-block} python3
299+
```{code-cell} python3
289300
diff(sin(x), x)
290301
```
291302

@@ -313,7 +324,7 @@ Pandas is fast, efficient, flexible and well designed.
313324
Here's a simple example, using some dummy data generated with Numpy's excellent
314325
`random` functionality.
315326

316-
```{code-block} python3
327+
```{code-cell} python3
317328
import pandas as pd
318329
np.random.seed(1234)
319330
@@ -324,7 +335,7 @@ df = pd.DataFrame(data, columns=('price', 'weight'), index=dates)
324335
print(df)
325336
```
326337

327-
```{code-block} python3
338+
```{code-cell} python3
328339
df.mean()
329340
```
330341

@@ -370,7 +381,7 @@ Its features include, among many other things:
370381

371382
Here's some example code that generates and plots a random graph, with node color determined by shortest path length from a central node.
372383

373-
```{code-block} ipython
384+
```{code-cell} ipython
374385
import networkx as nx
375386
import matplotlib.pyplot as plt
376387
%matplotlib inline

source/rst/debugging.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
---
2+
jupytext:
3+
text_representation:
4+
extension: .md
5+
format_name: myst
6+
kernelspec:
7+
display_name: Python 3
8+
language: python
9+
name: python3
10+
---
11+
112
```{raw} html
213
<div id="qe-notebook-header" align="right" style="text-align:right;">
314
<a href="https://quantecon.org/" title="quantecon.org">
@@ -38,7 +49,7 @@ Here we'll focus on Jupyter and leave you to explore other settings.
3849

3950
We'll need the following imports
4051

41-
```{code-block} ipython
52+
```{code-cell} ipython
4253
import numpy as np
4354
import matplotlib.pyplot as plt
4455
%matplotlib inline
@@ -54,7 +65,10 @@ single: Debugging
5465

5566
Let's consider a simple (and rather contrived) example
5667

57-
```{code-block} ipython
68+
```{code-cell} ipython
69+
---
70+
tags: [raises-exception]
71+
---
5872
def plot_log():
5973
fig, ax = plt.subplots(2, 1)
6074
x = np.linspace(1, 2, 10)
@@ -78,7 +92,10 @@ But let's pretend that we don't understand this for the moment.
7892

7993
We might suspect there's something wrong with `ax` but when we try to investigate this object, we get the following exception:
8094

81-
```{code-block} python3
95+
```{code-cell} python3
96+
---
97+
tags: [raises-exception]
98+
---
8299
ax
83100
```
84101

@@ -89,7 +106,10 @@ Let's try doing it a different way.
89106

90107
We run the first cell block again, generating the same error
91108

92-
```{code-block} python3
109+
```{code-cell} python3
110+
---
111+
tags: [raises-exception]
112+
---
93113
def plot_log():
94114
fig, ax = plt.subplots(2, 1)
95115
x = np.linspace(1, 2, 10)
@@ -161,7 +181,10 @@ The preceding approach is handy but sometimes insufficient.
161181

162182
Consider the following modified version of our function above
163183

164-
```{code-block} python3
184+
```{code-cell} python3
185+
---
186+
tags: [raises-exception]
187+
---
165188
def plot_log():
166189
fig, ax = plt.subplots()
167190
x = np.logspace(1, 2, 10)

0 commit comments

Comments
 (0)