# [GiNaC-list] Simplifying indexed expressions not working onmulti-indices scalar_product

Alejandro Limache alejandrolimache at hotmail.com
Thu Jul 27 21:19:04 CEST 2006

```Chris,

On the issue if scalar_products defined for more than one indices are
useful,
I would say definitely yes.
Scalar products also known as "inner products" appear in many areas of
physics
and they may involve higher order tensors (tensor with more than one index).

For example, in the area of continuum mechanics, its very common to see
inner products defined for 2nd order tensors (2 indices). In particular the
"stress power P"
is the inner product of the stress tensor T with the rate of deformation
tensor D:
P = T*D=T.i.j * D.i.j
and measures the power produced by the inner (stress) forces.

Three observations on inner products:
1) By definition an inner product must be a scalar so all tensor indices
should get contracted.
2) One must be careful with the order of the indices. The inner product of
a non zero tensor with itself must be positive, from this condition it
follows
that
T.i.j * D.j.i               is NOT an inner product
3) Covariant indices should contract with contravariant indices
so T~a.mu*T~a~mu is not correct a should throw an exception
or not get simplified, but T.a.mu*T~a~mu should get simplified.

My first impression on GINAC has been very good. I am really hopeful
to be able to make a unique code where I can mix symbolic calculations
with numerical computations, that would be so great for my research.

One of the things I like to do for example is to use symbolic math to
compute quantities defined as C++ objects such as
A = B+C+D, so they get expanded in indices
A.i = B.i+C.i.D.i
to be computed efficiently as they were C languaje.

Alejandro

>From: Chris Dams <Chris.Dams at mi.infn.it>
>Reply-To: GiNaC discussion list <ginac-list at ginac.de>
>To: GiNaC discussion list <ginac-list at ginac.de>
>Subject: Re: [GiNaC-list] Simplifying indexed expressions not working
>onmulti-indices scalar_product
>Date: Thu, 27 Jul 2006 13:08:59 +0200 (CEST)
>
>
>Dear Alejandro,
>
>On Wed, 26 Jul 2006, Alejandro Limache wrote:
>
> > According to section 4.14.5 "Simplifying indexed expressions" of the
> > tutorial,
> > if I set:
> >          scalar_products sp;
> > then:
> >         A~mu~nu*B.mu.nu
> > should be replaced by zero when using .simplify_indexed(sp).
> > This is not working. See my simple code below.
>
>Ah yes, I see. Actually, I removed this possibility from the library some
>time ago. See:
>http://www.ginac.de/pipermail/ginac-devel/2005-December/000878.html Since
>I thought that nobody would be using this feature, I, in the end, did what
>I said in the "Note:" and now GiNaC does not try anymore to apply
>scalar_products in case that the indexed objects have more than one index.
>Of course, the tutorial should also be made consistent with this, so I
>will do that. On the other hand, you might also try to convince me that we
>really do need this kind of contraction...
>
>Thanks for pointing this out, anyway.
>
>Best wishes,
>Chris
>
>_______________________________________________
>GiNaC-list mailing list
>GiNaC-list at ginac.de
>https://www.cebix.net/mailman/listinfo/ginac-list

```