[GiNaC-list] 3 index tensors

Gregory Stiesberg grs26 at cornell.edu
Sat Jul 9 04:24:58 CEST 2011


Hello,

Given a matrix of expressions A and vectors q,v,w, I'm trying to evaluate a
tensor expression of the type
diff(A_ij, q_k) * v_k * w_j .

With i,j,k of type idx, and A,q of type Matrix,
It would be nice to get a 3 index tensor from
indexed( diff(A(i,j),q(k)), i,j,k)
or by
diff(indexed(A,i,j),indexed(q,k))
but these don't work.

After looking at the definition of epsilon_tensor the simplest option seems
to be to write a class indexed_from_function3 able to return a 3-index
tensor from an arbitrary function of three indices:
for example
ex f(int i, int j, int k){
  return( diff(A(i,j),q(k)) );
}
ex tensexp0=indexed_from_function3(f, i,j,k) * indexed(v, k) * indexed(w, j)


Is there already a way to construct an arbitrary 3-index tensor that I've
not found yet?

Thanks in advance,

Gregg Stiesberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20110708/4c3da444/attachment.html>


More information about the GiNaC-list mailing list