DynamicPolynomials.jl icon indicating copy to clipboard operation
DynamicPolynomials.jl copied to clipboard

Overload // for creating rational polynomials

Open dlfivefifty opened this issue 1 year ago • 3 comments

I was expecting this to work:

julia> using DynamicPolynomials

julia> @polyvar x
(x,)

julia> x//2
ERROR: MethodError: no method matching //(::Variable{DynamicPolynomials.Commutative{DynamicPolynomials.CreationOrder}, Graded{LexOrder}}, ::Int64)
The function `//` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  //(::Integer, ::Integer)
   @ Base rational.jl:84
  //(::Rational, ::Integer)
   @ Base rational.jl:86
  //(::Complex, ::Real)
   @ Base rational.jl:100
  ...

Stacktrace:
 [1] top-level scope
   @ REPL[4]:1

dlfivefifty avatar Nov 26 '24 13:11 dlfivefifty

Do you want a fraction of polynomials or a polynomial with rational coefficients ?

blegat avatar Nov 26 '24 14:11 blegat

Polynomial with rational coefficients

dlfivefifty avatar Nov 26 '24 15:11 dlfivefifty

I agree it's the expected behavior, it shouldn't be too hard too hard to make it work.

blegat avatar Nov 26 '24 16:11 blegat