ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 25 Sep 2015 17:51:23 -0500Index notationhttps://ask.sagemath.org/question/29595/index-notation/ I am taking a course in general relativity, and I was planing to use sage for doing calculations.
I have
from sage.tensor.modules.tensor_with_indices import TensorWithIndices
M = FiniteRankFreeModule(QQ, 4, name='M')
e = M.basis('e')
a = M.tensor((2,0), name='a')
a[:] = [[2,0,1,-1], [1,0,3,2], [-1,1,0,0], [-2,1,1,-2]]
g = M.tensor((0,2), name='g')
g[:] = [[1,0,0,0], [0,1,0,0], [0,0,1,0],[0,0,0,1]]
v=M.tensor((1,0), name='v')
v[:]=[-1,2,0,-2]
I wanted to calculate $a^{^i,^j}$
Is there some way to tell Sage what is the metric, and do the index lowering automatically? I did it manually, but it's cumbersome for more complicated calculations.
A=a['^ik']*g['_jk'];A[:]
Also, I don't know how to compute $vĂ® v_i$, since
v['^i']*g['_ij']*v['i']
does not work.
Apart from that, I would like to know if there is a way to do this kind of computations with tensor fields and index notation, including derivatives, etc.MLainzFri, 25 Sep 2015 17:51:23 -0500https://ask.sagemath.org/question/29595/