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
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,16 @@ updates:
prefix: ⬆️
schedule:
interval: weekly

- package-ecosystem: "conda"
directory: "/"
commit-message:
prefix: ⬆️
schedule:
interval: weekly
ignore:
- dependency-name: "jupyter-book"
versions: [">=2.0"]
- dependency-name: "python"
# Python version should be constrained by the anaconda distribution version
versions: [">0"]
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ jobs:
- name: Display Pip Versions
shell: bash -l {0}
run: pip list
- name: Download "build" folder (cache)
uses: dawidd6/action-download-artifact@v11
with:
workflow: cache.yml
branch: main
name: build-cache
path: _build
# - name: Download "build" folder (cache)
# uses: dawidd6/action-download-artifact@v11
# with:
# workflow: cache.yml
# branch: main
# name: build-cache
# path: _build
# Build Assets (Download Notebooks and PDF via LaTeX)
- name: Build Download Notebooks (sphinx-tojupyter)
shell: bash -l {0}
Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ channels:
- default
dependencies:
- python=3.13
- anaconda=2025.06
- anaconda=2025.12
- pip
- pip:
- jupyter-book==1.0.4post1
- quantecon-book-theme==0.15.0
- jupyter-book>=1.0.4post1,<2.0
- quantecon-book-theme==0.15.1
- sphinx-tojupyter==0.4.0
- sphinxext-rediraffe==0.2.7
- sphinx-exercise==1.2.0
Expand Down
9 changes: 4 additions & 5 deletions lectures/newton_method.md
Original file line number Diff line number Diff line change
Expand Up @@ -1074,22 +1074,21 @@ Let's run through each initial guess and check the output
```{code-cell} ipython3
:tags: [raises-exception]

attempt = 1
for init in initLs:
for attempt, init in enumerate(initLs, start=1):
print(f"Attempt {attempt}: Starting value is {init} \n")
%time p = newton(lambda p: e(p, A, b, c), init, tol=1e-15, max_iter=15)
print("-" * 64)
attempt += 1
```

We can see that Newton's method may fail for some starting values.

Sometimes it may take a few initial guesses to achieve convergence.

Substitute the result back to the formula to check our result
Substitute the result back to the formula to check our result using the second initial guess which converges

```{code-cell} ipython3
e(p, A, b, c)
p_solution = newton(lambda p: e(p, A, b, c), initLs[1], tol=1e-15, max_iter=15)
e(p_solution, A, b, c)
```

We can see the result is very accurate.
Expand Down
Loading