Skip to content
DeepForgeby svx
All problems
EasyLinear Algebrala-052

Scalar Triple Product

Problem

Compute the scalar triple product a . (b x c), the signed volume of the parallelepiped spanned by a, b, and c.

Use the determinant formula with the three rows a, b, c.

Hint

The result is the determinant of the matrix whose rows are a, b, c.

Test cases

case 1
in: [[1,0,0],[0,1,0],[0,0,1]]
expected: 1
case 2
in: [[1,2,3],[4,5,6],[7,8,9]]
expected: 0
case 3
in: [[2,0,0],[0,3,0],[0,0,4]]
expected: 24
case 4
in: [[1,1,0],[0,1,1],[1,0,1]]
expected: 2
Starter codePython
def scalar_triple_product(a, b, c):
    # Your code here
    pass

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