galgebra.lt
Multivector Linear Transformation
Members
- galgebra.lt.Symbolic_Matrix(kernel, coords=None, f=False, mode='g')[source]
Returns a square real matrix the entries of which are symbolic constants or symbolic functions of the coordinates. - kernel is a one-letter string. It specifies the kernel letter of
indexed symbols or functions used to specify the matrix’s entries
coords is a list or tuple. Its entries are used to label the components of a vector.
f, a boolean, specifies that matrix entries are symbolic functions of the coordinates or are symbolic constants, according to whether f is True or False.
mode is a one-letter string. When`mode` is ‘g’, ‘s’, or ‘a’ the matrix will be general, symmetric, or antisymmetric.
- galgebra.lt.Matrix_to_dictionary(mat_rep, basis)[source]
Convert matrix representation of linear transformation to dictionary
- galgebra.lt.Dictionary_to_Matrix(dict_rep, ga)[source]
Returns the matrix representation of that linear transformation on geometric algebra ga which has dictionary representation dict_rep.
- class galgebra.lt.Lt(self, *args, ga, **kwargs)[source]
Bases:
GaPrintable
A Linear Transformation
Except for the versor representation, the linear transformation is stored as a dictionary with basis vector keys and vector values
self.lt_dict
so that a is a vector \(a = a^{i}e_{i}\) then\[\mathtt{self(}a\mathtt{)} = a^{i} * \mathtt{self.lt\_dict[}e_{i}\mathtt{]}.\]For the versor representation, the linear transformation is stored as a versor
self.V
so that if a is a vector:self(a) = self.V.g_invol() * a * self.V.inv()
where
self.V.g_invol()
is the grade involute ofself.V
.- lt_dict
the keys are the basis symbols, \(e_i\), and the dictionary entries are the object vector images (linear combination of sympy non-commutative basis symbols) of the keys so that if
L
is the linear transformation then:L(e_i) = self.Ga.mv(L.lt_dict[e_i])
- Type:
Note this constructor is overloaded, based on the type of the positional argument:
- class Lt(lt_dict: Dict[Expr, Expr], /, *, ga)
Construct from a dictionary mapping source basis blade expressions to multivectors.
- class Lt(lt_matrix: Matrix, /, *, ga)
Construct from the operation of matrix pre-multiplication.
# ## GSG code starts ### .. class:: Lt(lt_list: list, /, *, ga)
- noindex:
Construct from a list of lists, the j_th list of which contains the coefficients of j_th image vector’s basis expansion.
# ## GSG code ends ###
- class Lt(versor: mv.Mv, /, *, ga)
Construct from a not-necessarily-normalized versor.
- class Lt(func: Callable[[mv.Mv], mv.Mv], /, *, ga)
Construct from a function, which is tested for linearity.
- class Lt(s: str, /, *, ga, f=False, mode='g')
Construct an appropriate matrix from a string s.
- Parameters:
- det() Expr [source]
Returns the determinant of the linear transformation \(L\), defined by \(\det(L) = L(E) E^{-1}\), where \(E\) is the basis blade for the pseudoscalar grade space.
Expression returned is a real SymPy scalar, not a GAlgebra 0-vector.
- tr() Expr [source]
Returns the trace (a scalar) of the linear transformation, \(L\), defined by \({{\operatorname{tr}}\lp {L} \rp }=\nabla_{a}\cdot{{L}\lp {a} \rp }\) where \(a\) is a vector in the tangent space.
- adj() Lt [source]
Returns the adjoint transformation \({\bar{L}}\) of linear transformation \(L\), defined by \(a\cdot{{L}\lp {b} \rp } = b\cdot{{\bar{L}}\lp {a} \rp }\), where \(a\) and \(b\) are any two vectors in the tangent space.
- inv()[source]
Returns compositional inverse of linear transformation`self`. Assumes transformation is nonsingular. If self is a versor based transformation, its inverse will also be versor based.
- matrix() MutableDenseMatrix [source]
Returns the matrix \([{L__i}_j]\) defined for linear transformation \(L\) by \(L({\eb}_j)=\sum_i {L__i}_j \eb}_i\).
- class galgebra.lt.Mlt(f, Ga, nargs=None, fct=False)[source]
Bases:
GaPrintable
A multilinear transformation (mlt) is a multilinear multivector function of a list of vectors (
*args
) \(F(v_1,...,v_r)\) where for any argument slot \(j\) we have (\(a\) is a scalar and \(u_j\) a vector)\[\begin{split}F(v_1,...,a*v_j,...,v_r) &= a*F(v_1,...,v_j,...,v_r) \\ F(v_1,...,v_j+u_j,...,v_r) &= F(v_1,...,v_j,...,v_r) + F(v_1,...,u_j,...,v_r).\end{split}\]If F and G are two
Mlt
s with the same number of argument slots then the sum is\[(F+G)F(v_1,...,v_r) = F(v_1,...,v_r) + G(v_1,...,v_r).\]If \(F\) and \(G\) are two
Mlt
s with \(r\) and \(s\) argument slots then their product is\[(F*G)(v_1,...,v_r,...,v_{r+s}) = F(v_1,...,v_r)*G(v_{r+1},...,v_{r+s}),\]where \(*\) is any of the multivector multiplicative operations. The derivative of a
Mlt
with is defined as the directional derivative with respect to the coordinate vector (we assume \(F\) is implicitely a function of the coordinates)\[F(v_1,...,v_r;v_{r+1}) = (v_{r+1} \bullet \nabla)F(v_1,...,v_j,...,v_r).\]The contraction of a
Mlt
between slots \(j\) and \(k\) is defined as the geometric derivative of \(F\) with respect to slot \(k\) and the inner geometric derivative with respect to slot \(j\) (this gives the standard tensor definition of contraction for the case that \(F\) is a scalar function)\[\begin{split}\operatorname{Contract}(i,j,F) &= \nabla_i \bullet (\nabla_j F(v_1,...,v_i,...,v_j,...,v_r)) \\ &= \nabla_j \bullet (\nabla_i F(v_1,...,v_i,...,v_j,...,v_r)).\end{split}\]This returns a
Mlt
with slot \(i\) and \(j\) removed.- Fmt(lcnt=1, title=None) GaPrintable [source]
Set format for printing of Tensors
- Parameters:
lcnt – Number of components per line
Notes
Usage for tensor T example is:
T.fmt('2', 'T')
output is:
print 'T = '+str(A)
with two components per line. Works for both standard printing and for latex.
- pdiff(slot: int)[source]
Returns gradient of tensor,
T
, with respect to slot vector.For example if the tensor is \({{T}\lp {a_{1},a_{2}} \rp }\) then
T.pdiff(2)
is \(\nabla_{a_{2}}T\). SinceT
is a scalar function,T.pdiff(2)
is a vector function.
- contract(slot1: int, slot2: int)[source]
Returns contraction of tensor between
slot1
andslot2
whereslot1
is the index of the first vector argument andslot2
is the index of the second vector argument of the tensor.For example if we have a rank two tensor,
T(a1, a2)
, thenT.contract(1, 2)
is the contraction ofT
. For this case since there are only two slots, there can only be one contraction.
- cderiv()[source]
Returns covariant derivative of tensor field.
If
T
is a tensor of rank \(k\) thenT.cderiv()
is a tensor of rank \(k+1\). The operation performed is defined in section Multilinear Functions.