Unexpected behavior of IndexCoefficient

47 views
Skip to first unread message

Antonin ROVAI

unread,
May 21, 2012, 5:29:25 AM5/21/12
to xact
Hello,

First of all, I wish to thank all contributors to the wonderful xAct package!

Please find enclosed an example of an unexpected behavior of IndexCoefficient.
I want to compute IndexCoefficient[X[i] X[-i], X[j] X[-j]]. The expected result is of course 1, but the answer of Mathematica is 1/2 + d/2 where d is the dimension of the manifold on which the vector X is defined.

In all simple situations I tried it seems that it is enough to replace d by 1 to get the correct result, but I don't know why.

Am I doing something wrong ?
Thank you for your help !

Antonin Rovai.
Example.nb

Thomas Bäckdahl

unread,
May 21, 2012, 12:53:30 PM5/21/12
to xa...@googlegroups.com
Hi Antonin!

You are not doing anything wrong, this is a bug.

What is happening here is that
IndexCoefficient[X[i] X[-i], X[j] X[-j]]
computes the result in two steps

First it computes
IndexCoefficient[X[i] X[-i], X[j]]
and gets a result
(X[-j] + g[-j, -l$1094]*X[l$1094])/2
This is not the nicest form but it is at least formally correct.
Then it computes
IndexCoefficient[Expand@%,X[-j]]
and gets
1/2+d/2
This is wrong. I have tracked it down to the following problem:
IndexCoefficient[g[-j, -l] X[l], X[-j]]
produces
g[-j, -l]g[l, j]
which is automatically converted to d.

I don't have a safe fix yet, but for your particular problem there is an alternative:
When you are searching for coefficients of scalar expressions like this one can use the fact that with a Scalar head the indices within will always be canonicalized to the same "minimal" indices.
For instance you can do something like:
Coefficient[ToCanonical@PutScalar[X[j]X[-j]],Scalar[X[-i]*X[i]]]

Regards
Thomas

Jose

unread,
May 22, 2012, 3:59:35 AM5/22/12
to xAct Tensor Computer Algebra
Hi,

A related post:

https://groups.google.com/group/xact/browse_thread/thread/a214ba5ffb48fe40

I agree that IndexCoefficient does not behave well in the case
reported by Antonin, but I'm not sure the general problem handled by
IndexCoefficient is well defined when there are dummy indices in the
second argument. For example, what is the coefficient of x[c] x[-c] in
x[a] x[b] ? By symmetry arguments the answer must be proportional to
g[a,b], but I'm not sure the coefficient is uniquely defined. (The
contraction of the answer with g[-a,-b] is the solution to Antonin's
question.) We need additional conditions on the decomposition (like
separation in pure trace and traceless parts) to make it unique.

Cheers,
Jose.

On May 21, 11:53 am, Thomas Bäckdahl <thomas.backd...@gmail.com>
wrote:

Thomas Bäckdahl

unread,
May 22, 2012, 5:09:53 AM5/22/12
to xa...@googlegroups.com
Hi!

On 2012-05-22 09:59, Jose wrote:
> Hi,
>
> A related post:
>
> https://groups.google.com/group/xact/browse_thread/thread/a214ba5ffb48fe40
>
> I agree that IndexCoefficient does not behave well in the case
> reported by Antonin, but I'm not sure the general problem handled by
> IndexCoefficient is well defined when there are dummy indices in the
> second argument. For example, what is the coefficient of x[c] x[-c] in
> x[a] x[b] ? By symmetry arguments the answer must be proportional to
> g[a,b], but I'm not sure the coefficient is uniquely defined. (The
> contraction of the answer with g[-a,-b] is the solution to Antonin's
> question.) We need additional conditions on the decomposition (like
> separation in pure trace and traceless parts) to make it unique.
Yes, this problem is difficult even to define.
Unfortunately there are problems with the current code also without
contractions in the second argument.
There are problems already if there are contractions in the first argument.
Consider the following: You want to find the X[-i] term of X[-j] or
g[-j,-l] X[l]
Then
IndexCoefficient[X[-j],X[-i]]*X[-i]
,
IndexCoefficient[X[-j],X[-j]]*X[-j]
and
IndexCoefficient[g[-j,-l] X[l],X[-i]]*X[-i]
all works fine.
However
IndexCoefficient[g[-j,-l] X[l],X[-j]]*X[-j]
does not work as expected.

Hence, one actually can get a problem if the free indices of the first
and second argument are the same.
I don't know if this problem is as difficult to resolve as the one with
contractions in the second argument.

Regards
Thomas

> Cheers,
> Jose.
>
> On May 21, 11:53 am, Thomas B�ckdahl<thomas.backd...@gmail.com>
Reply all
Reply to author
Forward
0 new messages