Ask Your Question
1

Is Einstein notation available in sage?

asked 2015-04-16 00:26:15 +0100

Haron gravatar image

updated 2015-04-16 00:28:23 +0100

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-04-16 13:47:17 +0100

eric_g gravatar image

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.

edit flag offensive delete link more

Comments

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.

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

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

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

I've been trying to derive an equation of general relativity and the computational time is too long. So i defined my metric in the object "tensorwithindices" but I cannot apply the attributes from the object "metric". Is there a way to merge attributes of two different objects

aneet gravatar imageaneet ( 2024-08-18 08:08:27 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-04-16 00:26:15 +0100

Seen: 608 times

Last updated: Apr 16 '15