Memoization

10 views
Skip to first unread message

DG

unread,
Oct 18, 2021, 1:12:37 PM10/18/21
to xAct Tensor Computer Algebra
Hi,

What is the xAct analogue of writing something like

f[n_]:= f[n]= ....

i.e. to define recursively a sequence of tensors 
where the n-th one is built from the (n-1) -th one

DG

Thomas Bäckdahl

unread,
Oct 18, 2021, 1:32:31 PM10/18/21
to xa...@googlegroups.com
Hi!

In Mathematica (and xAct) you can define anything recursively like
f[0] = something
f[n_] := some expression of f[n-1]

What makes this a bit more complicated for tensors in xAct is that tensors are usually defined using DefTensor and given a specific symbol. However, one does not need to do it like that. One can set up some new object and define all the properties of it so that the rest of xAct will treat it as a tensor.
However, how you want to do this depends on the details of your problem.
Does the valence numbers or the symmetries depend on n?
Do you want to handle all the tensors in the sequence abstractly, or is is good enough that you each time construct the corresponding expression in terms of the base tensor?

It will probably be a bit easier to answer your question if you give a bit more detail of what you would like to do.

Regards
Thomas
--
You received this message because you are subscribed to the Google Groups "xAct Tensor Computer Algebra" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xact+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xact/03eac5e7-aea6-439c-81c1-5969e3cf2f2an%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages