in rationalfun(), the coefficient
vector of the numerator; in rationalfun.poly(), an
object of class "polynom" in polynom package
representing the numerator
denom
similar to numer, but for the
denominator
Details
A rational function object could be constructed either by
calling rationalfun() or by calling
rationalfun.poly().
rationalfun() constructs a rational function from
the coefficient vectors of the numerator and the
denominator. For example, consider a rational function
R(x) = P(x) / Q(x) where
, you may call
rationalfun(p[1:k], q[1:m]) to build the object.
For rationalfun.poly(), it receives two objects of
class "polynomial" from the polynom package,
representing the polynomials of the numerator and the
denominator respectively. Use this function if you
already have objects of "polynomial" class, typically by
calling polynomial(),
poly.calc() or
poly.orth().
rfun() and rfun.poly() are aliases of
rationalfun() and rationalfun.poly() in
order to type fewer letters.
The value returned by rationalfun() and
rationalfun.poly() is an object of class
"rationalfun". You can coerce the object to a function,
by calling as.function.rationalfun(), or to
a character string, by calling
as.character.rationalfun().
Objects of "ratioanlfun" class support basic operators
including "+", "-", "*", "/"
and "^". To evaluate a rational function at a
given vector, use predict.rationalfun(). To
compute the derivative and integral in explicit
form, call deriv.rationalfun() and
integral.rationalfun() respectively.
Value
An object of class "rationalfun".
See Also
polynomial,
poly.calc,
poly.orth
Examples
# (x + 1) / (x^2 + 2 * x + 3)
r1 <- rationalfun(c(1, 1), c(3, 2, 1))
print(r1)
# Construct from objects of 'polynomial' class
if (require(polynom)) {
p1 <- poly.calc(c(1, 2))
p2 <- polynomial(rep(1, 5))
r2 <- rfun.poly(p1, p2)
print(r2)
}