JuliaSymbolics / Symbolics.jl

Symbolic programming for the next generation of numerical software

Home Page:https://symbolics.juliasymbolics.org/stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rational or integer coefficients with simplify?

jo-ap opened this issue · comments

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?

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

Indeed, closing as a duplicate.