All problems
Curl of a Trigonometric Field
Problem
For the planar field F(x, y) = [sin(a*x + b*y), cos(c*x - d*y)], the scalar curl is dQ/dx - dP/dy = -c*sin(c*x - d*y) - b*cos(a*x + b*y).
Given a, b, c, d and the point (x, y), return the curl value. Angles are in radians.
Hint
Only the cross partial derivatives contribute; each differentiates the inner linear form.
Test cases
case 1
in: [1,0,1,0,0,0]
expected: 0
case 2
in: [1,0,1,0,1.5707963267948966,0]
expected: -1
case 3
in: [0,1,1,0,0,0]
expected: -1
case 4
in: [1,1,2,1,0.5,-0.5]
expected: -2.994989973208109
Starter codePython
def curl_trig_2d(a, b, c, d, x, y):
# Your code here
pass4 test cases · run your code against them in the editor