# How do I define a tensor from another tensor with summations? [duplicate]

Let's say we have a rank 2 tensor $g_{ij}$. This is basically a list with a Depth of 2. Now I'd like to calculate another tensor

$\Gamma_{ij}=\frac{1}{2}g^{ks}g_{is}=\frac{1}{2}(g^{k1}g_{i1}+g^{k2}g_{i2}+g^{k3}g_{i3}+...)$,

which is another list of Depth 2. For instance, to find a specific element, one would simply say

$\Gamma_{23}=\frac{1}{2}(g^{21}g_{31}+g^{22}g_{32}+g^{23}g_{33}+...)$.

We also know that $g^{ij}$ (which I will call ginv is found by taking the inverse of $g_{ij}$, i.e. ginv=Inverse[g].

I'm having trouble defining $\Gamma$ index by index. I thought of using Array, but I can't really come up with a solution. Does anybody have any ideas?

• Shouldn't there be also $g_{\text{kj}}$ in $\Gamma _{\text{ij}}$ definition? I think you may be interested in Artes answer for ... Ricci tensor ... in Mathematica
– Kuba
Feb 15 '14 at 20:49
• The definitions are not correct, and yes that's what I will try to implement eventually. For now, I was just trying to do some basic tensor math. Feb 15 '14 at 20:56
• Actually, yes that answer has everything I wanted. I'll delete this question :) Feb 15 '14 at 20:59
• You don't have to. It can be marked as duplicate and stay here as a road sign for future visitors.
– Kuba
Feb 15 '14 at 20:59
• All right then, I'll let it stay. I might post a basic answer, adapted from that other question you mentioned. Thanks! Feb 15 '14 at 21:03