exalgebra v0.0.4 ExAlgebra.Vector3
Functions that perform computations on 3-vectors.
Summary
Functions
Computes the area of a parallelogram.
Examples
iex> ExAlgebra.Vector3.area_of_parallelogram([2, 1, -3], [1, 3, 2])
:math.sqrt(195)
Computes the cross product.
Examples
iex> ExAlgebra.Vector3.cross_product([2, 1, -1], [-3, 4, 1])
[5, 1, 11]
Computes the equation of the plain. This outputs a 4-vector with its 4th element containing the scalar part. For example, [11, -10, 4, -19] should be interpreted as 11x - 10y + 4z = -19.
Examples
iex> ExAlgebra.Vector3.equation_of_plain([1, 3, 0], [3, 4, -3], [3, 6, 2])
[11, -10, 4, -19]
Returns true if two vectors are parallel and false otherwise.
Examples
iex> ExAlgebra.Vector3.is_parallel?([2, -4, 1], [-6, 12, -3])
true
Computes the scalar triple product.
Examples
iex> ExAlgebra.Vector3.scalar_triple_product([3, 2, 1], [-1, 3, 0], [2, 2, 5])
47.0
Computes the volume of a parallelepiped.
Examples
iex> ExAlgebra.Vector3.volume_of_parallelepiped([-3, 2, 1], [-1, -3, 0], [2, 2, -5])
51.0
Functions
Specs
area_of_parallelogram([number], [number]) :: number
Computes the area of a parallelogram.
Examples
iex> ExAlgebra.Vector3.area_of_parallelogram([2, 1, -3], [1, 3, 2])
:math.sqrt(195)
Specs
cross_product([number], [number]) :: [number]
Computes the cross product.
Examples
iex> ExAlgebra.Vector3.cross_product([2, 1, -1], [-3, 4, 1])
[5, 1, 11]
Specs
equation_of_plain([number], [number], [number]) :: [number]
Computes the equation of the plain. This outputs a 4-vector with its 4th element containing the scalar part. For example, [11, -10, 4, -19] should be interpreted as 11x - 10y + 4z = -19.
Examples
iex> ExAlgebra.Vector3.equation_of_plain([1, 3, 0], [3, 4, -3], [3, 6, 2])
[11, -10, 4, -19]
Specs
is_parallel?([number], [number]) :: boolean
Returns true if two vectors are parallel and false otherwise.
Examples
iex> ExAlgebra.Vector3.is_parallel?([2, -4, 1], [-6, 12, -3])
true
Specs
scalar_triple_product([number], [number], [number]) :: number
Computes the scalar triple product.
Examples
iex> ExAlgebra.Vector3.scalar_triple_product([3, 2, 1], [-1, 3, 0], [2, 2, 5])
47.0