Skip to content
DeepForgeby svx
All problems
MediumCalculusca-114

Curvature of a Curve

Problem

Compute the curvature of the parametric curve (x(t), y(t)) given by polynomial coefficient lists:

kappa = |x' * y'' - y' * x''| / (x'^2 + y'^2)^(3/2)

Evaluate all derivatives at the parameter t and return kappa.

Hint

The numerator is the 2D cross product of the velocity and acceleration.

Test cases

case 1
in: [[0,1],[0,0,1],0]
expected: 2
case 2
in: [[0,1],[0,0,1],1]
expected: 0.17888543819998318
case 3
in: [[0,1],[0,3],2]
expected: 0
case 4
in: [[1,0,-1],[0,2],0]
expected: 0.5
Starter codePython
def curvature(x_coeffs, y_coeffs, t):
    # Your code here
    pass

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