integral.rationalfun: Integrate a rational function

Description Usage Arguments Details Value References See Also Examples

View source: R/rf_deriv_integral.R

Description

Calculate the integral of a rational function. See "Details".

Usage

1
2
## S3 method for class 'rationalfun'
integral(expr, ...)

Arguments

expr

an object of class "rationalfun"

...

not used in this function

Details

The returned value is a function call with argument named "x". That is, the integral is an expression in R with an explicit form, which could be evaluated directly by calling eval(), or indirectly using the int2fun() function.

The algorithm is based on the Hermite-Ostrogradski formula which is discussed in the reference. See the article for more details.

Value

A function call representing the explicit form of the integral.

References

T. N. Subramaniam, and Donald E. G. Malm, How to Integrate Rational Functions, The American Mathematical Monthly, Vol. 99, No.8 (1992), 762-772.

See Also

integral.polynomial

Examples

1
2
3
4
5
6
7
8
# (x + 1) / (x^2 + x + 1)
r <- rationalfun(c(1, 1), c(1, 1, 1))
expr <- integral(r)
# Evaluate the call directly
eval(expr, list(x = 2))
# Use int2fun()
f <- int2fun(expr)
f(2)

rationalfun documentation built on May 30, 2017, 2:04 a.m.