points.vectors¶
Contains the Vector class.

class
points.vectors.
Vector
(*values)[source]¶ A Vector is a sequence of numbers. They can represent a point in space, or the attributes of an object.
Vectors can be added and subtracted with
+
and
, but*
is reserved for scalar multiplication  you can use it to multiply the vector by a number but not by another vector (there are special methods for this).Parameters: values – The numbers that make up the Vector. If a single sequence is given, that sequence will be unpacked to make the vector. 
length
()[source]¶ Returns the length of the vector. This is the number of values it contains, not its
magnitude()
.Return type: int

magnitude
()[source]¶ Returns the magnitude of the vector  the length of the line it represents in space.
Return type: float

insert
(index, value)[source]¶ Insertes a value into the vector.
Parameters:  index (int) – The location to insert to.
 value – the value to add.

pop
(index=1)[source]¶ Removes a value from the vector and returns it.
Parameters: index – the index to remove, default being 1
.Returns: the removed value.

components
()[source]¶ Returns the individual components that sum to make up the vector.
Returns: tuple
ofVector

linearly_dependent_on
(*vectors)[source]¶ Checks if this Vector is linearly dependent on a set of other vectors  that is, whether it is possible to construct this vector from a linear combination of the other vectors.
Parameters: *vectors – The vectors to check against. Return type: bool

linearly_independent_of
(*vectors)[source]¶ Checks if this Vector is linearly independent of a set of other vectors  that is, whether it is impossible to construct this Vector from a linear combination of the other Vectors.
Parameters: *vectors – The vectors to check against. Return type: bool

span
()[source]¶ Returns the vector’s span  the set of all vectors that can be constructed by scaling this vector.
Return type: VectorSpan

span_with
(*vectors)[source]¶ Returns the span of this vector and others  the set of all vectors that can be constructed by scaling and adding the vectors.
Return type: VectorSpan

dot
(other)[source]¶ Returns the dot product between this vector and another.
Parameters: other (Vector) – The other Vector.
Raises:  TypeError – If a nonVector is given.
 ValueError – If the Vectors are of different lengths.
Return type: float

cross
(other)[source]¶ Returns the cross product between this vector and another. Only threedimensional Vectors can do this (vectors of length 3).
Parameters: other (Vector) – The other Vector.
Raises:  TypeError – if a nonVector is given.
 ValueError – if the Vectors are not threedimensional.
Return type: Vector


class
points.vectors.
VectorSpan
(*vectors)[source]¶ A VectorSpan represents all the vectors that can be obtained by performing linear combinations of some starter set of vectors.
A Vector is
in
this span if it can be constructed from a linear combination of the defining Vectors. This is calculated using Gaussian elimination.Parameters: *vectors – The vectors which define the span. Any vectors that are linearly dependent on the others will be discarded. Raises: ValueError – if vectors of different dimensions are provided.