Metric Tensor and Derivatives of Basis Vectors.


class galgebra.metric.Metric(basis, **kwargs)[source]

Data Variables -

g[,]: metric tensor (sympy matrix) g_inv[,]: inverse of metric tensor (sympy matirx) norm: normalized diagonal metric tensor (list of sympy numbers) coords[]: coordinate variables (list of sympy symbols) is_ortho: True if basis is orthogonal (bool) connect_flg: True if connection is non-zero (bool) basis[]: basis vector symbols (list of non-commutative sympy variables) r_symbols[]: reciprocal basis vector symbols (list of non-commutative sympy variables) n: dimension of vector space/manifold (integer) n_range: list of basis indices de[][]: derivatives of basis functions. Two dimensional list. First

entry is differentiating coordiate. Second entry is basis vector. Quantities are linear combinations of basis vector symbols.
sig: Signature of metric (p,q) where n = p+q. If metric tensor

is numerical and orthogonal it is calculated. Otherwise the following inputs are used -

input signature Type

“e” (n,0) Euclidean “m+” (n-1,1) Minkowski (One negative square) “m-” (1,n-1) Minkowski (One positive square)

p (p,n-p) General (integer not string input)

mode = 1 Christoffel symbols of the first kind mode = 2 Christoffel symbols of the second kind

static dot_orthogonal(V1, V2, g=None)[source]

Returns the dot product of two vectors in an orthogonal coordinate system. V1 and V2 are lists of sympy expressions. g is a list of constants that gives the signature of the vector space to allow for non-euclidian vector spaces.

This function is only used to form the dot product of vectors in the embedding space of a vector manifold or in the case where the basis vectors are explicitly defined by vector fields in the embedding space.

A g of None is for a Euclidian embedding space.


rows of metric tensor are separated by “,” and elements of each row separated by ” “. If the input is a single row it is assummed that the metric tensor is diagonal.

Output is a square matrix.

sig = None

String for symbolic metric determinant. If self.gsym = ‘g’ then det(g) is sympy scalar function of coordinates with name ‘det(g)’. Useful for complex non-orthogonal coordinate systems or for calculations with general metric.


If expression is product of even powers then every power is divided by two and the product is returned. If some terms in product are not even powers the sqrt of the absolute value of the expression is returned. If the expression is a number the sqrt of the absolute value of the number is returned.

galgebra.metric.test_init_slots(init_slots, **kwargs)[source]

Tests kwargs for allowed keyword arguments as defined by dictionary init_slots. If keyword argument defined by init_slots is not present set default value asdefined by init_slots. Allow for backward compatible keyword arguments by equivalencing keywords by setting default value of backward compatible keyword to new keyword and then referencing new keywork (see init_slots for Metric class and equivalence between keywords ‘g’ and ‘metric’)