according to Ginac-mini FAQ:
The indexed class (and most 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". .... In that framework, unrolling ai*ai to a1^2+a2^2+a3^2+... is not possible, since the dimension >is not integer!
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?!!!. Let us see... In two dimensions the tensor velocity vector V can be written in cartesian cordinates (x,y) with basis vectors (e.x,e.y) as: V.x e.x + V.y e.y but aren't we finally more interested in the values of the "components": V= [V.x ,V.y] ===> a matrix with 2 integer indices. But...let see in polar coordinates with basis vectors (e.r,e.theta) the same velocity vector can be written as V.r e.r + V.theta e.theta but aren't we finally more interested in the values of the "components": V= [V.r ,V.theta] ===> a matrix of 2 integer indices. but ....opps we always ended by looking at the multi-index arrays of integer indeces!!! It is because that I always want to get the components of tensors (which can be arranged as multidimensional arrays/matrices) is that I want to be able to unroll indexed objects. So I agree with the type of interest reported by another newbie to Ginac: (http://www.cebix.net/pipermail/ginac-list/2004-December/000576.html)
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 + ... or just substituting a_i values in a_i * b~i a_i = =(1,0,0) a_i b~i -> b~1 Definitely I like to be able to do things like the above.
Chris mentioned to me two things that could be very useful in indexed expressions: 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... 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]] cheersss Alejandro