vector_arithmetic

File Purpose: arithmetic for vectors or components.

[EFF] the idea for efficiency in vector methods

is that it’s more efficient to get the full vector instead of one component at a time,
if you’ll be using more than one component of it.
For example, if you use electron momentum equation to solve for electric field,
then ‘E’ is complicated to calculate, and involves some scalar factors.
If you get ‘E_x’ then ‘E_y’, you’ll need to recalculate those factors each time.
But if you get ‘E_xy’, then you only need to calculate those factors once
(assuming that get_E is written appropriately, with this in mind).
[TODO] compatibility with rotations (when implementing rotations):
infer X,Y,Z from ‘component’ dimension of array, instead of imposing XYZ.
E.g. if using a rotated coordinate system xprime, yprime, zprime,
then infer X,Y,Z as xprime,yprime,zprime. And crash if mixing coordinate systems…?

Functions

angle_xy(A)

return angle between +xhat and A, in the xy plane, in radians.

angle_xy_to_hat(A)

return unit vector u, given angle [radians] between +xhat and u in the xy plane.

cross_component(A, B, x, *[, yz, missing_ok])

return x component of A cross B, given A and B which have values for y and z 'component'.

cross_product(A, B, *[, components])

return cross product of vectors A and B, along dimension 'component'.

dot_product(A, B)

return dot product of vectors A and B, assuming vector components in the 'component' dimension.

parallel(A, B)

return the component of A parallel to B.

parmod(A, B, *[, signed])

return the magnitude of the component of A parallel to B.

perp(A, B)

return the component of A perpendicular to B.

perpmod(A, B)

return magnitude of the component of A perpendicular to B.

take_parallel_to(B, A)

return the component of A parallel to B.

take_perp_to(B, A)

return the component of A perpendicular to B.

Classes

VectorArithmeticLoader()

arithmetic for vectors or components.