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

Fix coeff(p, sym) when sym is a product (issue #1041) #1240

Merged
merged 3 commits into from
Aug 26, 2024

Conversation

zengmao
Copy link
Contributor

@zengmao zengmao commented Aug 26, 2024

Currently coeff(p, sym) silently returns a wrong result when sym is a product, as reported by issue #1041. This commit fixes the issue by iteratively computing the coefficient w.r.t. each term in the product.

@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.93%. Comparing base (47cfd60) to head (e658d7e).
Report is 25 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1240       +/-   ##
===========================================
+ Coverage    8.30%   79.93%   +71.62%     
===========================================
  Files          46       46               
  Lines        4549     4639       +90     
===========================================
+ Hits          378     3708     +3330     
+ Misses       4171      931     -3240     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zengmao
Copy link
Contributor Author

zengmao commented Aug 26, 2024

Before change:

julia> @variables x y;
julia> Symbolics.coeff(3x + 2*x*y, x*y)
0

After change:

julia> @variables x y;
julia> Symbolics.coeff(3x + 2*x*y, x*y)
2

@ChrisRackauckas ChrisRackauckas merged commit efccb9e into JuliaSymbolics:master Aug 26, 2024
9 of 11 checks passed
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.

3 participants