-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Improved itermonomials #16561
Improved itermonomials #16561
Conversation
✅ Hi, I am the SymPy bot (v147). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.5. Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
There is trailing whitespace that should be removed:
This is the first error, there may be others. You can find them by running |
Please try to write instructive release notes. I updated it, but please check that what I wrote is correct and that I didn't miss anything. |
Perhaps we should make the function a generator (with |
Thanks for all your comments and suggestions. |
Changing the return type to generator has caused some failures. One of the places that have to be fixed is here sympy/sympy/integrals/heurisch.py Lines 566 to 569 in 136766a
On the two lines, monoms should be defined as tuple(itermonomials(...)) . That should take care of a number of errors. You can check them locally by running bin/test heurisch .
|
from generators
`min_degrees` and `max_degrees`. Negative `max_degrees` raises `ValueError` instead of returning an empty Set. Split double conditions in `if` statements to multiple `if`'s.
objects, using `next()` and `set()`. Also, added `raises()` for new `ValueError`'s in case of negative `max_degrees`.
Some old examples didn't work with the generators implementation. Fixed them forcing list/set to match each example's result. There was also an error in line 89 while the online tester was parsing the file and finding EOF. I added a "\" character to hopefully escape the whitespace.
Removed extra comma causing error in tests from line 64.
The "\" character didn't work, so I merged the two lines.
Title underline in docstring of itermonomials was too short.
Codecov Report
@@ Coverage Diff @@
## master #16561 +/- ##
============================================
+ Coverage 73.83% 73.868% +0.038%
============================================
Files 619 619
Lines 159454 159488 +34
Branches 37430 37446 +16
============================================
+ Hits 117725 117811 +86
+ Misses 36270 36224 -46
+ Partials 5459 5453 -6 |
Replaced redundant `yield` statement with `return`. Added return statement when returning a single element making the generator terminating a bit faster.
Can you add tests for the degree list cases as well? |
The new test examples look good. One change would still be needed: |
You are right. I'll change it for consistency in the tests. I will also change lines 38-40 in test_monomials.py to use EDIT: |
In `total_degree` case if the `variables` list is empty or the `max_degree` is 0 `S(1)` should be returned instead of `{S(1)}`. Also updated the tests to support the above change.
I think this is ready to be merged. The old total degree part could probably be implemented better as a generator but that is not necessary in this PR. Thank you for your contribution. |
I am glad I helped. This was my first PR and I have to admit that you helped me very much. Thank you for everything. |
Brief description of what is fixed or changed
itermonomials now computes only the necessary monomials and returns a generator object
Release Notes
min_degrees
andmax_degrees
parameters.min_degrees
can also be omitted, in which case it corresponds to a 0 (single int) or a list of 0's.