On Tue, Jun 21, 2005 at 09:15:38PM +0200, Javier Ros Ganuza wrote:
I think the following expressions are mathematically equivalent:
cout << (indexed(matrix(3,1, lst(a1,b1,c1)), mu.toggle_variance ())+indexed(matrix(3,1, lst(a2,b2,c2)), mu.toggle_variance ())).simplify_indexed()*basis1 << endl;
cout << ((indexed(matrix(3,1, lst(a1,b1,c1)), mu.toggle_variance ())+indexed(matrix(3,1, lst(a2,b2,c2)), mu.toggle_variance ()))*basis1).simplify_indexed() << endl;
cout << (indexed(matrix(3,1, lst(a1,b1,c1)), mu.toggle_variance ())*basis1+indexed(matrix(3,1, lst(a2,b2,c2)), mu.toggle_variance ())*basis1).simplify_indexed() << endl;
Where
varidx mu(symbol("mu", "\\mu"), 3); ex basis1 = clifford_unit(mu, diag_matrix(lst(1, 1, 1)),1);
But output is different
[[a2+a1],[b1+b2],[c2+c1]].mu*e~mu [[a2],[b2],[c2]].mu*e~mu+[[a1],[b1],[c1]].mu*e~mu [[a2],[b2],[c2]].mu*e~mu+[[a1],[b1],[c1]].mu*e~mu
Is this intended behaviour?
First of all, most of GiNaC's indexed objects are tensors, and a.i*b~i != a.0*b~0 + a.1*b~1 + ..., since the dimension of index can be arbitrary (e.g. complex). Obviously, matrix indices should have non-negative integer dimension, so matrices are NOT tensors, and product of matrix expression and tensor expression is [almost] meaningless. See also http://thep.physik.uni-mainz.de/pipermail/ginac-list/2005-April/000638.html and http://thep.physik.uni-mainz.de/pipermail/ginac-list/2004-December/000576.ht... P.S. This question tends to become a FAQ. -- ROOT: an octopus made by nailing extra legs onto a cat.