Dear Alejandro, On Tue, 1 Aug 2006, Alejandro Limache wrote:
I am physicist (not a relativist one though).. but, is there something more useful than tensors representations (i.e tensor components) defined for integer indexes?!!!.
With the weather as it has been lately, I would say that surely swimming is more useful than tensor representations defined for integer indices. Going back to the topic, my opinion is that GiNaC should definitly support this use of tensors and their indices. However, we should also not forget that we want to support as well the interpretation of indices as in dimensional regularization. I think that both uses can coexist peacefully.
1) ex_to<numeric>(e.subs(lst(i==0,j==0))).to_double() This works in matrices but one should be abel to put numeric values inside indexed expressions and do matrix type operations...
Well, there is no reason why you couldn't substitute a matrix in case that the number of indices is one or two. Say, you have ex e = A.1[2].0[3] (note: index dimensions indicated in square brackets.) and you have matrix Amat(2,3); Amat = 1, 2, 3, 4, 5, 6; e.subs(A == Amat); // -> evaluates to 4. Of course, this does not help in the case of tensors of rank higher than 2.
2) expand_dummy_sum(const ex & e, bool subs_idx) there could be a similar function "expand_indexes" that expand summed and not summed indices. Example given ex e=indexed(A,i,j)*indexed(v,j) by applying the "expand_indices" function get: e=[[A.1.1*v1 A.1.2*v.2], [A.2.1*v1 A.2.2*v.2]]
However, does a row or a column matrix need to be returned? Also, in the case of two free indices, which of the two lables rows and which columns? Why not write such a function for yourself, send it to us and if it looks like it could be generally useful, we will be happy to include it in GiNaC. Best wishes, Chris