# Is Einstein notation available in sage?

Dear all

I searched here. But I can not find a contented answer. There is a very usable notation in summations simplifying computations inclusive very $\Sigma$.

Is there a way in Sage that I can use this kind of notation? For more information, this notation is worked out in Cadabra.

edit retag close merge delete

Sort by ยป oldest newest most voted

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.

more

Dear Eric,

1) I must to thanks for your attention.

2) I saw the details link you mentioned. Your theory is very good. because I deal with vector spaces as very special modules. It works and seems flexible in computations. But, here is a problem for me. Since I am working with tensors symbolically, I need to recognizing no fixed dimension. Cadabra serves this very good for me. But, I like to do all of my computation with sage and python only.

( 2015-04-16 20:42:53 +0100 )edit

Alas in the current setting, the dimension has to be a well defined integer.

( 2015-04-16 22:39:25 +0100 )edit