Tensor Module

This module contains Tensor class which serves as the base class for more specific Tensors in General Relativity:

class einsteinpy.symbolic.tensor.Tensor(arr, config='ll')

Base Class for Tensor manipulation

Constructor and Initializer

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

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

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

  • TypeError – Raised when config is not of type str or contains characters other than ‘l’ or ‘u’

property order

Returns the order of the Tensor

property config

Returns the configuration of covariant and contravariant indices

tensor()

Returns the sympy Array

Returns

Sympy Array object

Return type

ImmutableDenseNDimArray

subs(*args)

Substitute the variables/expressions in a Tensor with other sympy variables/expressions.

Parameters

args (one argument or two argument) –

  • two arguments, e.g foo.subs(old, new)

  • one iterable argument, e.g foo.subs([(old1, new1), (old2, new2)]) for multiple substitutions at once.

Returns

Tensor with substituted values

Return type

Tensor

simplify()

Returns a simplified Tensor

Returns

Simplified Tensor

Return type

Tensor