# [GiNaC-list] A.i B~i != A.0 B~0 + A.1 B~1 + ... [WAS: Bug or feature?]

Richard B. Kreckel kreckel at ginac.de
Tue Jul 12 22:35:22 CEST 2005

On Tue, 28 Jun 2005, Sheplyakov Alexei wrote:
> 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.
>
>
> 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.html
>
>
> P.S.
>
> This question tends to become a FAQ.

Can you suggest the wording for such a FAQ entry?  I'll happily add it,
but I feel that you're much better at explaining this issue.

Regards
-richy.
--
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>