Today I have been looking at the sympy tensor package.  I have attached a
script in which I am trying to end of defining the Einstein tensor: R_{a b}
- 1/2 *g_{a b} * R.  But the script does not succeed on the last step of
evaluating the above expression and hence fails to agree to create the
Einstein tensor. I am wondering what I am doing incorrectly?

Thanks for advice.

Comer

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.
from sympy import Matrix, eye
from sympy.combinatorics import Permutation
from sympy.core import S, Rational, Symbol, Basic
from sympy.core.containers import Tuple
from sympy.core.symbol import symbols
from sympy.external import import_module
#from sympy.functions.elementary.miscellaneous import sqrt
from sympy.printing.pretty.pretty import pretty
from sympy.tensor.tensor import TensorIndexType, tensor_indices, TensorSymmetry, \
get_symmetric_group_sgs, TensorType, TensorIndex, tensor_mul, TensAdd, \
riemann_cyclic_replace, riemann_cyclic, TensMul, \
tensorsymmetry, tensorhead, TensorManager, TensExpr, TIDS

Lorentz = TensorIndexType('Lorentz', dummy_fmt='L')

d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11 =tensor_indices('d0:12', Lorentz)


a,b,c,d = tensor_indices('a,b,c,d',Lorentz)

Riem = tensorhead('Riem', [Lorentz]*4, [[2, 2]])

sym2 = tensorsymmetry([1]*2)

S2 = TensorType([Lorentz]*2,sym2)

Ric = S2('Ric')

Ric = Riem(d0, -d1, -d0, -d3)

print  Ric(-a,-b)

R = Ric(d0,-d0)

g = Lorentz.metric

Ric(-a,-b) -tensor_mul(Rational(1,2)*g(-a,-b) * R)

Reply via email to