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

Rational or integer coefficients with simplify? #1060

Closed
jo-ap opened this issue Feb 19, 2024 · 2 comments
Closed

Rational or integer coefficients with simplify? #1060

jo-ap opened this issue Feb 19, 2024 · 2 comments

Comments

@jo-ap
Copy link

jo-ap commented Feb 19, 2024

In some cases simplify returns numeric coefficients as floats. I noticed that it happens e.g. when the top level operation is + , but not if it is /. Here is an example:

using Symbolics
@variables a b x y
simplify( (y-x)*b//a + (y*b - x*b)//a )   # (-2.0b*x + 2.0b*y) / a
simplify( ((y-x)*b + (y*b - x*b))//a )    # (-2b*x + 2b*y) / a

Is there a way to force simplify to return all numeric values as integers or rationals?

@hersle
Copy link
Contributor

hersle commented Mar 2, 2024

I seem to have duplicated a very similar issue in #1083.

@ChrisRackauckas
Copy link
Member

Indeed, closing as a duplicate.

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

No branches or pull requests

3 participants