-
-
Notifications
You must be signed in to change notification settings - Fork 528
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
Added enhancement for power series that allows access to the coefficients of specific terms #39480
base: develop
Are you sure you want to change the base?
Added enhancement for power series that allows access to the coefficients of specific terms #39480
Conversation
…ients of specific terms
Thanks for the enhancement. I will set to positive review on Wednesday if there are no other comments and However, I think the initial docstring can be clarified. Perhaps something like:
|
Documentation preview for this PR (built with commit 97cb9fb; changes) is ready! 🎉 |
Sorry, I thought I already told you this, but it's not in my comment above, so apparently not: you need to change |
@@ -690,9 +694,29 @@ def __getitem__(self, n): | |||
... | |||
IndexError: Cannot return terms of total degree greater than or | |||
equal to precision of self. | |||
""" | |||
|
|||
Ensure that the enhancment detailed in :issue:`39314` works as intended:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the enhancment detailed in :issue:`39314` works as intended:: | |
Ensure that the enhancement detailed in :issue:`39314` works as intended:: |
if type(n) is tuple: | ||
if sum(n) >= self.prec(): | ||
raise IndexError("Cannot return the coefficients of terms of " + | ||
"total degree greater than or equal to precision of self.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't that be indented further? please check!
I'm a bit split on this solution, because it makes power series behave differently from everything else. Did you think about the possibility of a more generic solution? It would be good to at least try to unify the interface for polynomials, power series and lazy power series. |
Fixes #39314. Adds an enhancement to power series that when given a tuple of values corresponding to the powers of the term gives you the coefficient for said term. Functionality is similar to how coefficients are retrieved for multivariable polynomials. Also added a test for the enhancement.
📝 Checklist
⌛ Dependencies