@@ -23,6 +23,21 @@ kernelspec:
|
23 | 23 | ```{index} single: Python; SciPy |
24 | 24 | ``` |
25 | 25 | |
| 26 | +In addition to what’s in Anaconda, this lecture will need the following libraries: |
| 27 | + |
| 28 | +```{code-cell} ipython3 |
| 29 | +:tags: [hide-output] |
| 30 | + |
| 31 | +!pip install --upgrade quantecon |
| 32 | +``` |
| 33 | + |
| 34 | +We use the following imports. |
| 35 | + |
| 36 | +```{code-cell} ipython3 |
| 37 | +import numpy as np |
| 38 | +import quantecon as qe |
| 39 | +``` |
| 40 | + |
26 | 41 | ## Overview |
27 | 42 | |
28 | 43 | [SciPy](https://scipy.org/) builds on top of NumPy to provide common tools for scientific programming such as |
@@ -49,26 +64,27 @@ In this lecture, we aim only to highlight some useful parts of the package.
|
49 | 64 | |
50 | 65 | SciPy is a package that contains various tools that are built on top of NumPy, using its array data type and related functionality. |
51 | 66 | |
52 | | -In fact, when we import SciPy we also get NumPy, as can be seen from this excerpt the SciPy initialization file: |
| 67 | +````{note} |
| 68 | +In older versions of SciPy (`scipy < 0.15.1`), importing the package would also import NumPy symbols into the global namespace, as can be seen from this excerpt the SciPy initialization file: |
53 | 69 | |
54 | | -```{code-cell} python3 |
55 | | -# Import numpy symbols to scipy namespace |
| 70 | +```python |
56 | 71 | from numpy import * |
57 | 72 | from numpy.random import rand, randn |
58 | 73 | from numpy.fft import fft, ifft |
59 | 74 | from numpy.lib.scimath import * |
60 | 75 | ``` |
61 | 76 | |
62 | | -However, it's more common and better practice to use NumPy functionality explicitly. |
| 77 | +However, it is better practice to use NumPy functionality explicitly. |
63 | 78 | |
64 | | - |
65 | | -```{code-cell} python3 |
| 79 | +```python |
66 | 80 | import numpy as np |
67 | | -import quantecon as qe |
68 | 81 | |
69 | 82 | a = np.identity(3) |
70 | 83 | ``` |
71 | 84 | |
| 85 | +More recent versions of SciPy (1.15+) no longer automatically import NumPy symbols. |
| 86 | +```` |
| 87 | + |
72 | 88 | What is useful in SciPy is the functionality in its sub-packages |
73 | 89 | |
74 | 90 | * `scipy.optimize`, `scipy.integrate`, `scipy.stats`, etc. |
|