-
- Notifications
You must be signed in to change notification settings - Fork 26
Update SymPy in Equalizing Differences Lecture #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for taupe-gaufre-c4e660 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
| @HumphreyYang I am a bit confused. Is this migrating the |
Hi @mmcky, Yes, this is trying to apply the SymPy code to this lecture. While I am migrating, I find SymPy code might illustrate the concept better, so I put them into the last section of this lecture to ask for your opinion on this. |
| Hi @shlff and @Smit-create. I have written a SymPy version of equalizing differences model lecture. Our aim is to present this lecture better by giving the code immediately after the formula and using simpler code in SymPy. So I am selling this to you first for your review/opinions. Please find the new SymPy version here: and the old version here: Many thanks in advance. |
| Thanks @HumphreyYang . I will take a quick review soon. |
| @HumphreyYang I really like the |
Hi @mmcky, That is right. I think it is a problem of symbolic programming in general. For simple expressions, they can present them pretty well, but for more complex cases (i.e. taking a derivative of a complex equation), it can look messy. In defense of Nonetheless, I think the previous |
@HumphreyYang so the variations in the values that are computed from the default values -- is that expected - or is there something stochastic going on in generating those values. |
Hi @mmcky, Many thanks for raising this! This is expected. My model was inherited from the previous section with an entrepreneur component, and thus with a The rationale for this deviation is that, in the current version, the text does not flow well given the derivative is calculated based on the formula in the first model, instead of the second model (entrepreneur model), so there is a jump back to the first model in our derivative analysis. This PR fixes this issue by presenting the entrepreneur model, which is a generalization of the first model (the first model is just a special case of the entrepreneur model with |
| Thanks for explaining that @HumphreyYang that makes sense. |
Did I successfully sell this to you @mmcky? If yes, we can pass it on to John I guess : ) |
| Typo in original: "And doing that will let illustrate how good Python is at doing calculus!" |
| Hi @HumphreyYang (CC @mmcky). I reviewed this and, although the coding is very nice, I have mixed feelings about it. Our core mission is quantitative economics, and working with NumPy is a simpler approach to basic quantitative analysis. So I think we should start with NumPy code. I suggest that we do a clean up of the NumPy code and then show how SymPy can add to the analysis in a separate section. I propose that we
Sound reasonable? |
| Many thanks @jstac, Sounds great to me! |

Hi @jstac and @mmcky,
This PR is a preview of using SymPy to solve equalizing differences model.
I put the code into the last section as a draft, which is a replicate of what has been done in NumPy. I feel the SymPy version of the implementation is more concise and intuitive.
I think this lecture may be better presented if we use the SymPy version to guide students through the equations and explore graphs and derivatives, and we put the NumPy version as an exercise to ask students to implement this model in NumPy. The benefit is that readers can see the code and derivation immediately after they see the formula, and it is light in terms of designing the code.
Could you please kindly let me know your thoughts on this?
Many thanks in advance.