Skip to content

Commit 1ed3d4f

Browse files
authored
MAINT: update anaconda=2025.06 and python=3.13 (#637)
* MAIN: Update to anaconda=2025.06 * update environment * adjustments for compat in exercise nodes * adjust title on eigen_I.md * adjust fig * tmp: disable build cache * re-enable build cache * update cache bevaiour to schedule or manual build
1 parent 5db9f6e commit 1ed3d4f

File tree

7 files changed

+48
-98
lines changed

7 files changed

+48
-98
lines changed

.github/workflows/cache.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Build Cache [using jupyter-book]
22
on:
3-
push:
4-
branches:
5-
- main
3+
schedule:
4+
# Execute cache weekly at 3am on Monday
5+
- cron: '0 3 * * 1'
6+
workflow_dispatch:
67
jobs:
78
tests:
89
runs-on: ubuntu-latest
@@ -15,7 +16,7 @@ jobs:
1516
auto-update-conda: true
1617
auto-activate-base: true
1718
miniconda-version: 'latest'
18-
python-version: "3.12"
19+
python-version: "3.13"
1920
environment-file: environment.yml
2021
activate-environment: quantecon
2122
- name: graphviz Support # TODO: required?

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
auto-update-conda: true
1313
auto-activate-base: true
1414
miniconda-version: 'latest'
15-
python-version: "3.12"
15+
python-version: "3.13"
1616
environment-file: environment.yml
1717
activate-environment: quantecon
1818
- name: Graphics Support #TODO: Review if graphviz is needed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
auto-update-conda: true
1717
auto-activate-base: true
1818
miniconda-version: 'latest'
19-
python-version: "3.12"
19+
python-version: "3.13"
2020
environment-file: environment.yml
2121
activate-environment: quantecon
2222
- name: Install latex dependencies

environment.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
name: quantecon
22
channels:
33
- default
4-
- conda-forge
54
dependencies:
6-
- python=3.12
7-
- anaconda=2024.10
5+
- python=3.13
6+
- anaconda=2025.06
87
- pip
98
- pip:
10-
- jupyter-book==1.0.3
11-
- quantecon-book-theme==0.8.2
12-
- sphinx-tojupyter==0.3.0
9+
- jupyter-book==1.0.4post1
10+
- quantecon-book-theme==0.8.3
11+
- sphinx-tojupyter==0.3.1
1312
- sphinxext-rediraffe==0.2.7
1413
- sphinx-exercise==1.0.1
15-
- ghp-import==2.1.0
16-
- sphinxcontrib-youtube==1.3.0 #Version 1.3.0 is required as quantecon-book-theme is only compatible with sphinx<=5
17-
- sphinx-proof==0.2.0
14+
- sphinx-proof==0.2.1
15+
- sphinxcontrib-youtube==1.4.1
1816
- sphinx-togglebutton==0.3.2
19-
- sphinx-reredirects==0.1.4 #Version 0.1.5 requires sphinx>=7.1
17+
- sphinx-reredirects==1.0.0
18+
19+

lectures/eigen_I.md

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -997,12 +997,6 @@ Here is one solution.
997997
We start by looking into the distance between the eigenvector approximation and the true eigenvector.
998998

999999
```{code-cell} ipython3
1000-
---
1001-
mystnb:
1002-
figure:
1003-
caption: Power iteration
1004-
name: pow-dist
1005-
---
10061000
# Define a matrix A
10071001
A = np.array([[1, 0, 3],
10081002
[0, 2, 0],
@@ -1040,20 +1034,14 @@ print('The real eigenvalue is', np.linalg.eig(A)[0])
10401034
plt.figure(figsize=(10, 6))
10411035
plt.xlabel('iterations')
10421036
plt.ylabel('error')
1037+
plt.title('Power iteration')
10431038
_ = plt.plot(errors)
10441039
```
10451040

1046-
+++ {"user_expressions": []}
1047-
10481041
Then we can look at the trajectory of the eigenvector approximation.
10491042

10501043
```{code-cell} ipython3
1051-
---
1052-
mystnb:
1053-
figure:
1054-
caption: Power iteration trajectory
1055-
name: pow-trajectory
1056-
---
1044+
10571045
# Set up the figure and axis for 3D plot
10581046
fig = plt.figure()
10591047
ax = fig.add_subplot(111, projection='3d')
@@ -1081,11 +1069,11 @@ ax.legend(points, ['actual eigenvector',
10811069
r'approximated eigenvector ($b_k$)'])
10821070
ax.set_box_aspect(aspect=None, zoom=0.8)
10831071
1072+
ax.set_title('Power iteration trajectory')
1073+
10841074
plt.show()
10851075
```
10861076

1087-
+++ {"user_expressions": []}
1088-
10891077
```{solution-end}
10901078
```
10911079

@@ -1119,21 +1107,14 @@ print(f'eigenvectors:\n {eigenvectors}')
11191107
plot_series(A, v, n)
11201108
```
11211109

1122-
+++ {"user_expressions": []}
1123-
11241110
The result seems to converge to the eigenvector of $A$ with the largest eigenvalue.
11251111

11261112
Let's use a [vector field](https://en.wikipedia.org/wiki/Vector_field) to visualize the transformation brought by A.
11271113

11281114
(This is a more advanced topic in linear algebra, please step ahead if you are comfortable with the math.)
11291115

11301116
```{code-cell} ipython3
1131-
---
1132-
mystnb:
1133-
figure:
1134-
caption: Convergence towards eigenvectors
1135-
name: eigen-conv
1136-
---
1117+
11371118
# Create a grid of points
11381119
x, y = np.meshgrid(np.linspace(-5, 5, 15),
11391120
np.linspace(-5, 5, 20))
@@ -1165,13 +1146,12 @@ plt.legend(lines, labels, loc='center left',
11651146
11661147
plt.xlabel("x")
11671148
plt.ylabel("y")
1149+
plt.title("Convergence towards eigenvectors")
11681150
plt.grid()
11691151
plt.gca().set_aspect('equal', adjustable='box')
11701152
plt.show()
11711153
```
11721154

1173-
+++ {"user_expressions": []}
1174-
11751155
Note that the vector field converges to the eigenvector of $A$ with the largest eigenvalue and diverges from the eigenvector of $A$ with the smallest eigenvalue.
11761156

11771157
In fact, the eigenvectors are also the directions in which the matrix $A$ stretches or shrinks the space.
@@ -1200,13 +1180,8 @@ Use the visualization in the previous exercise to explain the trajectory of the
12001180
Here is one solution
12011181

12021182
```{code-cell} ipython3
1203-
---
1204-
mystnb:
1205-
figure:
1206-
caption: Vector fields of the three matrices
1207-
name: vector-field
1208-
---
1209-
figure, ax = plt.subplots(1, 3, figsize=(15, 5))
1183+
1184+
fig, ax = plt.subplots(1, 3, figsize=(15, 5))
12101185
A = np.array([[sqrt(3) + 1, -2],
12111186
[1, sqrt(3) - 1]])
12121187
A = (1/(2*sqrt(2))) * A
@@ -1264,24 +1239,18 @@ for i, example in enumerate(examples):
12641239
ax[i].grid()
12651240
ax[i].set_aspect('equal', adjustable='box')
12661241
1242+
fig.suptitle("Vector fields of the three matrices")
12671243
plt.show()
12681244
```
12691245

1270-
+++ {"user_expressions": []}
1271-
12721246
The vector fields explain why we observed the trajectories of the vector $v$ multiplied by $A$ iteratively before.
12731247

12741248
The pattern demonstrated here is because we have complex eigenvalues and eigenvectors.
12751249

12761250
We can plot the complex plane for one of the matrices using `Arrow3D` class retrieved from [stackoverflow](https://stackoverflow.com/questions/22867620/putting-arrowheads-on-vectors-in-a-3d-plot).
12771251

12781252
```{code-cell} ipython3
1279-
---
1280-
mystnb:
1281-
figure:
1282-
caption: 3D plot of the vector field
1283-
name: 3d-vector-field
1284-
---
1253+
12851254
class Arrow3D(FancyArrowPatch):
12861255
def __init__(self, xs, ys, zs, *args, **kwargs):
12871256
super().__init__((0, 0), (0, 0), *args, **kwargs)
@@ -1334,11 +1303,10 @@ ax.set_ylabel('y')
13341303
ax.set_zlabel('Im')
13351304
ax.set_box_aspect(aspect=None, zoom=0.8)
13361305
1306+
plt.title("3D plot of the vector field")
13371307
plt.draw()
13381308
plt.show()
13391309
```
13401310

1341-
+++ {"user_expressions": []}
1342-
13431311
```{solution-end}
13441312
```

0 commit comments

Comments
 (0)