Package Scientific :: Package Functions :: Module Rational :: Class RationalFunction

[frames] | no frames]

# Class RationalFunction

Rational Function

Instances of this class represent rational functions in a single variable. They can be evaluated like functions.

Rational functions support addition, subtraction, multiplication, and division.

Instance Methods

__add__(self, other) |

__call__(self, value) |

__coerce__(self, other) |

__div__(self, other) |

__init__(self, numerator, denominator=`[`1.0`]`) |

__mul__(self, other) |

__radd__(self, other) |

__rdiv__(self, other) |

__repr__(self) |

__rmul__(self, other) |

__rsub__(self, other) |

__sub__(self, other) |

(Scientific.Functions.Polynomial.Polynomial, RationalFunction)

divide(self, shift=0) Returns: a polynomial and a rational function such that the sum of the two is equal to the original rational function. |

`Numeric.array`

poles(self) Find the poles (zeros of the denominator) by diagonalization of the associated Frobenius matrix. |

`Numeric.array`

zeros(self) Find the zeros (roots) of the numerator by diagonalization of the associated Frobenius matrix. |

Class Variables
| is_rational_function = `1`

Method Details

### __init__(self, numerator, denominator=`[`1.0`]`)
(Constructor)

Parameters:
  - `numerator` (Scientific.Functions.Polynomial.Polynomial or `list` of numbers) - polynomial in one variable, or a list of polynomial coefficients
  - `denominator` (Scientific.Functions.Polynomial.Polynomial or `list` of numbers) - polynomial in one variable, or a list of polynomial coefficients

### divide(self, shift=0)

Parameters:
  - `shift` (`int` (non-negative)) - the power of the independent variable by which the numerator is multiplied prior to division
Returns: (Scientific.Functions.Polynomial.Polynomial, RationalFunction)
  a polynomial and a rational function such that the sum of the two is equal to the original rational function. The returned rational function's numerator is of lower order than its denominator.

### poles(self)

Find the poles (zeros of the denominator) by diagonalization of the associated Frobenius matrix.

Returns: `Numeric.array`
  an array containing the poles

### zeros(self)

Find the zeros (roots) of the numerator by diagonalization of the associated Frobenius matrix.

Returns: `Numeric.array`
  an array containing the zeros