Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
auto-update-conda: true
auto-activate-base: true
miniconda-version: 'latest'
python-version: "3.12"
python-version: "3.13"
environment-file: environment.yml
activate-environment: quantecon
- name: Build HTML
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
auto-update-conda: true
auto-activate-base: true
miniconda-version: 'latest'
python-version: "3.12"
python-version: "3.13"
environment-file: environment.yml
activate-environment: quantecon
- name: Install latex dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/execution-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.12"]
python-version: ["3.13"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/execution-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
os: ["macos-latest"]
python-version: ["3.12"]
python-version: ["3.13"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/execution-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
os: ["windows-latest"]
python-version: ["3.12"]
python-version: ["3.13"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
auto-update-conda: true
auto-activate-base: true
miniconda-version: 'latest'
python-version: "3.12"
python-version: "3.13"
environment-file: environment.yml
activate-environment: quantecon
- name: Install latex dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dask-worker-space
.ipynb_checkpoints/
.virtual_documents/

lectures/sine_wave.py
lectures/mathfoo.py
lectures/mod.py
lectures/test.py
13 changes: 6 additions & 7 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ name: quantecon
channels:
- default
dependencies:
- python=3.12
- anaconda=2024.10
- python=3.13
- anaconda=2025.06
- pip
- pip:
- jupyter-book==1.0.3
- quantecon-book-theme==0.8.2
- sphinx-tojupyter==0.3.0
- jupyter-book==1.0.4post1
- quantecon-book-theme==0.8.3
- sphinx-tojupyter==0.3.1
- sphinxext-rediraffe==0.2.7
- sphinx-exercise==1.0.1
- ghp-import==2.1.0
- sphinxcontrib-youtube==1.3.0 #Version 1.3.0 is required as quantecon-book-theme is only compatible with sphinx<=5
- sphinxcontrib-youtube==1.4.1
- sphinx-togglebutton==0.3.2


2 changes: 1 addition & 1 deletion lectures/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ You will spend a lot of time debugging code, so it is important to [learn how to
If you are using a newer version of Jupyter, you should see a bug icon on the right end of the toolbar.

```{figure} /_static/lecture_specific/getting_started/debug.png
:scale: 80%
:scale: 50%
:figclass: auto
```

Expand Down
13 changes: 7 additions & 6 deletions lectures/matplotlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ If everything is properly configured, then adding LaTeX is trivial

```{code-cell} python3
fig, ax = plt.subplots()
ax.plot(x, y, 'r-', linewidth=2, label='$y=\sin(x)$', alpha=0.6)
ax.plot(x, y, 'r-', linewidth=2, label=r'$y=\sin(x)$', alpha=0.6)
ax.legend(loc='upper center')
plt.show()
```
Expand All @@ -131,7 +131,7 @@ Controlling the ticks, adding titles and so on is also straightforward

```{code-cell} python3
fig, ax = plt.subplots()
ax.plot(x, y, 'r-', linewidth=2, label='$y=\sin(x)$', alpha=0.6)
ax.plot(x, y, 'r-', linewidth=2, label=r'$y=\sin(x)$', alpha=0.6)
ax.legend(loc='upper center')
ax.set_yticks([-1, 0, 1])
ax.set_title('Test plot')
Expand Down Expand Up @@ -163,7 +163,7 @@ x = np.linspace(-4, 4, 150)
for i in range(3):
m, s = uniform(-1, 1), uniform(1, 2)
y = norm.pdf(x, loc=m, scale=s)
current_label = f'$\mu = {m:.2}$'
current_label = rf'$\mu = {m:.2}$'
ax.plot(x, y, linewidth=2, alpha=0.6, label=current_label)
ax.legend()
plt.show()
Expand All @@ -186,7 +186,7 @@ for i in range(num_rows):
m, s = uniform(-1, 1), uniform(1, 2)
x = norm.rvs(loc=m, scale=s, size=100)
axes[i, j].hist(x, alpha=0.6, bins=20)
t = f'$\mu = {m:.2}, \quad \sigma = {s:.2}$'
t = rf'$\mu = {m:.2}, \quad \sigma = {s:.2}$'
axes[i, j].set(title=t, xticks=[-4, 0, 4], yticks=[])
plt.show()
```
Expand Down Expand Up @@ -419,7 +419,7 @@ x = np.linspace(-4, 4, 150)
for i in range(3):
m, s = uniform(-1, 1), uniform(1, 2)
y = norm.pdf(x, loc=m, scale=s)
current_label = f'$\mu = {m:.2}$'
current_label = rf'$\mu = {m:.2}$'
ax.plot(x, y, linewidth=2, alpha=0.6, label=current_label)
ax.legend()
plt.show()
Expand Down Expand Up @@ -462,8 +462,9 @@ Place all the curves in the same figure.

The output should look like this

```{figure} /_static/lecture_specific/matplotlib/matplotlib_ex1.png
```{image} /_static/lecture_specific/matplotlib/matplotlib_ex1.png
:scale: 130
:align: center
```

```{exercise-end}
Expand Down
3 changes: 2 additions & 1 deletion lectures/numba.md
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,8 @@ Suppose that the volatility of returns on an asset can be in one of two regimes

The transition probabilities across states are as follows

```{figure} /_static/lecture_specific/sci_libs/nfs_ex1.png
```{image} /_static/lecture_specific/sci_libs/nfs_ex1.png
:align: center
```

For example, let the period length be one day, and suppose the current state is high.
Expand Down
1 change: 1 addition & 0 deletions lectures/oop_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ We'll make use of the following third party library


```{code-cell} python3
:tags: [hide-output]
!pip install rich
```

Expand Down
6 changes: 4 additions & 2 deletions lectures/pandas.md
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,9 @@ ticker = read_data(ticker_list)

Complete the program to plot the result as a bar graph like this one:

```{figure} /_static/lecture_specific/pandas/pandas_share_prices.png
```{image} /_static/lecture_specific/pandas/pandas_share_prices.png
:scale: 80
:align: center
```

```{exercise-end}
Expand Down Expand Up @@ -748,8 +749,9 @@ indices_list = {'^GSPC': 'S&P 500',

Complete the program to show summary statistics and plot the result as a time series graph like this one:

```{figure} /_static/lecture_specific/pandas/pandas_indices_pctchange.png
```{image} /_static/lecture_specific/pandas/pandas_indices_pctchange.png
:scale: 80
:align: center
```

```{exercise-end}
Expand Down
4 changes: 2 additions & 2 deletions lectures/pandas_panel.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ the row index (`.unstack()` works in the opposite direction - try it
out)

```{code-cell} ipython3
realwage.stack().head()
realwage.stack(future_stack=True).head()
```

We can also pass in an argument to select the level we would like to
Expand Down Expand Up @@ -432,7 +432,7 @@ plt.show()
summary statistics

```{code-cell} ipython3
merged.stack().describe()
merged.stack(future_stack=True).describe()
```

This is a simplified way to use `groupby`.
Expand Down
23 changes: 12 additions & 11 deletions lectures/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ jupytext:
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.17.2
kernelspec:
display_name: Python 3
language: python
name: python3
display_name: Python 3 (ipykernel)
language: python
---

(workspace)=
Expand Down Expand Up @@ -51,7 +53,7 @@ Python files are used when writing long, reusable blocks of code - by convention

Let us begin by working with the following example.

```{code-block} python
```{code-cell} ipython3
:caption: sine_wave.py
:lineno-start: 1

Expand All @@ -68,17 +70,18 @@ plt.title('Sine Wave')
plt.show()
```

The code is first saved locally on the computer before it is executed.

As there are various ways to execute the code, we will explore them in the context of different development environments.

One major advantage of using Python scripts lies in the fact that you can "import" functionality from other scripts into your current script or Jupyter Notebook.

Let's rewrite the earlier code into a function.
Let's rewrite the earlier code into a function and write to to a file called `sine_wave.py`.

```{code-block} python
```{code-cell} ipython3
:caption: sine_wave.py
:lineno-start: 1

%%writefile sine_wave.py

import matplotlib.pyplot as plt
import numpy as np

Expand All @@ -94,7 +97,7 @@ def plot_wave(title : str = 'Sine Wave'):
plt.show()
```

```{code-block} python
```{code-cell} ipython3
:caption: second_script.py
:lineno-start: 1

Expand Down Expand Up @@ -345,9 +348,7 @@ In case you already haven't, try

For example, if you've installed the command line version, open up a terminal and enter.

```{code-block} bash
:class: no-execute

```bash
git clone https://github.com/QuantEcon/QuantEcon.py
```
(This is just `git clone` in front of the URL for the repository)
Expand Down
Loading