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
162173For example, let's build some arrays
163174
164- ``` {code-block } python3
175+ ``` {code-cell } python3
165176import numpy as np # Load the library
166177
167178a = 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
172183Now let's take the inner product
173184
174- ``` {code-block } python3
185+ ``` {code-cell } python3
175186b @ c
176187```
177188
@@ -183,7 +194,7 @@ The [SciPy](http://www.scipy.org) library is built on top of NumPy and provides
183194
184195For 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
187198from scipy.stats import norm
188199from scipy.integrate import quad
189200
@@ -251,7 +262,7 @@ single: SymPy
251262
252263The [ SymPy] ( http://www.sympy.org/ ) library provides this functionality from within the Python shell.
253264
254- ``` {code-block } python3
265+ ``` {code-cell } python3
255266from sympy import Symbol
256267
257268x, y = Symbol('x'), Symbol('y') # Treat 'x' and 'y' as algebraic symbols
@@ -260,32 +271,32 @@ x + x + x + y
260271
261272We can manipulate expressions
262273
263- ``` {code-block } python3
274+ ``` {code-cell } python3
264275expression = (x + y)**2
265276expression.expand()
266277```
267278
268279solve polynomials
269280
270- ``` {code-block } python3
281+ ``` {code-cell } python3
271282from sympy import solve
272283
273284solve(x**2 + x + 2)
274285```
275286
276287and calculate limits, derivatives and integrals
277288
278- ``` {code-block } python3
289+ ``` {code-cell } python3
279290from sympy import limit, sin, diff
280291
281292limit(1 / x, x, 0)
282293```
283294
284- ``` {code-block } python3
295+ ``` {code-cell } python3
285296limit(sin(x) / x, x, 0)
286297```
287298
288- ``` {code-block } python3
299+ ``` {code-cell } python3
289300diff(sin(x), x)
290301```
291302
@@ -313,7 +324,7 @@ Pandas is fast, efficient, flexible and well designed.
313324Here'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
317328import pandas as pd
318329np.random.seed(1234)
319330
@@ -324,7 +335,7 @@ df = pd.DataFrame(data, columns=('price', 'weight'), index=dates)
324335print(df)
325336```
326337
327- ``` {code-block } python3
338+ ``` {code-cell } python3
328339df.mean()
329340```
330341
@@ -370,7 +381,7 @@ Its features include, among many other things:
370381
371382Here'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
374385import networkx as nx
375386import matplotlib.pyplot as plt
376387%matplotlib inline
0 commit comments