├── .github └── workflows │ ├── cache.yml │ ├── ci.yml │ ├── coverage.yml │ ├── pdf.yml │ └── preview.yml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── conf.py ├── environment.yml ├── requirements.txt ├── scripts ├── build-website.sh ├── execution-test.sh ├── install_latex.sh ├── linkchecker-test.sh └── texlive.profile ├── sitemap.xml ├── source ├── _static │ ├── includes │ │ ├── header.raw │ │ └── lecture_howto_py.raw │ ├── lecture_specific │ │ ├── aiyagari │ │ │ └── aiyagari_obit.pdf │ │ ├── arellano │ │ │ ├── arellano_bond_prices.png │ │ │ ├── arellano_bond_prices_2.png │ │ │ ├── arellano_default_probs.png │ │ │ ├── arellano_time_series.png │ │ │ └── arellano_value_funcs.png │ │ ├── cake_eating_numerical │ │ │ └── analytical.py │ │ ├── career │ │ │ └── career_solutions_ex1_py.png │ │ ├── coleman_policy_iter │ │ │ └── solve_time_iter.py │ │ ├── finite_markov │ │ │ ├── hamilton_graph.png │ │ │ ├── mc_aperiodicity1.gv │ │ │ ├── mc_aperiodicity1.png │ │ │ ├── mc_aperiodicity2.gv │ │ │ ├── mc_aperiodicity2.png │ │ │ ├── mc_ex1_plot.png │ │ │ ├── mc_irreducibility1.gv │ │ │ ├── mc_irreducibility1.png │ │ │ ├── mc_irreducibility2.gv │ │ │ ├── mc_irreducibility2.png │ │ │ ├── web_graph.png │ │ │ └── web_graph_data.txt │ │ ├── heavy_tails │ │ │ ├── light_heavy_fig1.png │ │ │ └── rank_size_fig1.png │ │ ├── ifp │ │ │ ├── ifp_agg_savings.png │ │ │ ├── ifp_histogram.png │ │ │ ├── ifp_policies.png │ │ │ └── pi2.pdf │ │ ├── kalman │ │ │ ├── kalman_ex3.png │ │ │ ├── kl_ex1_fig.png │ │ │ └── kl_ex2_fig.png │ │ ├── lake_model │ │ │ └── lake_distribution_wages.png │ │ ├── linear_algebra │ │ │ └── course_notes.pdf │ │ ├── linear_models │ │ │ ├── covariance_stationary.png │ │ │ ├── ensemble_mean.png │ │ │ ├── iteration_notes.pdf │ │ │ ├── paths_and_stationarity.png │ │ │ ├── solution_lss_ex1.png │ │ │ ├── solution_lss_ex2.png │ │ │ ├── tsh.png │ │ │ ├── tsh0.png │ │ │ └── tsh_hg.png │ │ ├── lqcontrol │ │ │ ├── solution_lqc_ex1.png │ │ │ ├── solution_lqc_ex2.png │ │ │ ├── solution_lqc_ex3_g1.png │ │ │ ├── solution_lqc_ex3_g10.png │ │ │ └── solution_lqc_ex3_g50.png │ │ ├── markov_perf │ │ │ ├── duopoly_mpe.py │ │ │ ├── judd_fig1.png │ │ │ ├── judd_fig2.png │ │ │ └── mpe_vs_monopolist.png │ │ ├── mccall │ │ │ ├── mccall_resw_alpha.py │ │ │ ├── mccall_resw_beta.py │ │ │ ├── mccall_resw_c.py │ │ │ ├── mccall_resw_gamma.py │ │ │ └── mccall_vf_plot1.py │ │ ├── mccall_model_with_separation │ │ │ ├── mccall_resw_alpha.png │ │ │ ├── mccall_resw_beta.png │ │ │ └── mccall_resw_c.png │ │ ├── mle │ │ │ └── fp.dta │ │ ├── odu │ │ │ └── odu.py │ │ ├── ols │ │ │ ├── maketable1.dta │ │ │ ├── maketable2.dta │ │ │ └── maketable4.dta │ │ ├── optgrowth │ │ │ ├── 3ndp.pdf │ │ │ ├── bellman_operator.py │ │ │ ├── cd_analytical.py │ │ │ ├── solution_og_ex2.png │ │ │ └── solve_model.py │ │ ├── optgrowth_fast │ │ │ ├── ogm.py │ │ │ └── ogm_crra.py │ │ ├── pandas_panel │ │ │ ├── countries.csv │ │ │ ├── employ.csv │ │ │ ├── realwage.csv │ │ │ └── venn_diag.png │ │ ├── perm_income │ │ │ └── perm_inc_ir.py │ │ ├── schelling │ │ │ ├── schelling_fig1.png │ │ │ ├── schelling_fig2.png │ │ │ ├── schelling_fig3.png │ │ │ └── schelling_fig4.png │ │ ├── short_path │ │ │ ├── Graph-networkx2.ipynb │ │ │ ├── graph.png │ │ │ ├── graph2.png │ │ │ ├── graph3.png │ │ │ └── graph4.png │ │ ├── troubleshooting │ │ │ └── launch.png │ │ ├── uncertainty_traps │ │ │ ├── uncertainty_traps_45.png │ │ │ ├── uncertainty_traps_mu.png │ │ │ └── uncertainty_traps_sim.png │ │ ├── wald_friedman │ │ │ ├── wald_class.py │ │ │ ├── wald_dec_rule.png │ │ │ ├── wald_dec_rule.tex │ │ │ └── wf_first_pass.py │ │ └── wealth_dynamics │ │ │ └── htop_again.png │ ├── qe-logo-large.png │ └── quant-econ.bib └── rst │ ├── .ipynb_checkpoints │ ├── Untitled-checkpoint.ipynb │ └── changethis-checkpoint.ipynb │ ├── 404.rst │ ├── _static │ ├── about_lectures.rst │ ├── aiyagari.rst │ ├── ar1_processes.rst │ ├── cake_eating_numerical.rst │ ├── cake_eating_problem.rst │ ├── career.rst │ ├── cass_koopmans_1.rst │ ├── cass_koopmans_2.rst │ ├── coleman_policy_iter.rst │ ├── complex_and_trig.rst │ ├── egm_policy_iter.rst │ ├── exchangeable.rst │ ├── finite_markov.rst │ ├── geom_series.rst │ ├── harrison_kreps.rst │ ├── heavy_tails.rst │ ├── ifp.rst │ ├── ifp_advanced.rst │ ├── index.rst │ ├── index_asset_pricing.rst │ ├── index_data_and_empirics.rst │ ├── index_information.rst │ ├── index_intro_dynam.rst │ ├── index_lq_control.rst │ ├── index_multi_agent_models.rst │ ├── index_savings_growth.rst │ ├── index_search.rst │ ├── index_toc.rst │ ├── index_tools_and_techniques.rst │ ├── inventory_dynamics.rst │ ├── jv.rst │ ├── kalman.rst │ ├── kesten_processes.rst │ ├── lake_model.rst │ ├── likelihood_bayes.rst │ ├── likelihood_ratio_process.rst │ ├── linear_algebra.rst │ ├── linear_models.rst │ ├── lln_clt.rst │ ├── lq_inventories.rst │ ├── lqcontrol.rst │ ├── markov_asset.rst │ ├── markov_perf.rst │ ├── mccall_correlated.rst │ ├── mccall_fitted_vfi.rst │ ├── mccall_model.rst │ ├── mccall_model_with_separation.rst │ ├── mle.rst │ ├── multi_hyper.rst │ ├── multivariate_normal.rst │ ├── navy_captain.rst │ ├── odu.rst │ ├── ols.rst │ ├── optgrowth.rst │ ├── optgrowth_fast.rst │ ├── pandas_panel.rst │ ├── perm_income.rst │ ├── perm_income_cons.rst │ ├── rational_expectations.rst │ ├── re_with_feedback.rst │ ├── samuelson.rst │ ├── scalar_dynam.rst │ ├── schelling.rst │ ├── search.rst │ ├── short_path.rst │ ├── sir_model.rst │ ├── status.rst │ ├── time_series_with_matrices.rst │ ├── troubleshooting.rst │ ├── uncertainty_traps.rst │ ├── wald_friedman.rst │ ├── wealth_dynamics.rst │ └── zreferences.rst └── theme └── minimal ├── static ├── css │ ├── base.css │ └── qe.python.css ├── img │ ├── code-block-fade.png │ ├── powered-by-NumFOCUS-orange.svg │ ├── py-logo.png │ ├── qe-logo.png │ ├── search-icon.png │ └── sloan_logo.png ├── js │ └── base.js └── sloan_logo.png └── templates ├── error_report_template.html ├── html.tpl ├── latex.tpl └── latex_book.tpl /.github/workflows/cache.yml: -------------------------------------------------------------------------------- 1 | # !!! 2 | # Once https://github.com/actions/cache/issues/63 is merged 3 | # this can be enabled for daily cache for full HTML previews 4 | # !!! 5 | # name: Build Website Cache (Nightly) 6 | # on: 7 | # schedule: 8 | # - cron: '1 0 * * *' 9 | # jobs: 10 | # build-cache: 11 | # name: Build Website 12 | # runs-on: ubuntu-latest 13 | # steps: 14 | # - name: Checkout 15 | # uses: actions/checkout@v2 16 | # - name: Setup Anaconda 17 | # uses: goanpeca/setup-miniconda@v1 18 | # with: 19 | # auto-update-conda: true 20 | # auto-activate-base: true 21 | # miniconda-version: 'latest' 22 | # python-version: 3.7 23 | # environment-file: environment.yml 24 | # activate-environment: qe-lectures 25 | # - name: Checkout QuantEcon theme 26 | # uses: actions/checkout@v2 27 | # with: 28 | # repository: QuantEcon/lecture-python.theme 29 | # token: ${{ secrets.ACTIONS_PAT }} 30 | # path: theme/lecture-python.theme 31 | # - name: Get current date 32 | # id: date 33 | # run: echo "::set-output name=date::$(date +'%Y-%m-%d')" 34 | # - name: Cache Website Build Folder 35 | # id: cache 36 | # uses: actions/cache@v1 37 | # with: 38 | # path: _build 39 | # key: cache-sphinx-${{ steps.date.outputs.date }} 40 | # - name: Build Website files 41 | # shell: bash -l {0} 42 | # run: | 43 | # make website THEMEPATH=theme/lecture-python.theme 44 | # ls _build/website/jupyter_html/* 45 | name: Build Website Cache 46 | on: 47 | push: 48 | branches: 49 | - master 50 | jobs: 51 | build-cache: 52 | name: Build Website 53 | runs-on: ubuntu-latest 54 | steps: 55 | - name: Checkout 56 | uses: actions/checkout@v2 57 | - name: Setup Anaconda 58 | uses: conda-incubator/setup-miniconda@v2 59 | with: 60 | auto-update-conda: true 61 | auto-activate-base: true 62 | miniconda-version: 'latest' 63 | python-version: 3.8 64 | environment-file: environment.yml 65 | activate-environment: lecture-python 66 | - name: Checkout QuantEcon theme 67 | uses: actions/checkout@v2 68 | with: 69 | repository: QuantEcon/lecture-python.theme 70 | token: ${{ secrets.ACTIONS_PAT }} 71 | path: theme/lecture-python.theme 72 | - name: Cache Website Build Folder 73 | id: cache 74 | uses: actions/cache@v1 75 | with: 76 | path: _build 77 | key: cache-sphinx 78 | - name: Build Website files 79 | shell: bash -l {0} 80 | run: | 81 | ls theme/lecture-python.theme 82 | make website THEMEPATH=theme/lecture-python.theme 83 | ls _build/website/jupyter_html/* -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Execution and Link Checks 2 | on: [pull_request] 3 | jobs: 4 | tests: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Checkout 8 | uses: actions/checkout@v2 9 | - name: Setup Anaconda 10 | uses: conda-incubator/setup-miniconda@v2 11 | with: 12 | auto-update-conda: true 13 | auto-activate-base: true 14 | miniconda-version: 'latest' 15 | python-version: 3.8 16 | environment-file: environment.yml 17 | activate-environment: lecture-python 18 | - name: Display Conda Environment Versions 19 | shell: bash -l {0} 20 | run: conda list 21 | - name: Display Pip Versions 22 | shell: bash -l {0} 23 | run: pip list 24 | - name: Get Changed Files 25 | id: files 26 | uses: jitterbit/get-changed-files@v1 27 | - name: Run Execution Tests 28 | shell: bash -l {0} 29 | run: bash scripts/execution-test.sh "${{ steps.files.outputs.added_modified }}" 30 | - name: Run Linkchecker 31 | shell: bash -l {0} 32 | run: bash scripts/linkchecker-test.sh "${{ steps.files.outputs.added_modified }}" -------------------------------------------------------------------------------- /.github/workflows/coverage.yml: -------------------------------------------------------------------------------- 1 | name: Execution and Link Testing (Nightly) 2 | on: 3 | schedule: 4 | - cron: '0 17 * * *' 5 | jobs: 6 | coverage: 7 | name: Run Coverage 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v2 12 | - name: Setup Anaconda 13 | uses: conda-incubator/setup-miniconda@v2 14 | with: 15 | auto-update-conda: true 16 | auto-activate-base: true 17 | miniconda-version: 'latest' 18 | python-version: 3.8 19 | environment-file: environment.yml 20 | activate-environment: lecture-python 21 | - name: Run Execution Tests 22 | shell: bash -l {0} 23 | run: make coverage 24 | linkchecker: 25 | name: Run linkchecker 26 | runs-on: ubuntu-latest 27 | steps: 28 | - name: Checkout 29 | uses: actions/checkout@v2 30 | - name: Setup Anaconda 31 | uses: conda-incubator/setup-miniconda@v2 32 | with: 33 | auto-update-conda: true 34 | auto-activate-base: true 35 | miniconda-version: 'latest' 36 | python-version: 3.8 37 | environment-file: environment.yml 38 | activate-environment: lecture-python 39 | - name: Run Linkchecker 40 | shell: bash -l {0} 41 | run: make linkcheck -------------------------------------------------------------------------------- /.github/workflows/pdf.yml: -------------------------------------------------------------------------------- 1 | name: Build PDF 2 | on: 3 | push: 4 | branch: 5 | - master 6 | jobs: 7 | pdf: 8 | name: Build PDF 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout 12 | uses: actions/checkout@v2 13 | - name: Install Fonts 14 | run: | 15 | sudo apt-get install -y fonts-liberation 16 | sudo apt-get install -y fonts-cmu 17 | - name: TexLive Cache 18 | id: cache 19 | uses: actions/cache@v1 20 | with: 21 | path: /tmp/texlive 22 | key: cache-texlive 23 | - name: Install & Update TexLive 24 | shell: bash -l {0} 25 | run: | 26 | bash scripts/install_latex.sh 27 | echo 'export PATH=/tmp/texlive/bin/x86_64-linux:$PATH' >> ~/.bash_profile 28 | source ~/.bash_profile 29 | xelatex --version 30 | - name: Setup Anaconda 31 | uses: conda-incubator/setup-miniconda@v2 32 | with: 33 | auto-update-conda: true 34 | auto-activate-base: true 35 | miniconda-version: 'latest' 36 | python-version: 3.8 37 | environment-file: environment.yml 38 | activate-environment: lecture-python 39 | - name: Checkout QuantEcon theme 40 | uses: actions/checkout@v2 41 | with: 42 | repository: QuantEcon/lecture-python.theme 43 | token: ${{ secrets.ACTIONS_PAT }} 44 | path: theme/lecture-python.theme 45 | - name: Build PDF 46 | shell: bash -l {0} 47 | run: | 48 | more ~/.bash_profile 49 | echo 'export PATH=/tmp/texlive/bin/x86_64-linux:$PATH' >> ~/.bash_profile 50 | source ~/.bash_profile 51 | more ~/.bash_profile 52 | ls theme/lecture-python.theme 53 | make pdf 54 | - uses: actions/upload-artifact@v2 55 | with: 56 | name: pdf 57 | path: _build/jupyterpdf/texbook/quantitative_economics_with_python.pdf -------------------------------------------------------------------------------- /.github/workflows/preview.yml: -------------------------------------------------------------------------------- 1 | name: 'Netlify Preview Deploy' 2 | on: 3 | pull_request: 4 | types: ['opened', 'edited', 'synchronize'] 5 | jobs: 6 | deploy-preview: 7 | name: 'Deploy' 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v2 12 | - name: Setup Anaconda 13 | uses: conda-incubator/setup-miniconda@v2 14 | with: 15 | auto-update-conda: true 16 | auto-activate-base: true 17 | miniconda-version: 'latest' 18 | python-version: 3.8 19 | environment-file: environment.yml 20 | activate-environment: lecture-python 21 | - name: Get Changed Files 22 | id: files 23 | uses: jitterbit/get-changed-files@v1 24 | - name: Checkout QuantEcon theme 25 | if: github.event.pull_request.head.repo.full_name == github.repository 26 | uses: actions/checkout@v2 27 | with: 28 | repository: QuantEcon/lecture-python.theme 29 | token: ${{ secrets.ACTIONS_PAT }} 30 | path: theme/lecture-python.theme 31 | # - name: Get current date 32 | # id: date 33 | # run: echo "::set-output name=date::$(date +'%Y-%m-%d')" 34 | - name: Check Sphinx Cache 35 | id: cache 36 | uses: actions/cache@v1 37 | with: 38 | path: _build 39 | key: cache-sphinx 40 | # key: cache-sphinx-${{ steps.date.outputs.date }} 41 | - name: Build website files 42 | shell: bash -l {0} 43 | run: | 44 | bash scripts/build-website.sh "${{ steps.files.outputs.added_modified }}" "${{ github.event.pull_request.head.repo.full_name == github.repository }}" 45 | - name: Preview Deploy to Netlify 46 | uses: nwtgck/actions-netlify@v1.1 47 | if: env.BUILD_NETLIFY == 'true' && github.event.pull_request.head.repo.full_name == github.repository 48 | with: 49 | publish-dir: './_build/website/jupyter_html' 50 | production-branch: master 51 | github-token: ${{ secrets.GITHUB_TOKEN }} 52 | deploy-message: "Preview Deploy from GitHub Actions" 53 | env: 54 | NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} 55 | NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} 56 | - name: Save Build as Artifact (Forks) 57 | uses: actions/upload-artifact@v1 58 | if: github.event.pull_request.head.repo.full_name != github.repository 59 | with: 60 | name: website 61 | path: _build/website/jupyter_html -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _build/ 2 | dask-worker-space/ 3 | [._]*.s[a-v][a-z] 4 | [._]*.sw[a-p] 5 | [._]s[a-v][a-z] 6 | [._]sw[a-p] 7 | .DS_Store 8 | .DS_Store? 9 | **/.DS_Store 10 | venv/ 11 | theme/lecture-python.theme 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2020, QuantEcon 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SHELL := bash 2 | # 3 | # Makefile for Sphinx Extension Test Cases 4 | # 5 | 6 | # You can set these variables from the command line. 7 | SPHINXOPTS = -c "./" 8 | SPHINXBUILD = python -msphinx 9 | SPHINXPROJ = lecture-python 10 | SOURCEDIR = source/rst 11 | BUILDDIR = _build 12 | BUILDWEBSITE = _build/website 13 | BUILDCOVERAGE = _build/coverage 14 | BUILDPDF = _build/pdf 15 | PORT = 8890 16 | FILES = 17 | THEMEPATH = theme/minimal 18 | TEMPLATEPATH = $(THEMEPATH)/templates 19 | 20 | # Put it first so that "make" without argument is like "make help". 21 | help: 22 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(FILES) $(SPHINXOPTS) $(O) 23 | 24 | .PHONY: help Makefile 25 | 26 | # Install requiremenets for building lectures. 27 | setup: 28 | pip install -r requirements.txt 29 | 30 | preview: 31 | ifeq (,$(filter $(target),website Website)) 32 | cd $(BUILDWEBSITE)/jupyter_html && python -m http.server $(PORT) 33 | else 34 | ifdef lecture 35 | cd $(BUILDDIR)/jupyter/ && jupyter notebook --port $(PORT) --port-retries=0 $(basename $(lecture)).ipynb 36 | else 37 | cd $(BUILDDIR)/jupyter/ && jupyter notebook --port $(PORT) --port-retries=0 38 | endif 39 | endif 40 | 41 | clean-coverage: 42 | rm -rf $(BUILDCOVERAGE) 43 | 44 | clean-website: 45 | rm -rf $(BUILDWEBSITE) 46 | 47 | clean-pdf: 48 | rm -rf $(BUILDDIR)/jupyterpdf 49 | 50 | coverage: 51 | ifneq ($(strip $(parallel)),) 52 | @$(SPHINXBUILD) -M jupyter "$(SOURCEDIR)" "$(BUILDCOVERAGE)" $(FILES) $(SPHINXOPTS) $(O) -D jupyter_make_coverage=1 -D jupyter_execute_notebooks=1 -D jupyter_ignore_skip_test=0 -D jupyter_theme_path="$(THEMEPATH)" -D jupyter_template_path="$(TEMPLATEPATH)" -D jupyter_template_coverage_file_path="error_report_template.html" -D jupyter_number_workers=$(parallel) 53 | else 54 | @$(SPHINXBUILD) -M jupyter "$(SOURCEDIR)" "$(BUILDCOVERAGE)" $(FILES) $(SPHINXOPTS) $(O) -D jupyter_make_coverage=1 -D jupyter_execute_notebooks=1 -D jupyter_ignore_skip_test=0 -D jupyter_theme_path="$(THEMEPATH)" -D jupyter_template_path="$(TEMPLATEPATH)" -D jupyter_template_coverage_file_path="error_report_template.html" 55 | endif 56 | 57 | website: 58 | echo "Theme: $(THEMEPATH)" 59 | ifneq ($(strip $(parallel)),) 60 | @$(SPHINXBUILD) -M jupyter "$(SOURCEDIR)" "$(BUILDWEBSITE)" $(FILES) $(SPHINXOPTS) $(O) -D jupyter_make_site=1 -D jupyter_generate_html=1 -D jupyter_download_nb=1 -D jupyter_execute_notebooks=1 -D jupyter_target_html=1 -D jupyter_download_nb_image_urlpath="https://s3-ap-southeast-2.amazonaws.com/python.quantecon.org/_static/" -D jupyter_images_markdown=0 -D jupyter_theme_path="$(THEMEPATH)" -D jupyter_template_path="$(TEMPLATEPATH)" -D jupyter_html_template="html.tpl" -D jupyter_download_nb_urlpath="https://python-programming.quantecon.org/" -D jupyter_coverage_dir=$(BUILDCOVERAGE) -D jupyter_number_workers=$(parallel) 61 | 62 | else 63 | @$(SPHINXBUILD) -M jupyter "$(SOURCEDIR)" "$(BUILDWEBSITE)" $(FILES) $(SPHINXOPTS) $(O) -D jupyter_make_site=1 -D jupyter_generate_html=1 -D jupyter_download_nb=1 -D jupyter_execute_notebooks=1 -D jupyter_target_html=1 -D jupyter_download_nb_image_urlpath="https://s3-ap-southeast-2.amazonaws.com/python.quantecon.org/_static/" -D jupyter_images_markdown=0 -D jupyter_theme_path="$(THEMEPATH)" -D jupyter_template_path="$(TEMPLATEPATH)" -D jupyter_html_template="html.tpl" -D jupyter_download_nb_urlpath="https://python-programming.quantecon.org/" -D jupyter_coverage_dir=$(BUILDCOVERAGE) 64 | endif 65 | 66 | pdf: 67 | ifneq ($(strip $(parallel)),) 68 | @$(SPHINXBUILD) -M jupyterpdf "$(SOURCEDIR)" "$(BUILDDIR)" $(FILES) $(SPHINXOPTS) $(O) -D jupyter_latex_template="latex.tpl" -D jupyter_theme_path="$(THEMEPATH)" -D jupyter_template_path="$(TEMPLATEPATH)" -D jupyter_latex_template_book="latex_book.tpl" -D jupyter_images_markdown=1 -D jupyter_execute_notebooks=1 -D jupyter_pdf_book=1 -D jupyter_target_pdf=1 -D jupyter_number_workers=$(parallel) 69 | 70 | else 71 | @$(SPHINXBUILD) -M jupyterpdf "$(SOURCEDIR)" "$(BUILDDIR)" $(FILES) $(SPHINXOPTS) $(O) -D jupyter_theme_path="$(THEMEPATH)" -D jupyter_template_path="$(TEMPLATEPATH)" -D jupyter_latex_template="latex.tpl" -D jupyter_latex_template_book="latex_book.tpl" -D jupyter_images_markdown=1 -D jupyter_execute_notebooks=1 -D jupyter_pdf_book=1 -D jupyter_target_pdf=1 72 | endif 73 | 74 | constructor-pdf: 75 | ifneq ($(strip $(parallel)),) 76 | @$(SPHINXBUILD) -M jupyter "$(SOURCEDIR)" "$(BUILDPDF)" $(FILES) $(SPHINXOPTS) $(O) -D jupyter_images_markdown=1 -D jupyter_execute_notebooks=1 -D jupyter_number_workers=$(parallel) 77 | 78 | else 79 | @$(SPHINXBUILD) -M jupyter "$(SOURCEDIR)" "$(BUILDPDF)" $(FILES) $(SPHINXOPTS) $(O) -D jupyter_images_markdown=1 -D jupyter_execute_notebooks=1 80 | endif 81 | 82 | notebooks: 83 | make jupyter 84 | 85 | # Catch-all target: route all unknown targets to Sphinx using the new 86 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 87 | %: Makefile 88 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(FILES) $(SPHINXOPTS) $(O) -D jupyter_allow_html_only=1 89 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lecture-python 2 | 3 | Source files for https://python.quantecon.org 4 | 5 | For a guide on contributing to this repository click [here](https://quantecon.org/contribute-lectures/) 6 | -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | 2 | name: lecture-python 3 | channels: 4 | - default 5 | dependencies: 6 | - python=3.8 7 | - anaconda=2020.07 8 | - pip 9 | - pip: 10 | - quantecon 11 | - interpolation 12 | - sphinxcontrib-jupyter 13 | - sphinxcontrib-bibtex==1.0 14 | - joblib 15 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | sphinxcontrib-bibtex 2 | sphinxcontrib-jupyter 3 | quantecon -------------------------------------------------------------------------------- /scripts/build-website.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MODIFIED_FILES="$1" 4 | PRIVATE_THEME=$2 5 | 6 | # Find List of RST Files 7 | RST_FILES="" 8 | for F in $MODIFIED_FILES 9 | do 10 | if [[ $F == *.rst ]] 11 | then 12 | RST_FILES="$RST_FILES $F" 13 | fi 14 | done 15 | echo "List of Changed RST Files: $RST_FILES" 16 | echo "Building with Private theme: $PRIVATE_THEME" 17 | if [ -z "$RST_FILES" ]; then 18 | echo "BUILD_NETLIFY=false" >> $GITHUB_ENV 19 | echo "No RST Files have changed -- nothing to do in this PR" 20 | else 21 | echo "BUILD_NETLIFY=true" >> $GITHUB_ENV 22 | RST_FILES="$RST_FILES source/rst/index_toc.rst" 23 | if [ "$PRIVATE_THEME" = true ]; then 24 | make website THEMEPATH=theme/lecture-python.theme FILES="$RST_FILES" 25 | else 26 | make website FILES="$RST_FILES" 27 | fi 28 | ls _build/website/jupyter_html/* #Ensure build files are created 29 | fi -------------------------------------------------------------------------------- /scripts/execution-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CLEAN_BUILD=false 4 | MODIFIED_FILES="$1" 5 | 6 | RST_FILES="" 7 | for F in $MODIFIED_FILES 8 | do 9 | if [[ $F == environment.yml ]] 10 | then 11 | CLEAN_BUILD=true 12 | break 13 | fi 14 | #Extract List of RST Files 15 | if [[ $F == *.rst ]] 16 | then 17 | RST_FILES="$RST_FILES $F" 18 | fi 19 | done 20 | 21 | echo "List of Changed RST Files: $RST_FILES" 22 | echo "Clean Build Requested: $CLEAN_BUILD" 23 | 24 | if [ "$CLEAN_BUILD" = true ] 25 | then 26 | echo "Running Clean Build" 27 | make coverage 28 | elif [ -z "$RST_FILES" ] 29 | then 30 | echo "No RST Files have changed -- nothing to do in this PR" 31 | else 32 | RST_FILES="$RST_FILES source/rst/index_toc.rst" 33 | echo "Running Selecting Build with: $RST_FILES" 34 | make coverage FILES="$RST_FILES" 35 | fi -------------------------------------------------------------------------------- /scripts/install_latex.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # setup script to install texlive and add to path for travis 4 | # original source: https://shankarkulumani.com/2018/10/travis-and-latex.html 5 | sudo apt-get -qq update 6 | export PATH=/tmp/texlive/bin/x86_64-linux:$PATH 7 | if ! command -v pdflatex > /dev/null; then 8 | echo "Texlive not installed" 9 | echo "Downloading texlive and installing" 10 | wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz 11 | tar -xzf install-tl-unx.tar.gz 12 | ./install-tl-*/install-tl --profile=./scripts/texlive.profile 13 | echo "Finished install TexLive" 14 | fi 15 | echo "Now updating TexLive" 16 | # update texlive 17 | tlmgr option -- autobackup 0 18 | tlmgr update --self --all --no-auto-install 19 | echo "Finished updating TexLive" 20 | -------------------------------------------------------------------------------- /scripts/linkchecker-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MODIFIED_FILES="$1" 4 | 5 | RST_FILES="" 6 | for F in $MODIFIED_FILES 7 | do 8 | if [[ $F == *.rst ]] 9 | then 10 | RST_FILES="$RST_FILES $F" 11 | fi 12 | done 13 | echo "List of Changed RST Files: $RST_FILES" 14 | if [ -z "$RST_FILES" ]; then 15 | echo "No RST Files have changed -- nothing to do in this PR" 16 | else 17 | RST_FILES="$RST_FILES source/rst/index_toc.rst" 18 | make linkcheck FILES="$RST_FILES" 19 | fi -------------------------------------------------------------------------------- /scripts/texlive.profile: -------------------------------------------------------------------------------- 1 | selected_scheme scheme-full 2 | TEXDIR /tmp/texlive 3 | TEXMFCONFIG ~/.texlive/texmf-config 4 | TEXMFHOME ~/texmf 5 | TEXMFLOCAL /tmp/texlive/texmf-local 6 | TEXMFSYSCONFIG /tmp/texlive/texmf-config 7 | TEXMFSYSVAR /tmp/texlive/texmf-var 8 | TEXMFVAR ~/.texlive/texmf-var 9 | option_doc 0 10 | option_src 0 11 | -------------------------------------------------------------------------------- /source/_static/includes/header.raw: -------------------------------------------------------------------------------- 1 | .. raw:: html 2 | 3 |
This website presents a set of lectures on quantitative economic modeling, designed and written by Thomas J. Sargent and John Stachurski.
21 |Last compiled:
22 | View source |
23 | View commits | See all contributors
A print-ready version for viewing offline
46 | 47 |Get the full set of Jupyter notebooks
53 | 54 |The badges below show which lectures are currently passing their execution test (i.e., executing without errors).
11 |The lecture code checker was last run: N/A
12 |The code checker is run on a t2.small
Amazon EC2 instance. This is an instance with a single CPU and 2 GiB of Memory.
You should achieve faster run times on many common laptops and desktops.
-------------------------------------------------------------------------------- /source/rst/time_series_with_matrices.rst: -------------------------------------------------------------------------------- 1 | .. _time_series_with_matrices: 2 | 3 | .. include:: /_static/includes/header.raw 4 | 5 | .. highlight:: python3 6 | 7 | ******************************************** 8 | Univariate Time Series with Matrix Algebra 9 | ******************************************** 10 | 11 | .. contents:: :depth: 2 12 | 13 | 14 | 15 | Overview 16 | ======== 17 | 18 | This lecture uses matrices to solve some linear difference equations. 19 | 20 | As a running example, we’ll study a **second-order linear difference 21 | equation** that was the key technical tool in Paul Samuelson’s 1939 22 | article :cite:`Samuelson1939` that introduced the **multiplier-accelerator** model. 23 | 24 | This model became the workhorse that powered early econometric versions of 25 | Keynesian macroeconomic models in the United States. 26 | 27 | You can read about the details of that model in :doc:`this