You can just use pip
by typing:
pip install git+https://github.com/hearot/vectors.git
You can initialize a Vector
object by invoking its constructor and passing the three coordinates x
, y
and z
in order. Example:
>>> from vectors import Vector
>>> Vector(1, 2, 3)
Vector(1, 2, 3)
You can also initialize a Vector
object with the unit vector notation by invoking the Vector.from_symbols
static method. Example:
>>> from vectors import Vector, i, j, k
>>> Vector.from_symbols(i+2*j+3*k)
Vector(1, 2, 3)
In the end, you can even use spherical coordinates in order to create a Vector
object by invoking the Vector.from_polar
and passing the module, the azimuthal angle and the polar angle in order. Example:
>>> from sympy import pi
>>> from vectors import Vector
>>> Vector.from_polar(1, pi/2, pi/2)
Vector(0, 1, 0)
a*b
- equivalent toa.dot(b)
, the dot product betweena
andb
.a**b
- equivalent toa.cross(b)
, the cross product betweena
andb
.a|b
- the angle betweena
andb
(computer using the dot product).a^b
- the angle betweena
andb
(computed using the cross product).a.azimuthal
- the azimuthal angle (see Spherical Coordinates on Wikipedia and Wolfram MathWorld).abs(a)
- equivalent toa.module
, the module of the vector.a.polar
- the polar angle (see Spherical Coordinates on Wikipedia and Wolfram MathWorld).
- proofs/linear.py - proof of
a**b
being always orthogonal to a linear combination ofa
andb
.