JuliaAlgebra / DynamicPolynomials.jl

Multivariate polynomials implementation of commutative and non-commutative variables
Other
60 stars 21 forks source link

Automatically promote to BigInt when about to overflow #110

Open shashi opened 2 years ago

shashi commented 2 years ago

It would be nice if DP automatically promoted coefficients to big nums when they are too big to fit in Int.

See

julia> @polyvar x y
(x, y)

julia> p = (x+y)^100

is wrong, but (x+y)^50 is correct.

from https://github.com/JuliaSymbolics/Symbolics.jl/issues/538

blegat commented 2 years ago

Agreed, this would be a nice feature to have

jlperla commented 2 years ago

@blegat and @shashi FWIW I tried out the newly released MultivariatePolynomials = "0.4.4" with the the latest DynamicPolynomials and my version of the bug is now fixed.

I had to pin `MultivariatePolynomials = "0.4.4"`` manually though. You might want to consider releesing a new version of this repo which lowerbounds that (and @shashi maybe consider a SymbolicUtils which lowerbounds a new DynamicPolynomials).

Regardless, thanks so much for fixing this!

nsajko commented 8 months ago

What about type stability, though? Surely type stability is paramount? This proposal seems like it would compromise type stability.