Skip to content
DeepForgeby svx
All problems
EasyCalculusca-021

One-Sided Limit Estimate

Problem

Estimate the limit of the rational function f(x) = P(x) / Q(x) at a from one side, where P and Q are polynomials given by coefficient lists.

Evaluate f(a - h) when side is "left" and f(a + h) when side is "right", with h = 1e-7. This is meant for 0/0 forms where the limit exists.

Hint

For a 0/0 form, the values just to either side approach the same finite limit.

Test cases

case 1
in: [[-1,0,1],[-1,1],1,"right"]
expected: 2
case 2
in: [[-1,0,1],[-1,1],1,"left"]
expected: 2
case 3
in: [[-4,0,1],[-2,1],2,"right"]
expected: 4
case 4
in: [[-8,0,0,1],[-2,1],2,"right"]
expected: 12
Starter codePython
def one_sided_limit(num_coeffs, den_coeffs, a, side, h=1e-7):
    # side is "left" or "right"
    # Your code here
    pass

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