diff --git a/src/gcd.jl b/src/gcd.jl index 055c852..6e447b8 100644 --- a/src/gcd.jl +++ b/src/gcd.jl @@ -254,14 +254,8 @@ function deflation(p::AbstractPolynomialLike) shift_defl = shift_deflation.(p, variables(p)) shift = getindex.(shift_defl, 1) defl = getindex.(shift_defl, 2) - s = prod( - variables(p) .^ shift; - init = constant_monomial(p), - )::monomial_type(p) - d = prod( - variables(p) .^ defl; - init = constant_monomial(p), - )::monomial_type(p) + s = monomial(variables(p), shift) + d = monomial(variables(p), defl) return s, d end diff --git a/src/term.jl b/src/term.jl index cfaf679..f9cf086 100644 --- a/src/term.jl +++ b/src/term.jl @@ -151,6 +151,17 @@ Returns the monomial of the term `t`. ### Examples Calling `monomial` on ``4x^2y`` should return ``x^2y``. + + monomial(variables, exponents) + +Returns the monomial corresponding to `prod(variables .^ exponents)` + +### Examples + +In order to create `x^2 * y`, + +* with DynamicPolynomials, use `monomial([x, y], [2, 1])`, +* with TypedPolynomials, use `monomial((x, y), (2, 1))`. """ function monomial end monomial(t::AbstractTerm) = t.monomial # by convention, the field should be `monomial`.