Metric Tensor Module

This module contains the class for defining a Metric belonging to any arbitrary space-time symbolically:

class einsteinpy.symbolic.metric.MetricTensor(arr, syms, config='ll', name='GenericMetricTensor')[source]

Bases: einsteinpy.symbolic.tensor.BaseRelativityTensor

Class to define a metric tensor for a space-time

Constructor and Initializer

Parameters
  • arr (ImmutableDenseNDimArray or list) – Sympy Array or multi-dimensional list containing Sympy Expressions

  • syms (tuple or list) – Tuple of crucial symbols denoting time-axis, 1st, 2nd, and 3rd axis (t,x1,x2,x3)

  • config (str) – Configuration of contravariant and covariant indices in tensor. ‘u’ for upper and ‘l’ for lower indices. Defaults to ‘ll’.

  • name (str) – Name of the Metric Tensor. Defaults to “GenericMetricTensor”.

Raises
  • TypeError – Raised when arr is not a list or sympy Array

  • TypeError – syms is not a list or tuple

  • ValueError – config has more or less than 2 indices

change_config(newconfig='uu')[source]

Changes the index configuration(contravariant/covariant)

Parameters

newconfig (str) – Specify the new configuration. Defaults to ‘uu’

Returns

New Metric with new configuration. Defaults to ‘uu’

Return type

MetricTensor

Raises

ValueError – Raised when new configuration is not ‘ll’ or ‘uu’. This constraint is in place because we are dealing with Metric Tensor.

inv()[source]

Returns the inverse of the Metric. Returns contravariant Metric if it is originally covariant or vice-versa.

Returns

New Metric which is the inverse of original Metric.

Return type

MetricTensor

lower_config()[source]

Returns a covariant instance of the given metric tensor.

Returns

same instance if the configuration is already lower or inverse of given metric if configuration is upper

Return type

MetricTensor

lorentz_transform(transformation_matrix)[source]

Performs a Lorentz transform on the tensor.

Parameters

transformation_matrix (ImmutableDenseNDimArray or list) – Sympy Array or multi-dimensional list containing Sympy Expressions

Returns

lorentz transformed tensor

Return type

MetricTensor