Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cfedc1a

Browse filesBrowse files
Copilotmmcky
andauthored
Update SciPy lecture: Fix outdated import statement for SciPy 1.15+ compatibility (#406)
* Initial plan * Update SciPy lecture: Fix outdated import statement for SciPy 1.15+ compatibility Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com> * good suggestions, manual edit * fix fencing level * fix execution error --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mmcky <8263752+mmcky@users.noreply.github.com> Co-authored-by: mmcky <mamckay@gmail.com>
1 parent 341ec14 commit cfedc1a
Copy full SHA for cfedc1a

File tree

Expand file treeCollapse file tree

1 file changed

+23
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+23
-7
lines changed
Open diff view settings
Collapse file

‎lectures/scipy.md‎

Copy file name to clipboardExpand all lines: lectures/scipy.md
+23-7Lines changed: 23 additions & 7 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ 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+
34+
We use the following imports.
35+
36+
```{code-cell} ipython3
37+
import numpy as np
38+
import quantecon as qe
39+
```
40+
2641
## Overview
2742

2843
[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.
4964

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

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:
5369
54-
```{code-cell} python3
55-
# Import numpy symbols to scipy namespace
70+
```python
5671
from numpy import *
5772
from numpy.random import rand, randn
5873
from numpy.fft import fft, ifft
5974
from numpy.lib.scimath import *
6075
```
6176
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.
6378
64-
65-
```{code-cell} python3
79+
```python
6680
import numpy as np
67-
import quantecon as qe
6881
6982
a = np.identity(3)
7083
```
7184
85+
More recent versions of SciPy (1.15+) no longer automatically import NumPy symbols.
86+
````
87+
7288
What is useful in SciPy is the functionality in its sub-packages
7389

7490
* `scipy.optimize`, `scipy.integrate`, `scipy.stats`, etc.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.