Learn R Programming

PolynomF (version 0.94)

Math.polynom: 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 polynom
Math(x, …)
# S3 method for polylist
Math(x, …)
# S3 method for polynom
Ops(e1, e2)
# S3 method for polynom
Summary(…, na.rm = FALSE)
# S3 method for 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?

Value

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

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.

References

None

Examples

Run this code
# NOT RUN {
x <- polynom(0:1)
p <- (x + 1)^2 - 3

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

# }

Run the code above in your browser using DataLab