6.5.1 Dot and cross products

The dot product of two vectors can be found simply by multiplying the two vectors together:

pyxplot> a = vector(1,4)
pyxplot> b = vector(2,3)
pyxplot> print a*b
14

The cross product of two vectors, which is only defined for pairs of three-element vectors, can be found by passing the two vectors to the cross(a,b) function:

pyxplot> a = vector(1,4,1)
pyxplot> b = vector(2,3,2)
pyxplot> print cross(a,b)
vector(5, 0, -5)