# galgebra.metric¶

Metric Tensor and Derivatives of Basis Vectors.

## Members¶

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

Metric specification

g

metric tensor

Type: sympy matrix[,]
g_inv

inverse of metric tensor

Type: sympy matrix[,]
norm

normalized diagonal metric tensor

Type: list of sympy numbers
coords

coordinate variables

Type: list[] of sympy symbols
is_ortho

True if basis is orthogonal

Type: bool
connect_flg

True if connection is non-zero

Type: bool
basis

basis vector symbols

Type: list[] of non-commutative sympy variables
r_symbols

reciprocal basis vector symbols

Type: list[] of non-commutative sympy variables
n

dimension of vector space/manifold

Type: 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.

Type: list[][]
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)
Type: Tuple[int, int]
gsym

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.

Type: str
Christoffel_symbols(mode=1)[source]

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

Isq = None

Sign of I**2, only needed if I**2 not a number

detg = None

Determinant of g

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.

g_adj = None

g_inv = None

Inverse of g

metric_symbols_list(s=None)[source]

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.

galgebra.metric.collect(A, nc_list)[source]
Parameters: A – a linear combination of noncommutative symbols with scalar expressions as coefficients nc_list – noncommutative symbols in A to combine A sum of the terms containing the noncommutative symbols in nc_list such that no elements of nc_list appear more than once in the sum. All coefficients of a given element of nc_list are combined into a single coefficient. sympy.Basic
galgebra.metric.square_root_of_expr(expr)[source]

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’)