Skip to content

Commit ecf3c74

Browse files
committed
good suggestions, manual edit
1 parent 38f17dd commit ecf3c74

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

lectures/scipy.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ kernelspec:
2323
```{index} single: Python; SciPy
2424
```
2525

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+
2634
## Overview
2735

2836
[SciPy](https://scipy.org/) builds on top of NumPy to provide common tools for scientific programming such as
@@ -49,20 +57,27 @@ In this lecture, we aim only to highlight some useful parts of the package.
4957

5058
SciPy is a package that contains various tools that are built on top of NumPy, using its array data type and related functionality.
5159

52-
In older versions of SciPy, importing SciPy would also import NumPy symbols into the global namespace.
60+
````{note}
61+
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:
5362
54-
However, modern versions of SciPy (1.15+) have a cleaner approach and no longer automatically import NumPy symbols. This is better practice as it avoids namespace pollution.
55-
56-
Instead, you should import NumPy explicitly:
63+
```python
64+
from numpy import *
65+
from numpy.random import rand, randn
66+
from numpy.fft import fft, ifft
67+
from numpy.lib.scimath import *
68+
```
5769
70+
However, it is better practice to use NumPy functionality explicitly.
5871
59-
```{code-cell} python3
72+
```python
6073
import numpy as np
61-
import quantecon as qe
6274
6375
a = np.identity(3)
6476
```
6577
78+
More recent versions of SciPy (1.15+) no longer automatically import NumPy symbols.
79+
```
80+
6681
What is useful in SciPy is the functionality in its sub-packages
6782
6883
* `scipy.optimize`, `scipy.integrate`, `scipy.stats`, etc.

0 commit comments

Comments
 (0)