Least common multiple of polynomials
MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
q, …) lcm(
lcm(p, q, ...) calculates the least common
multiple of any number of polynomials. The coefficient
ring of the polynomials may either be the integers or the rational
Expr, a residue class ring
a prime number
n, or a domain.
All polynomials must have the same indeterminates and the same coefficient ring.
Polynomial expressions are converted to polynomials. See
poly for details.
returned if an argument cannot be converted to a polynomial.
The return value is of the same type as the input polynomials,
i.e., either a polynomial of type
DOM_POLY or a polynomial
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.
all arguments are known to be integers, since it is much faster than
The least common multiple of two polynomial expressions can be computed as follows:
lcm(x^3 - y^3, x^2 - y^2);
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)
delete f, g, p, q:
Polynomial, a polynomial expression, or the value