Lambdify in symbolic module

Importing required modules

In [1]:
import sympy

from sympy import symbols

from einsteinpy.symbolic import BaseRelativityTensor



sympy.init_printing()

Calculating a Base Relativity Tensor

In [2]:
syms = symbols("x y")

x, y = syms

T = BaseRelativityTensor([[x, 1],[0, x+y]], syms, config="ll")

Calling the lambdify function

In [3]:
args, func = T.tensor_lambdify()

args
Out[3]:
$\displaystyle \left( x, \ y\right)$

args indicates the order in which arguments should be passed to the returned function func

Executing the returned function for some value

In [4]:
func(2, 1)
Out[4]:
$\displaystyle \left[ \left[ 2, \ 1\right], \ \left[ 0, \ 3\right]\right]$