Multivector and Linear Multivector Differential Operator


class*kargs, **kwargs)[source]

Differential operator class for multivectors. The operators are of the form

D = D^{i_{1}…i_{n}}partial_{i_{1}…i_{n}}

where the D^{i_{1}…i_{n}} are multivector functions of the coordinates x_{1},…,x_{n} and partial_{i_{1}…i_{n}} are partial derivative operators

partial_{i_{1}…i_{n}} =

If * is any multivector multiplicative operation then the operator D operates on the multivector function F by the following definitions

D*F = D^{i_{1}…i_{n}}*partial_{i_{1}…i_{n}}F

returns a multivector and

F*D = F*D^{i_{1}…i_{n}}partial_{i_{1}…i_{n}}

returns a differential operator. If the ‘cmpflg’ in the operator is set to ‘True’ the operation returns

F*D = (partial_{i_{1}…i_{n}}F)*D^{i_{1}…i_{n}}

a multivector function. For example the representation of the grad operator in 3d would be:

D^{i_{1}…i_{n}} = [e__x,e__y,e__z] partial_{i_{1}…i_{n}} = [(1,0,0),(0,1,0),(0,0,1)].

See LaTeX documentation for definitions of operator algebraic operations +, -, *, ^, |, <, and >.


Remove zero coefs and consolidate coefs with repeated pdiffs.

simplify(modes=<function simplify>)[source]

Simplify each multivector coefficient of a partial derivative

class*kargs, **kwargs)[source]

Wrapper class for multivector objects (self.obj) so that it is easy to overload operators (*,^,|,<,>) for the various multivector products and for printing. Also provides an __init__ fuction to easily instanciate multivector objects. Additionally, the functionality of the multivector derivative have been added via the special vector ‘grad’ so that one can take the geometric derivative of a multivector function ‘A’ by applying ‘grad’ from the left, ‘grad*A’, or the right ‘A*grad’ for both the left and right derivatives. The operator between the ‘grad’ and the ‘A’ can be any of the multivector product operators.

If ‘f’ is a scalar function ‘grad*f’ is the usual gradient of a function. If ‘A’ is a vector function ‘grad|f’ is the divergence of ‘A’ and ‘-I*(grad^A)’ is the curl of ‘A’ (I is the pseudo scalar for the geometric algebra)

Data Variables -

Fmt(fmt=1, title=None)[source]

Set format for printing of multivectors -

fmt = 1 - One multivector per line fmt = 2 - One grade per line fmt = 3 - one base per line

Usage for multivector A example is -


output is

‘A = ‘+str(A)

with one grade per line. Works for both standard printing and for latex.

Grad(coords, mode='*', left=True)[source]

Returns various derivatives (*,^,|,<,>) of multivector functions with respect to arbitrary coordinates, ‘coords’. This would be used where you have a multivector function of both the basis coordinate set and and auxilliary coordinate set. Consider for example a linear transformation in which the matrix coefficients depend upon the manifold coordinates, but the vector being transformed does not and you wish to take the divergence of the linear transformation with respect to the linear argument.

static Mul(A, B, op)[source]

Function for all types of geometric multiplications called by overloaded operators for *, ^, |, <, and >.


For a multivector, A, and a list of basis blades, blade_lst return a list (sympy expressions) of the coefficients of each basis blade in blade_lst


# group coeffients of blades of multivector # so there is only one coefficient per grade self.obj = expand(self.obj) if self.is_blade_rep or Mv.Ga.is_ortho:

c = self.Ga.blades_lst
c = self.Ga.bases_lst

self.obj = self.obj.collect(c) return self


Only works if square of multivector is a scalar. If square is a number we can determine if square is > or < zero and hence if one should use trig or hyperbolic functions in expansion. If square is not a number use ‘hint’ to determine which type of functions to use in expansion


This follows Leo Dorst’s test for a versor. Leo Dorst, ‘Geometric Algebra for Computer Science,’ p.533 Sets self.versor_flg and returns value


If A is a multivector and A*A.rev() is a scalar then

A.norm() = sqrt(Abs(A*A.rev()))

The problem in simplifing the norm is that if A is symbolic you don’t know if A*A.rev() is positive or negative. The use of the hint argument is as follows:

hint A.norm()
‘+’ sqrt(A*A.rev()) ‘-‘ sqrt(-A*A.rev()) ‘0’ sqrt(Abs(A*A.rev()))

The default hint=’+’ is correct for vectors in a Euclidean vector space. For bivectors in a Euclidean vector space use hint=’-‘. In a mixed signature space all bets are off for the norms of symbolic expressions.


Project multivector onto a given list of bases. That is find the part of multivector with the same bases as in the bases_lst.


For pure grade return grade. If not pure grade return negative of maximum grade

static setup(ga)[source]

Set up constant mutilvectors reqired for multivector class for a given geometric algebra, ‘ga’.

class*kargs, **kwargs)[source]

Partial derivative class for multivectors. The partial derivatives are of the form

partial_{i_{1}…i_{n}} =

If i_{j} = 0 then the partial derivative does not contain the x^{i_{j}} coordinate.

The partial derivative is represented by a dictionary with coordinates for keys and key value are the number of times one differentiates with respect to the key.

The partial differential operator is a partial derivative with respect to a set of real symbols (variables). The allowed variables are in two lists. self.Ga.coords is a list of the coordinates associated with the geometric algebra. self.Ga.auxvars is a list of auxiallary symbols that have be added to the geometric algebra using the member function Ga.AddVars(self,auxvars).

The data structure of a Pdop is the dictionary self.pdiffs where the keys are the variables of differentiation and the values are the order of differentiation of with respect to the variable.


If partial derivative operator self.order > 1 factor out first order differential operator. Needed for application of partial derivative operator to product of sympy expression and partial differential operator. For example if D = Pdop({x:3}) then

(Pdop({x:2}),Pdop({x:1})) = D.factor()
class*kargs, **kwargs)[source]

Scalar differential operator is of the form (Einstein summation)

D = c_{i}*D_{i}

where the c_{i}’s are scalar coefficient (they could be functions) and the D_{i}’s are partial differential operators.

The scalar differential operator structure is of the form (Einstein summation)

D = c_{i}D_{i}

where the c_{i}’s are scalar coefficients and the D_{i}’s are partial differential operator (class Pdop). D is stored in the structure self.terms = [(c_{1},D_{1}),(c_{2},D_{2}),…].

static consolidate_coefs(sdop)[source]

Remove zero coefs and consolidate coefs with repeated pdiffs., B)[source]

Determine is B = c*A where c is a scalar. If true return c otherwise return 0.