Last data update: 2014.03.03

R: Integral and differential calculus on polynomials or lists of...
integralR Documentation

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 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

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))

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/integral.Rd_%03d_medium.png", width=480, height=480)
> ### Name: integral
> ### Title: Integral and differential calculus on polynomials or lists of
> ###   polynomials.
> ### Aliases: integral integral.polynom integral.polylist deriv.polynom
> ###   deriv.polylist
> ### Keywords: symbolmath
> 
> ### ** Examples
> 
> 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))
[[1]]
[1] 0

[[2]]
numeric(0)

[[3]]
[1] 0

[[4]]
[1] -1  1

[[5]]
[1] -1.732051  0.000000  1.732051

[[6]]
[1] -2.3344142 -0.7419638  0.7419638  2.3344142

[[7]]
[1] -2.856970 -1.355626  0.000000  1.355626  2.856970

[[8]]
[1] -3.3242574 -1.8891759 -0.6167066  0.6167066  1.8891759  3.3242574

[[9]]
[1] -3.750440 -2.366759 -1.154405  0.000000  1.154405  2.366759  3.750440

[[10]]
[1] -4.1445472 -2.8024859 -1.6365190 -0.5390798  0.5390798  1.6365190  2.8024859
[8]  4.1445472

[[11]]
[1] -4.512746 -3.205429 -2.076848 -1.023256  0.000000  1.023256  2.076848
[8]  3.205429  4.512746

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