All problems
Area Scale Factor 2x2
Problem
Return the area scale factor of the 2x2 linear map given by A, which is the absolute determinant:
|det(A)| = |a*d - b*c|
This is the factor by which the map scales areas.
Hint
A singular map collapses areas to zero, so the factor is 0.
Test cases
case 1
in: [[[2,0],[0,3]]]
expected: 6
case 2
in: [[[1,1],[1,1]]]
expected: 0
case 3
in: [[[0,-1],[1,0]]]
expected: 1
case 4
in: [[[2,4],[1,3]]]
expected: 2
case 5
in: [[[-3,0],[0,-2]]]
expected: 6
Starter codePython
def area_scale_factor(A):
# Your code here
pass5 test cases · run your code against them in the editor