Learn R Programming

PolynomF (version 0.94)

GCD: GCD and LCM or two or more polynomials

Description

Functions to find the Greatest Common Divisor (GCD) or Least Common Multipe (LCM) of two or more polynomials, specified either as individual arguments or as a polylist object.

Usage

# S3 method for polynom
GCD(…)
# S3 method for polylist
GCD(…)
# S3 method for polynom
LCM(…)
# S3 method for polylist
LCM(…)

Arguments

Either individual polynom arguments or a single polylist object with all polynomials.

Value

A single polynomial object giving the GCD or LCM respectively, normalised to have the leading coefficient unity (i.e. a monic polynomial).

Details

Uses the classical GCD and LCM algorithms with polynomial arithmetic.

References

None.

Examples

Run this code
# NOT RUN {
p1 <- poly.from.zeros(-3:2)
p2 <- poly.from.zeros(0:4)

pgcd <- GCD(p1, p2)

pl <- polylist(p1, p2)
plcm <- LCM(pl)

polylist(pgcd, plcm)

# }

Run the code above in your browser using DataLab