Skip to content
DeepForgeby svx
All problems
MediumCalculusca-027

Product Rule Evaluation

Problem

Evaluate the derivative of the product f(x) = P(x) * Q(x) at x, where P and Q are polynomials given by coefficient lists.

Use the product rule: (P * Q)'(x) = P'(x) * Q(x) + P(x) * Q'(x).

Hint

Differentiate each factor separately and combine the two cross terms.

Test cases

case 1
in: [[0,1],[0,1],3]
expected: 6
case 2
in: [[1,1],[1,-1],2]
expected: -4
case 3
in: [[0,0,1],[1,0,1],1]
expected: 6
case 4
in: [[5],[0,0,1],2]
expected: 20
Starter codePython
def product_rule(p_coeffs, q_coeffs, x):
    # Your code here
    pass

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