Lambdify in symbolic module¶
Importing required modules¶
[1]:
import sympy
from sympy import symbols
from einsteinpy.symbolic import BaseRelativityTensor
sympy.init_printing()
Calculating a Base Relativity Tensor¶
[2]:
syms = symbols("x y")
x, y = syms
T = BaseRelativityTensor([[x, 1],[0, x+y]], syms, config="ll")
Calling the lambdify function¶
[3]:
args, func = T.tensor_lambdify()
args
[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¶
[4]:
func(2, 1)
[4]:
$\displaystyle \left[ \left[ 2, \ 1\right], \ \left[ 0, \ 3\right]\right]$