Skip to content
DeepForgeby svx
All problems
EasyCalculusca-149

Residue at Simple Pole

Problem

If z0 is a simple pole of F(z) = P(z) / Q(z), the residue there is P(z0) / Q'(z0).

Given polynomial coefficient lists for P and Q and the real pole z0 (with Q(z0) = 0 and Q'(z0) != 0), return the residue.

Hint

At a simple pole the residue is the limit of (z - z0) * F(z).

Test cases

case 1
in: [[1],[-1,0,1],1]
expected: 0.5
case 2
in: [[0,1],[-1,0,1],-1]
expected: 0.5
case 3
in: [[2],[-2,1],2]
expected: 2
case 4
in: [[1,1],[-4,0,1],2]
expected: 0.75
Starter codePython
def residue_simple_pole(p_coeffs, q_coeffs, z0):
    # Your code here
    pass

4 test cases · run your code against them in the editor