Integral and differential calculus on polynomials or lists of polynomials.

Share:

Description

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

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'polynom'
integral(expr, limits = NULL, ...)
## S3 method for class 'polylist'
integral(expr, ...)
## S3 method for class 'polynom'
deriv(expr, ...)
## S3 method for class '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.

Details

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

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.

References

None

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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))