All problems
Curl of 2D Vector Field
Problem
For the vector field F(x, y) = [a*x^2 + b*x*y, c*x*y + d*y^2], compute the scalar curl at (x, y):
curl F = dQ/dx - dP/dy = c*y - b*x
Hint
Only the cross derivatives matter for the curl of a planar field.
Test cases
case 1
in: [1,0,1,0,2,3]
expected: 3
case 2
in: [0,1,0,0,5,1]
expected: -5
case 3
in: [2,2,2,2,1,1]
expected: 0
case 4
in: [1,-2,3,1,2,4]
expected: 16
Starter codePython
def curl2d(a, b, c, d, x, y):
# Your code here
pass4 test cases · run your code against them in the editor