Learning Scientific Programming with Python (2nd edition)

P2.7.3: Vector products

Question P2.7.3

Write two functions which, given two lists of length 3 representing three-dimensional vectors $\mathbf{a}$ and $\mathbf{b}$, calculate the dot product, $\mathbf{a}\cdot\mathbf{b}$ and the vector (cross) product, $\mathbf{a}\times\mathbf{b}$.

Write two more functions to return the scalar triple product, $\mathbf{a}\cdot(\mathbf{b}\times\mathbf{c})$ and the vector triple product, $\mathbf{a}\times(\mathbf{b}\times\mathbf{c})$.