Skip to content
DeepForgeby svx
All problems
EasyCalculusca-066

Jacobian of Affine Map

Problem

The affine map T(x, y) = (a*x + b*y + e, c*x + d*y + f) has a constant Jacobian matrix, since translations do not affect derivatives.

Return the 2x2 Jacobian [[dT1/dx, dT1/dy], [dT2/dx, dT2/dy]] as a nested list of floats.

Hint

Differentiate each output component with respect to each input variable.

Test cases

case 1
in: [1,2,3,4,5,6]
expected: [[1,2],[3,4]]
case 2
in: [1,0,0,1,0,0]
expected: [[1,0],[0,1]]
case 3
in: [0,0,0,0,7,-3]
expected: [[0,0],[0,0]]
case 4
in: [-1,2.5,0,3,1,1]
expected: [[-1,2.5],[0,3]]
Starter codePython
def jacobian_affine(a, b, c, d, e, f):
    # Return [[a, b], [c, d]] as floats
    # Your code here
    pass

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