vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
982 stars 118 forks source link

Kronecker Delta with more than two indices contracted #356

Open extradimension opened 3 years ago

extradimension commented 3 years ago

The built-in Kronecker delta d_ does not work well when the indices are contracted more than in pairs. I'm finding that I have to deal with such a situation (due to the presence of diagonal masses or couplings). I was wondering if someone has worked out a standard way around this. Incidentally the indices sometimes appear inside function arguments, which of course complicates things. A minimal example (real life are much more complicated) is:

Index i,j; CF ma,f;

Local exp1=d(i,j)*d(i,j)ma(i)+d_(i,j)d(i,j)*f(ma(i))+d(i,j)*d_(i,j);

which returns

exp1 = 4 + 4ma(i) + 4f(ma(i));

Instead of what I would expect:

exp1=4+ma(i)+f(ma(i));

I have put the direct contraction, which is of course worked out correctly by form because it sometimes appears (and a simple id(i?,j?)=replace_(i,j) would miss). Note that in my expected result i is an internal index and therefore summed over, even if it is not repeated. This might not be obvious.

I have looked to see if a similar question has been asked in he past but I wasn't able to find it here (or elsewhere).

vermaseren commented 3 years ago

Hi,

As you see, what you consider natural is not what Form considers natural. When you have 3 contractible indices things can become dubious and you depend on how Form does things internally, which is not specified. In this case Form first does the contractions between the d_ functions, but it is not garanteed that this will forever be the case.

The way to get around this is to force Form to do it your way by using

Local exp1=d(k,j)*d(i,j)ma(i)+d_(k,j)d(i,j)*f(ma(i))+d(k,j)*d_(i,j);

and then, once Form gets that sorted out you can add the statement Multiply replace_(k,i); This will give you what you want.

Jos

On 10 Jul 2020, at 10:12, extradimension notifications@github.com wrote:

The built-in Kronecker delta d_ does not work well when the indices are contracted more than in pairs. I'm finding that I have to deal with such a situation (due to the presence of diagonal masses or couplings). I was wondering if someone has worked out a standard way around this. Incidentally the indices sometimes appear inside function arguments, which of course complicates things. A minimal example (real life are much more complicated) is:

Index i,j; CF ma,f;

Local exp1=d(i,j)*d(i,j)ma(i)+d_(i,j)d(i,j)*f(ma(i))+d(i,j)*d_(i,j);

which returns

exp1 = 4 + 4ma(i) + 4f(ma(i));

Instead of what I would expect:

exp1=4+ma(i)+f(ma(i));

I have put the direct contraction, which is of course worked out correctly by form because it sometimes appears (and a simple id(i?,j?)=replace_(i,j) would miss). Note that in my expected result i is an internal index and therefore summed over, even if it is not repeated. This might not be obvious.

I have looked to see if a similar question has been asked in he past but I wasn't able to find it here (or elsewhere).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/356, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCERLN37DVEHHVC72KTTR23EOJANCNFSM4OWLLADA.

extradimension commented 3 years ago

Dear Jos, thanks so much for your answer. The problem is that I need to automate the code and it's not always easy to know which index to double. I have found a temporary fix (more below in case you are interested) but I'll eventually need to generalize it so here is a related question.

Is there a way of counting the number of times an index appears in an expression, independently of the level of depth it appears? If not, is it possible if the maximum depth is known? For instance f(g(i)) but no deeper, where f and g are functions and i is the index. To make things complicated the functions might appear as inverse to some power or as squared inside other functions.

The way I solved my problem was by using the fact that the indices that can appear more than two times are always internal indices to be summed over, so I implemented for those my own version of the Kronecker delta, which works because there will never be left-over delta functions in these indices.

Cheers,

 José Santiago

PS: Sorry if asking another (related) question is not proper forum rules. Please let me know if I should ask it separately and feel free to close this as solved if you want.

vermaseren commented 3 years ago

Hi José

Your solution looks fine to me. There is no function like occurs_ that would give the number of occurrences in a term. Also the "if ( occurs(…) )” stops after the first occurrence and hence cannot be used. Your solution is the general way to circumvent undesired behaviour of built in objects. Similar when you need to emulate gamma5 in D dimensions. You need your own gamma function.

You asked in the right place. The issues are not only for bugs, but also for people to help each other.

Cheers

Jos

On 20 Jul 2020, at 11:10, extradimension notifications@github.com wrote:

Dear Jos, thanks so much for your answer. The problem is that I need to automate the code and it's not always easy to know which index to double. I have found a temporary fix (more below in case you are interested) but I'll eventually need to generalize it so here is a related question.

Is there a way of counting the number of times an index appears in an expression, independently of the level of depth it appears? If not, is it possible if the maximum depth is known? For instance f(g(i)) but no deeper, where f and g are functions and i is the index. To make things complicated the functions might appear as inverse to some power or as squared inside other functions.

The way I solved my problem was by using the fact that the indices that can appear more than two times are always internal indices to be summed over, so I implemented for those my own version of the Kronecker delta, which works because there will never be left-over delta functions in these indices.

Cheers,

José Santiago PS: Sorry if asking another (related) question is not proper forum rules. Please let me know if I should ask it separately and feel free to close this as solved if you want.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/356#issuecomment-660905244, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCEXCSMT2EF7HY4E3GHDR4QCYVANCNFSM4OWLLADA.