1 | initial version |
Hi,
Since Sage 6.6 (released 2 days ago !), there is some Einstein notation in Sage, but only for some specific purpose: operations on tensors defined on free modules:
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: e = M.basis('e')
sage: a = M.tensor((1,1))
sage: a[:] = [[2,0,-1], [3,-6,1], [2,1,-4]]
sage: b = M([3,-5,1])
sage: c = a['^i_j'] * b['^j'] # contraction on the repeated index j
sage: c
Element of the Rank-3 free module M over the Integer Ring
sage: c[:]
[5, 40, -3]
sage: c.display()
5 e_0 + 40 e_1 - 3 e_2
sage: a['^k_k'] # trace of a
-8
See here for more details.
Maybe there is Einstein notation in other parts of Sage, but I am not aware of them.
Eric.