Division
The gcd
and lcm
functions of Base
have been implemented for monomials, you have for example gcd(x^2*y^7*z^3, x^4*y^5*z^2)
returning x^2*y^5*z^2
and lcm(x^2*y^7*z^3, x^4*y^5*z^2)
returning x^4*y^7*z^3
.
Given two polynomials, $p$ and $d$, there are unique $r$ and $q$ such that $p = q d + r$ and the leading term of $d$ does not divide the leading term of $r$. You can obtain $q$ using the div
function and $r$ using the rem
function. The divrem
function returns $(q, r)$.
Given a polynomial $p$ and divisors $d_1, \ldots, d_n$, one can find $r$ and $q_1, \ldots, q_n$ such that $p = q_1 d_1 + \cdots + q_n d_n + r$ and none of the leading terms of $q_1, \ldots, q_n$ divide the leading term of $r$. You can obtain the vector $[q_1, \ldots, q_n]$ using div(p, d)
where $d = [d_1, \ldots, d_n]$ and $r$ using the rem
function with the same arguments. The divrem
function returns $(q, r)$.
MultivariatePolynomials.divides
— Functiondivides(t1::AbstractTermLike, t2::AbstractTermLike)
Returns whether the monomial of t1 divides the monomial of t2.
Examples
Calling divides(2x^2y, 3xy)
should return false because x^2y
does not divide xy
since x
has a degree 2 in x^2y
which is greater than the degree of x
on xy
. However, calling divides(3xy, 2x^2y)
should return true.
MultivariatePolynomials.div_multiple
— Functiondiv_multiple(a, b, ma::MA.MutableTrait)
Return the division of a
by b
assuming that a
is a multiple of b
. If a
is not a multiple of b
then this function may return anything.
MultivariatePolynomials.pseudo_rem
— Functionpseudo_rem(f::_APL, g::_APL, algo)
Return the pseudo remainder of f
modulo g
as defined in [Knu14, Algorithm R, p. 425].
[Knu14] Knuth, D.E., 2014. Art of computer programming, volume 2: Seminumerical algorithms. Addison-Wesley Professional. Third edition.
MultivariatePolynomials.rem_or_pseudo_rem
— Functionrem_or_pseudo_rem(f::_APL, g::_APL, algo)
If the coefficient type is a field, return rem
, otherwise, return pseudo_rem
.