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

Unevaluated collect with symbols in factors #19431

Merged
merged 1 commit into from May 26, 2020
Merged

Conversation

mloubout
Copy link
Contributor

@mloubout mloubout commented May 26, 2020

References to other Issues or PRs

Fixes #19433

Brief description of what is fixed or changed

This PR fixes a small issue in collect with the collected symbol in the factor. Current version does:

>> from sympy import symbol, collect
>> a = symbols('a')
>> collect(a**2*(a**2 + 1), a**2, evaluate=False)
{a**2: _Dummy_20 + 1}

that contains an undefined Dummy in the collected expression,. This fixes the behavior applying replacement to the factors and outputs in this example.

{a**2: a**2 + 1}

Other comments

Release Notes

  • simplify
    • Fixes a bug in collect when collected symbols appear in the facorized expression.

@sympy-bot
Copy link

sympy-bot commented May 26, 2020

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

  • simplify
    • Fixes a bug in collect when collected symbols appear in the facorized expression. (#19431 by @mloubout)

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 #19433

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

This PR  fixes a small issue in `collect` with the collected symbol in the factor. Current version does:
```
>> from sympy import symbol, collect
>> a = symbols('a')
>> collect(a**2*(a**2 + 1), a**2, evaluate=False)
{a**2: _Dummy_20 + 1}
```
that contains an undefined `Dummy` in the collected expression,. This fixes the behavior applying replacement to the factors and outputs in this example.
```
{a**2: a**2 + 1}
```
#### 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 -->

* simplify
    * Fixes a bug in collect when collected symbols appear in the facorized expression.

<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@smichr
Copy link
Member

smichr commented May 26, 2020

Looks good. Ready to merge when tests pass.

@codecov
Copy link

codecov bot commented May 26, 2020

Codecov Report

Merging #19431 into master will increase coverage by 0.001%.
The diff coverage is 100.000%.

@@              Coverage Diff              @@
##            master    #19431       +/-   ##
=============================================
+ Coverage   75.651%   75.653%   +0.001%     
=============================================
  Files          652       652               
  Lines       169712    169712               
  Branches     40051     40051               
=============================================
+ Hits        128390    128393        +3     
+ Misses       35720     35714        -6     
- Partials      5602      5605        +3     

@smichr smichr merged commit 0ef0444 into sympy:master May 26, 2020
@smichr
Copy link
Member

smichr commented May 26, 2020

Thanks, this is in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

collec with evaluate=False has leftover Dummy
4 participants