Cross Product Without Numpy

1.5k views Asked by At

When I am trying to take the cross product of vectors A and B it is returning an error: 'int' object is not subscriptable.

If someone could help me understand this that would be greatly appreciated.

Also, I am trying to do the cross product without using numpy.

A = [3, 4, 8]
B = [6, 2, 1]


def cross(A, B):
    c = [A[1] * B[2] - A[2] * B[1],
         A[2] * B[0] - A[0] * B[2],
         A[0] * B[1] - A[1] * B[0]]

    return c
print("The cross product of A cross B is: \n", cross(A, B))
0

There are 0 answers