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

Added simplification of mul having args as units, prefixes and other arguments. #14403

Merged
merged 2 commits into from
Mar 6, 2018

Conversation

Subhash-Saurabh
Copy link
Contributor

Brief description of what is fixed or changed

In #14286 simplification for quantities was added. However it was unable to simplify expressions like

>>> (3*kilo*meter).simplify()
3*meter*Prefix(kilo, k, 3, 10)

while

>>> kilo*meter
1000*meter

After changes on this branch

>>> (3*kilo*meter).simplify()
3000*meter

Mul having Prefixes multiplied with units and other arguments were not being
simplified correctly. Therefore if in a Mul expression Prefix occured along
with units then converted the Prefix into its scale_factor.
@Subhash-Saurabh
Copy link
Contributor Author

@Upabjojr can you please take a look at this PR.

@Upabjojr
Copy link
Contributor

Upabjojr commented Mar 6, 2018

Yes, this looks good. There other possibilities (like simplifying 3*kilo*meter to 3*kilometer), but they are more complicated to implement.

@Upabjojr Upabjojr merged commit f7e7854 into sympy:master Mar 6, 2018
@Subhash-Saurabh Subhash-Saurabh deleted the units_simplify branch March 7, 2018 18:16
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.

2 participants