Learn R Programming

PolynomF (version 1.0-2)

integral: Integral and differential calculus on polynomials or lists of polynomials.

Description

Performs calculus operations on polynomial objects: differentiation and indefinite or definite integration.

Usage

# S3 method for polynom
integral(expr, limits = NULL, …)
# S3 method for polylist
integral(expr, …)
# S3 method for polynom
deriv(expr, …)
# S3 method for polylist
deriv(expr, …)

Arguments

expr

A polynom or polylist object.

limits

Either NULL, implying an indefinite integral, or a numeric (or complex) vector of length two, implying a definite integral between two fixed real of complex limits.

Not used, except in the case of integral.polylist where it may pass on common limits of integration to all integrals in the list.

Value

A polynom or numeric object giving the result of the calculus operation, or list of such results. If the result is polynom the list is a polylist.

Details

integral is a local generic function. The generic function deriv is already defined in the stats package.

References

None

Examples

Run this code
# NOT RUN {
p <- poly.from.zeros(-2:5)
ip <- integral(p)
ipv <- integral(p, limits = c(-2, 5))

plot(polylist(p, deriv(p)))

x <- polynom()
H <- polylist(1, x)
for(n in 2:10)
    H[[n+1]] <- x * H[[n]] - (n-1)*H[[n-1]]

solve(deriv(H))

# }

Run the code above in your browser using DataLab