On Wed, 13 Jul 2005, Sheplyakov Alexei wrote:
On Tue, Jul 12, 2005 at 10:35:22PM +0200, Richard B. Kreckel wrote: [...]
Can you suggest the wording for such a FAQ entry?
I will try.
---------------------------- cut here ------------------------------- Q1: I am wondering how to convince GiNaC that the following to expressions are equal: [[-1,0],[0,1]~mu~mu * a~mu [[-1,0],[0,1].nu~mu * a~nu
A: Declare `a' as a matrix. Otherwise, these expressions are meaningless.
The `indexed' class (and most of derived classes) is intended for tensor manipulation without referring to a particular basis. Thus, the `indexed' class is well suited for calculations involving (formally defined) tensor algebra of non-integer-dimensional space. This is particularly useful for evaluation of Feynman integrals in the framework of dimensional regularization.
On the other hand, the `matrix' class is _not_ treated as a tensor, so mixing matrices with indexed objects typically gives meaningless result.
Q2: I'd like to know if is it possible to unroll indexed objects. As example, I would like to do something like this
a_i a~i = (a_1)^2 + (a_2)^2 + (a_3)^2 + ...
A: You should use matrix instead of indexed. See also Q1.
Thanks a lot! I've coalesced the two Q's and A's into one (each). Hope the result is okay: <http://www.ginac.de/FAQ.html#matrix_indexed>. On a related note: It would be good if the FAQ could be incorporated into the sources. I wonder what format would be most convenient. Maybe just add it as another chapter to the Texinfo documentation? This would make it conveniently searchable from within info. Regards -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/>