Keeping Head xTensor when defining objects in xCoba

40 views
Skip to first unread message

Max Banados

unread,
Jan 26, 2023, 10:10:45 PM1/26/23
to xAct Tensor Computer Algebra
Dear all, I have a simple question (I believe). 

In xCoba with a 3d Manifold and chart (ch) defined, I have introduced a vector, say,

v = CTensor[{1,2,3},{ch}]

Its Head is xTensor as it should be. Now I define the product

T[a,b] = v[a] v[b]

The problem is that the Head of T is not xTensor, and this brings some trouble with 
other calculations.  I have found a way around (adapting a previous message from José) 

(T = HeadOfTensor[v[a] v[b], {a, b}])[a, b]

The question is: Is this the right way to do this?  
Would this form properly treat the indices used in the definition (a,b) as dummy?  
(Is there a simpler way to do this?  My real calculation is way more complicated...)

Thanks!
Max




Jose

unread,
Jan 26, 2023, 10:26:21 PM1/26/23
to xAct Tensor Computer Algebra
Hi,

From the vector

   v = CTensor[{1, 2, 3}, {ch}]

there are basically two ways of performing the tensor product v * v : either via indices or in index-free form:

   - The formula you gave, using HeadOfTensor, is the right way to do this operation with indices: you first put indices in both v vectors, let the product happen (with the indices taking care of order), and finally remove the indices again to get T (with HeadOfTensor).

   - Internally xCoba converts that operation with indices into an index-free operation, using this internal function:

      In[ ]:= T = xAct`xCoba`Private`CTensorProduct[v, v]
      Out[ ]= CTensor[{{1, 2, 3}, {2, 4, 6}, {3, 6, 9}}, {ch, ch}, 0]

The three fundamental operations of tensor algebra (tensor products, transpositions and contractions) can be performed with indices or in index-free form, and there are respective internal functions for those operations (CTensorProduct, CTensorTranspose and CTensorContract). For simple cases the index-free functions may be useful and more efficient, but as soon as the computations get complicated, the indexed approach is easier to read/write, and hence safer, in my opinion.

Cheers,
Jose.

Max Bañados

unread,
Jan 27, 2023, 10:43:03 AM1/27/23
to Jose, xa...@googlegroups.com
Dear José, 

Thank you very much for your quick and informative reply. I agree that (error-free) tensor products are easier with indexed expressions. 

Regards, 
Max    
--
You received this message because you are subscribed to a topic in the Google Groups "xAct Tensor Computer Algebra" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xact/yPf10ZDmQO8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xact+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xact/16892323-b763-4d65-8711-59f4ff3a4d43n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages