Skip to content
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

RecursionError in integrate fixed #21053

Merged
merged 3 commits into from Mar 8, 2021
Merged

Conversation

nisargsc
Copy link
Contributor

@nisargsc nisargsc commented Mar 7, 2021

References to other Issues or PRs

Partial fix for #21034

Brief description of what is fixed or changed

Applies the diff mentions by @oscarbenjamin here. This fixes one of the problems in the issue, i.e. RecurstionError caused due to not x.is_extended_real in sympy/core/expr.py

Release Notes

  • core
    • Fixed a bug in Expr.round that could lead to infinite recursion in integrate.

@sympy-bot
Copy link

sympy-bot commented Mar 7, 2021

Hi, I am the SymPy bot (v161). 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.8.

Click here to see the pull request description that was parsed.
<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more information). Also, please
write a comment on that issue linking back to this pull request once it is
open. -->
Partial fix for #21034 

#### Brief description of what is fixed or changed
Applies the diff mentions by @oscarbenjamin [here](https://github.com/sympy/sympy/issues/21034#issuecomment-790178650). This fixes one of the problems in the issue, i.e. `RecurstionError` caused due to `not x.is_extended_real` in `sympy/core/expr.py`

#### Release Notes

<!-- Write the release notes for this release below between the BEGIN and END
statements. The basic format is a bulleted list with the name of the subpackage
and the release note for this PR. For example:

* solvers
  * Added a new solver for logarithmic equations.

* functions
  * Fixed a bug with log of integers.

or if no release note(s) should be included use:

NO ENTRY

See https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more
information on how to write release notes. The bot will check your release
notes automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
* core
  * Fixed a bug in `Expr.round` that could lead to infinite recursion in `integrate`.
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

e2 = -I*log((re(asin(5)) + I*im(asin(5)))/sqrt(re(asin(5))**2 + im(asin(5))**2))/pi
assert integrate(f1, x) == \
-x**6/(6*asin(5)**4) - x**2*cosh(x + log(asin(5))) + 5*x**2/2 + 2*x*sinh(x + log(asin(5))) - 2*cosh(x + log(asin(5)))
assert f1.is_zero is None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this again there's really just one bug here which is this:

expr = -I*log((re(asin(5)) + I*im(asin(5)))/sqrt(re(asin(5))**2 + im(asin(5))**2))/pi
expr.round() # hangs

We can just add a test for that here in this file. The integral test should go in sympy.integrals somewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on it.
also in sympy.integrals I'm adding it to sympy/interals/test_integrals.py is it fine?

@oscarbenjamin
Copy link
Contributor

Does this also fix the other integral from the issue?

@nisargsc
Copy link
Contributor Author

nisargsc commented Mar 8, 2021

No, the other one still gives RecursionError: maximum recursion depth exceeded.

@oscarbenjamin
Copy link
Contributor

Okay, since it doesn't fully fix the issue I've changed the OP to say "partial fix". If the OP says "fixes #12345" then when it is merged the issue will be closed but we don't want to close the issue unless it is fully fixed.

I've also edited the release not to make it clear that this was a bug in Expr.round.

This looks good so I'll merge it now. Thanks!

@oscarbenjamin oscarbenjamin merged commit b564d9b into sympy:master Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants