integral.rationalfun {rationalfun} | R Documentation |
Integrate a rational function
Description
Calculate the integral of a rational function. See "Details".
Usage
## 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
Examples
# (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)
[Package rationalfun version 0.1-1 Index]