lcm
-- the least common multiple of
polynomialslcm
(p, q...)
returns the least common
multiple of the polynomials p, q, ...
lcm(p, q...)
lcm(f, g...)
p, q... |
- | polynomials of type
DOM_POLY |
f, g... |
- | polynomial expressions |
a polynomial, a polynomial expression, or the value FAIL
.
p
, q
, f
, g
content
, factor
, gcd
, gcdex
, icontent
, ifactor
, igcd
, igcdex
, ilcm
, poly
lcm(
p, q...)
calculates the greatest
common divisor of any number of polynomials. The coefficient ring of the polynomials may either be
the integers or the rational numbers, Expr, a residue class ring IntMod(n)
with a prime number
n
, or a domain.
All polynomials must have the same indeterminates and the same coefficient ring.
poly
for details.
FAIL
is returned if an argument cannot be converted to a
polynomial.DOM_POLY
or a polynomial
expression.lcm
returns 1 if all arguments are
1 or -1, or if no argument is given. If at least
one of the arguments is 0, then lcm
returns
0.ilcm
if all
arguments are known to be integers, since it is much faster than
lcm
.The least common multiple of two polynomial expressions can be computed as follows:
>> lcm(x^3 - y^3, x^2 - y^2);
4 4 3 3 y - x + x y - x y
One may also choose polynomials as arguments:
>> p := poly(x^2 - y^2, [x, y], IntMod(17)): q := poly(x^2 - 2*x*y + y^2, [x, y], IntMod(17)): lcm(p, q)
3 2 2 3 poly(x - x y - x y + y , [x, y], IntMod(17))
>> delete f, g, p, q: