# rationalfun: Construction of rational functions In rationalfun: Manipulation of Rational Functions

## Description

Construction of rational functions.

## Usage

 ```1 2 3 4 5 6 7 8 9``` ```rationalfun(numer = c(0, 1), denom = c(1, 1, 1)) rfun(numer = c(0, 1), denom = c(1, 1, 1)) rationalfun.poly(numer = polynomial(c(0, 1)), denom = polynomial(c(1, 1, 1))) rfun.poly(numer = polynomial(c(0, 1)), denom = polynomial(c(1, 1, 1))) ```

## Arguments

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

P(x) = p[1] + p[2] * x + p[3] * x^2 + ... + p[k]* x^(k-1)

and

Q(x) = q[1] + q[2] * x + q[3] * x^2 + ... + q[m]* x^(m-1)

, 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".

`polynomial`, `poly.calc`, `poly.orth`
 ``` 1 2 3 4 5 6 7 8 9 10``` ```# (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) } ```