# RationalFunction R¶

rf.spad line 153 [edit on github]

Utilities that provide the same top-level manipulations on fractions than on polynomials.

- coerce: R -> Fraction Polynomial R
`coerce(r)`

returns`r`

viewed as a rational function over`R`

.

- eval: (Fraction Polynomial R, Equation Fraction Polynomial R) -> Fraction Polynomial R
`eval(f, v = g)`

returns`f`

with`v`

replaced by`g`

. Error: if`v`

is not a symbol.

- eval: (Fraction Polynomial R, List Equation Fraction Polynomial R) -> Fraction Polynomial R
`eval(f, [v1 = g1, ..., vn = gn])`

returns`f`

with each`vi`

replaced by`gi`

in parallel, i.e.`vi`

`'s`

appearing inside the`gi`

`'s`

are not replaced. Error: if any`vi`

is not a symbol.

- eval: (Fraction Polynomial R, List Symbol, List Fraction Polynomial R) -> Fraction Polynomial R
`eval(f, [v1, ..., vn], [g1, ..., gn])`

returns`f`

with each`vi`

replaced by`gi`

in parallel, i.e.`vi`

`'s`

appearing inside the`gi`

`'s`

are not replaced.

- eval: (Fraction Polynomial R, Symbol, Fraction Polynomial R) -> Fraction Polynomial R
`eval(f, v, g)`

returns`f`

with`v`

replaced by`g`

.

- mainVariable: Fraction Polynomial R -> Union(Symbol, failed)
`mainVariable(f)`

returns the highest variable appearing in the numerator or the denominator of`f`

, “failed” if`f`

has no variables.

- multivariate: (Fraction SparseUnivariatePolynomial Fraction Polynomial R, Symbol) -> Fraction Polynomial R
`multivariate(f, v)`

applies both the numerator and denominator of`f`

to`v`

.

- univariate: (Fraction Polynomial R, Symbol) -> Fraction SparseUnivariatePolynomial Fraction Polynomial R
`univariate(f, v)`

returns`f`

viewed as a univariate rational function in`v`

.

- variables: Fraction Polynomial R -> List Symbol
`variables(f)`

returns the list of variables appearing in the numerator or the denominator of`f`

.