lcapy.ratfun.Ratfun

class lcapy.ratfun.Ratfun(expr, var)

Bases: object

Methods

ZPK([combine_conjugates])

Convert to zero-pole-gain (ZPK) form.

__init__(expr, var)

This represents a generalized rational function of the form: N(var) / D(var) = (B(var) / A(var)) * exp(-var * delay) * U(var)

as_B_A_delay_undef()

as_QMA()

Decompose expression into Q, M, A, delay, undef where

as_QRF([combine_conjugates, damping, method])

Decompose expression into Q, R, F, delay, undef where

as_QRF_old([combine_conjugates, damping])

Decompose expression into Q, R, F, delay, undef where

as_QRPO([damping, method])

Decompose expression into Q, R, P, O, delay, undef where

as_ZPK()

Decompose expression into zeros, poles, gain, undef where

canonical([factor_const])

Convert rational function to canonical form; this is like general form but with a unity highest power of denominator.

coeffs()

expandcanonical()

Expand in terms for different powers with each term expressed in canonical form.

general()

Convert rational function to general form.

partfrac([combine_conjugates, damping, method])

Convert rational function into partial fraction form.

pdb()

Enter the python debugger.

poles([damping])

Return poles of expression as a list of Root objects.

residue(pole, poles)

Determine residue for given pole.

residues([combine_conjugates, damping])

Return residues of partial fraction expansion.

roots()

Return roots of expression as a dictionary Note this may not find them all.

standard()

Convert rational function into mixed fraction form.

timeconst()

Convert rational function to time constant form with unity lowest power of denominator.

zeros()

Return zeroes of expression as a dictionary Note this may not find them all.

Attributes

Apoly

Bpoly

Ddegree

Return the degree (order) of the denominator of a rational function.

Ndegree

Return the degree (order) of the numerator of a rational function.

degree

Return the degree (order) of the rational function.

is_strictly_proper

Return True if the degree of the dominator is greater than the degree of the numerator.

property Ddegree

Return the degree (order) of the denominator of a rational function. Note zero has a degree of -inf.

property Ndegree

Return the degree (order) of the numerator of a rational function. Note zero has a degree of -inf.

ZPK(combine_conjugates=False)

Convert to zero-pole-gain (ZPK) form.

See also canonical, general, standard, timeconst, and partfrac

as_QMA()

Decompose expression into Q, M, A, delay, undef where

expression = (Q + M / A) * exp(-delay * var) * undef

as_QRF(combine_conjugates=False, damping=None, method=None)

Decompose expression into Q, R, F, delay, undef where

expression = (Q + sum_n r_n / f_n) * exp(-delay * var) * undef

method can be ‘sub’ (substitution method, the default) or ‘ec’ (equating cofficients method).

as_QRF_old(combine_conjugates=False, damping=None)

Decompose expression into Q, R, F, delay, undef where

expression = (Q + sum_n r_n / f_n) * exp(-delay * var) * undef

as_QRPO(damping=None, method=None)

Decompose expression into Q, R, P, O, delay, undef where

expression = (Q + sum_n r_n / (var - p_n)**o_n) * exp(-delay * var) * undef

method can be ‘sub’ (substitution method, the default) or ‘ec’ (equating cofficients method).

as_ZPK()

Decompose expression into zeros, poles, gain, undef where

expression = K * (prod_n (var - z_n) / (prod_n (var - p_n)) * undef

canonical(factor_const=True)

Convert rational function to canonical form; this is like general form but with a unity highest power of denominator. For example,

(5 * s**2 + 5 * s + 5) / (s**2 + 4)

If factor_const is True, factor constants from numerator, for example,

5 * (s**2 + s + 1) / (s**2 + 4)

See also general, partfrac, standard, timeconst, and ZPK

property degree

Return the degree (order) of the rational function.

This the maximum of the numerator and denominator degrees. Note zero has a degree of -inf.

expandcanonical()

Expand in terms for different powers with each term expressed in canonical form.

general()

Convert rational function to general form.

See also canonical, partfrac, standard, timeconst, and ZPK

property is_strictly_proper

Return True if the degree of the dominator is greater than the degree of the numerator.

partfrac(combine_conjugates=False, damping=None, method=None)

Convert rational function into partial fraction form.

If combine_conjugates is True then the pair of partial fractions for complex conjugate poles are combined.

See also canonical, standard, general, timeconst, and ZPK

pdb()

Enter the python debugger.

poles(damping=None)

Return poles of expression as a list of Root objects. Note this may not find all the poles.

Poles at infinity are not returned. There will be p - q poles at infinity for a rational function with a numerator of degree p and a denominator of degree q.

residue(pole, poles)

Determine residue for given pole.

residues(combine_conjugates=False, damping=None)

Return residues of partial fraction expansion.

This is not much use without the corresponding poles. It is better to use as_QRF.

roots()

Return roots of expression as a dictionary Note this may not find them all.

standard()

Convert rational function into mixed fraction form.

This is the sum of strictly proper rational function and a polynomial.

See also canonical, general, partfrac, timeconst, and ZPK

timeconst()

Convert rational function to time constant form with unity lowest power of denominator.

See also canonical, general, partfrac, standard, and ZPK

zeros()

Return zeroes of expression as a dictionary Note this may not find them all.

Zeros at infinity are not returned. There will be q - p zeros at infinity for a rational function with a numerator of degree p and a denominator of degree q.