#### Previous topic

scipy.signal.residuez

#### Next topic

scipy.signal.invresz

# scipy.signal.invres

`scipy.signal.``invres`(r, p, k, tol=0.001, rtype='avg')

  Compute b(s) and a(s) from partial fraction expansion.

  If `M = len(b)` and `N = len(a)`:

              b(s)     b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1]
      H(s) = ------ = ----------------------------------------------
              a(s)     a[0] x**(N-1) + a[1] x**(N-2) + ... + a[N-1]

               r[0]       r[1]             r[-1]
           = -------- + -------- + ... + --------- + k(s)
             (s-p[0])   (s-p[1])         (s-p[-1])

  If there are any repeated roots (closer than tol), then the partial fraction expansion has terms like:

        r[i]      r[i+1]              r[i+n-1]
      -------- + ----------- + ... + -----------
      (s-p[i])  (s-p[i])**2          (s-p[i])**n

  Parameters: | r : ndarray Residues. p : ndarray Poles. k : ndarray Coefficients of the direct polynomial term. tol : float, optional The tolerance for two roots to be considered equal. Default is 1e-3. rtype : {‘max’, ‘min, ‘avg’}, optional How to determine the returned root if multiple roots are within tol of each other. ‘max’: pick the maximum of those roots. ‘min’: pick the minimum of those roots. ‘avg’: take the average of those roots.

  See also

  `residue`, `unique_roots`