Last data update: 2014.03.03

R: GCD and LCM or two or more polynomials
GCDR Documentation

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 class 'polynom'
GCD(...)
## S3 method for class 'polylist'
GCD(...)
## S3 method for class 'polynom'
LCM(...)
## S3 method for class 'polylist'
LCM(...)

Arguments

...

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

Details

Uses the classical GCD and LCM algorithms with polynomial arithmetic.

Value

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

Author(s)

Kurt Hornik, slightly modified by Bill Venables.

References

None.

Examples

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)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(PolynomF)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PolynomF/GCD.Rd_%03d_medium.png", width=480, height=480)
> ### Name: GCD
> ### Title: GCD and LCM or two or more polynomials
> ### Aliases: GCD GCD.polynom GCD.polylist LCM LCM.polynom LCM.polylist
> ### Keywords: symbolmath
> 
> ### ** Examples
> 
> 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)
List of polynomials:
[[1]]
2*x - 3*x^2 + x^3 

[[2]]
144*x - 36*x^2 - 196*x^3 + 49*x^4 + 56*x^5 - 14*x^6 - 4*x^7 + x^8 

> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>