Last data update: 2014.03.03

R: S3 Group Generic Functions for Polynomial and Polylist...
Math.polynomR Documentation

S3 Group Generic Functions for Polynomial and Polylist Objects

Description

The function Ops.polynom allows arithmetic operations on polynom objects: addition, subtraction, multiplication, division (with remainder), remainder, raising to a non-negaive integer power. It also allows exact equality and exact inequality tests.

Math.polynom allows round, signif, floor, ceiling and trunc operations on a polynom coefficient vector, returning a polynom result.

Summary.polynom and Summary.polylist allow sum and prod operations on polynom arguments, specified either as individual polynom objects or in a single polylist object.

Usage

## S3 method for class 'polynom'
Math(x, ...)
## S3 method for class 'polylist'
Math(x, ...)
## S3 method for class 'polynom'
Ops(e1, e2)
## S3 method for class 'polynom'
Summary(..., na.rm = FALSE)
## S3 method for class 'polylist'
Summary(..., na.rm = FALSE)

Arguments

e1, e2

Objects of class polynom or numeric arguments which may be coerced to class polynom. At least one must be a polynom object.

x

An object of class polymon or polylist.

...

polynom objects or scalar numeric, as appropriate. In the case of Summary.polylist, may be a single polylist object.

na.rm

logical: should missing values be removed first?

Details

None of these functions is called directly. Ops.polynom is the workhorse of the entire package. Ops.polylist allows vectorised arithmetic computations on polylists.

Value

A polynom (or polylist) object giving the result of the operation.

Author(s)

Bill Venables, with some code provided by Kurt Hornik

References

None

Examples

x <- polynom(0:1)
p <- (x + 1)^2 - 3

round(p/3)
sum(p, p^2, p^3, p^4)

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/Math.polynom.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Math.polynom
> ### Title: S3 Group Generic Functions for Polynomial and Polylist Objects
> ### Aliases: Math.polynom Math.polylist Ops.polynom Ops.polylist
> ###   Summary.polynom Summary.polylist
> ### Keywords: symbolmath
> 
> ### ** Examples
> 
> x <- polynom(0:1)
> p <- (x + 1)^2 - 3
> 
> round(p/3)
-1 + x 
> sum(p, p^2, p^3, p^4)
10 - 46*x + 53*x^2 + 20*x^3 - 49*x^4 - 10*x^5 + 17*x^6 + 8*x^7 + x^8 
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>