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

solve wrt additive generator #19524

Merged
merged 1 commit into from Jun 11, 2020
Merged

solve wrt additive generator #19524

merged 1 commit into from Jun 11, 2020

Conversation

smichr
Copy link
Member

@smichr smichr commented Jun 10, 2020

References to other Issues or PRs

fixes #19509

Brief description of what is fixed or changed

Other comments

Release Notes

  • solvers
    • equations with an additive generator are now solved more quickly

@sympy-bot
Copy link

sympy-bot commented Jun 10, 2020

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

  • solvers
    • equations with an additive generator are now solved more quickly (#19524 by @smichr)

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.7.

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.

<!-- 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. -->

fixes #19509

#### Brief description of what is fixed or changed


#### Other comments


#### Release Notes

<!-- Write the release notes for this release below. 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 -->
* solvers
  * equations with an additive generator are now solved more quickly
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@codecov
Copy link

codecov bot commented Jun 11, 2020

Codecov Report

Merging #19524 into master will increase coverage by 0.004%.
The diff coverage is 100.000%.

@@              Coverage Diff              @@
##            master    #19524       +/-   ##
=============================================
+ Coverage   75.690%   75.694%   +0.004%     
=============================================
  Files          653       654        +1     
  Lines       169873    169950       +77     
  Branches     40059     40073       +14     
=============================================
+ Hits        128577    128643       +66     
- Misses       35686     35693        +7     
- Partials      5610      5614        +4     

@oscarbenjamin
Copy link
Contributor

This looks good. +1 to merge if this is done.

In general I wonder if a more principled way of doing this is to work one step at a time applying invertible operations to try and isolate the symbol:

1/(x - 1)**5 - 1  =  0
1/(x - 1)**5  =  1
(x - 1)**5  =  1

Then when an invertible operation isn't possible any more we can look for the substitution e.g. z = x-1 and solve sequentially:

1. z**5 = 1
2. z = x - 1

Does that not already happen in univariate solve?

@smichr
Copy link
Member Author

smichr commented Jun 11, 2020

Does that not already happen in univariate solve?

It goes for the polynomial first (after checking for linear cases). And yes, this could be done -- and _invert is used in the multi-equation solving -- but you would still want to check for the additive generator:

>>> _invert((x-1)**5-y*(x-1) - 3,x)
(3, -y*(x - 1) + (x - 1)**5)

So what is presented here covers this case, too.

@smichr smichr merged commit e339db3 into sympy:master Jun 11, 2020
@smichr smichr deleted the convsolv branch June 11, 2020 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

solve(Eq(1/((x - 5)**8), 3), x) takes a long time
3 participants