Rational Term
RationalTerm(pole, coef, order=1)
A single term in a proper rational function, corresponding to a single real or complex pole r of order m in the denominator, taking the form
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pole
|
complex
|
Value of the pole for the denominator |
required |
coef
|
complex
|
Coefficient for the numerator |
required |
order
|
int
|
Order of the term Defaults to 1. |
1
|
Raises:
Type | Description |
---|---|
ValueError
|
If the order is less than 1. |
Source code in src/rational_functions/terms.py
pole
property
Return the pole of the term.
coef
property
Return the coefficient of the term.
order
property
Return the order of the term.
denominator_root
property
Return the root of the denominator.
denominator
property
Return the denominator of the term.
__neg__()
__eq__(other)
__hash__()
product(term1, term2, ztol=0.0)
staticmethod
Compute and decompose the product of two rational terms. This method is not implemented as an overloaded operator mul since the output is not a RationalTerm but a list of RationalTerms.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
term1
|
RationalTerm
|
First term |
required |
term2
|
RationalTerm | Polynomial
|
Second term |
required |
ztol
|
float
|
Absolute tolerance under which real or imaginary parts of the solution are considered zero. Defaults to 0.0. |
0.0
|
Returns: list[RationalTerm]: List of terms in the product
Source code in src/rational_functions/terms.py
product_w_polynomial(term, poly, ztol=0.0)
staticmethod
Compute and decompose the product of a rational term and a polynomial. This method is not implemented as an overloaded operator mul since the output is not a RationalTerm but a list of RationalTerms and a Polynomial.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
term
|
RationalTerm
|
Rational term |
required |
poly
|
Polynomial
|
Polynomial to multiply with |
required |
ztol
|
float
|
Absolute tolerance under which real or imaginary parts of the solution are considered zero. Defaults to 0.0. |
0.0
|
Returns:
Type | Description |
---|---|
tuple[list[RationalTerm], Polynomial]
|
tuple[list[RationalTerm], Polynomial]: List of terms in the product and the remaining polynomial |
Source code in src/rational_functions/terms.py
simplify(terms, atol=0.0, rtol=0.0, imtol=0.0)
staticmethod
Simplify a list of RationalTerms by combining terms with the same pole and order. If tolerances are specified, terms can be grouped also by closeness rather than exact equality.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
terms
|
list[RationalTerm]
|
List of RationalTerms to simplify |
required |
atol
|
float
|
Absolute tolerance for closeness. Defaults to 0.0. |
0.0
|
rtol
|
float
|
Relative tolerance for closeness. Defaults to 0.0. |
0.0
|
imtol
|
float
|
Imaginary tolerance to make a complex number with a small imaginary part real. Defaults to 0.0. |
0.0
|
Returns:
Type | Description |
---|---|
list[RationalTerm]
|
list[RationalTerm]: Simplified list of RationalTerms |
Source code in src/rational_functions/terms.py
__call__(x)
Evaluate the term at the given x values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
ArrayLike
|
values at which to evaluate the term |
required |
Returns:
Name | Type | Description |
---|---|---|
ArrayLike |
ArrayLike
|
evaluated values |
Source code in src/rational_functions/terms.py
deriv(m=1)
Compute the derivative of the term.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
m
|
int
|
Order of the derivative Defaults to 1. |
1
|
Returns:
Name | Type | Description |
---|---|---|
RationalTerm |
RationalTerm
|
Term of the derivative |
Source code in src/rational_functions/terms.py
integ()
Compute the integral of the term.
Returns:
Name | Type | Description |
---|---|---|
RationalIntegralGeneralTerm |
RationalIntegralGeneralTerm
|
Integral |
Source code in src/rational_functions/terms.py
__str__()
Print the term.