All problems
Quotient Rule Evaluation
Problem
Evaluate the derivative of the quotient f(x) = P(x) / Q(x) at x, where P and Q are polynomials given by coefficient lists.
Use the quotient rule: (P / Q)'(x) = (P'(x) * Q(x) - P(x) * Q'(x)) / Q(x)^2. Assume Q(x) != 0.
Hint
The numerator follows the product rule order: derivative of top times bottom minus top times derivative of bottom.
Test cases
case 1
in: [[1,0,1],[0,1],1]
expected: 0
case 2
in: [[0,0,1],[1,1],1]
expected: 0.75
case 3
in: [[0,1],[0,1],2]
expected: 0
case 4
in: [[1],[0,0,1],2]
expected: -0.25
Starter codePython
def quotient_rule(p_coeffs, q_coeffs, x):
# Your code here
pass4 test cases · run your code against them in the editor