BUG: Fix Samuelson quadratic formula - #1066
Merged
Merged
Conversation
The polynomial is z^2 - ρ1 z - ρ2 = 0, so the roots are (ρ1 ± sqrt(ρ1^2 + 4 ρ2)) / 2. The by-hand formula in y_nonstochastic used -ρ1 in every branch.
The Samuelson class and analyze_roots use ρ1 = α+β, ρ2 = -β from
I_t = β(Y_{t-1} - Y_{t-2}). The docstring still had the 1939
consumption-accelerator form α(1+β), -αβ.
📖 Netlify Preview Ready!Preview URL: https://pr-1066--sunny-cactus-210e3e.netlify.app Commit: 📚 Changed LecturesBuild Info
|
The non-raw docstring turned \a and \b in \alpha and \beta into control characters. Also add the sigma epsilon_t term, since the class supports a stochastic model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Thanks very much, Chase, for bringing this to our attention, and for the PR! Your two fixes look right to us:
I've added one small follow-up commit to the docstring:
I ran the lecture end to end on the branch. The by-hand roots now agree with |
Contributor
|
@mmcky This looks good to me, pls merge when ready. |
Contributor
|
thanks @blkboxeconomist and @jstac. |
Contributor
✅ Translation sync completed (zh-cn)Target repo: QuantEcon/lecture-python.zh-cn
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small bugs.
One is a typo in the documentation for the class that uses the formulas for the old version of the Samuelson lecture and the second is a typo in finding the roots of the characteristic equation.
First is self-explanatory once you look at it.
For the second