vermaseren / form

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

FORM's reaction to ,, (double commas) #368

Closed vsht closed 3 years ago

vsht commented 3 years ago

Consider the following example where we have a ,, on the rhs of an id statement:

off statistics;
CF g,f;

L exp = g(1,2) + g(2,3);

id g(1,2) = f(1,,2);

print;

.end

Apparently FORM interprets ,, as ,0, since I obtain

  exp =
      g(2,3) + f(1,0,2);

I checked the manual, but could not find any references to ,,. The closest thing would be the triple dot operator. However, having

id g(2,3) = f(1,...,2);

produces

  exp =
      g(2,3) + f(1,2);

as expected.

So I'm a bit confused whether the observed behavior is expected or not.

PS ,, initially appeared in my code due to a typo.

Cheers, Vladyslav

vermaseren commented 3 years ago

In Form an empty argument is an argument without terms. An expression without terms is considered the same as an expression that is zero. Zero is “no terms”. For mathematicians that can be confusing. It makes for rather efficient internal coding. Take for instance a+b -a-b Technically that gives “no terms”. I am sure you would like to get zero.

When you have a function as you have with f(1,,2) the second argument is empty and hence interpreted as zero.

I hope you can understand that not all these types of special effects are in the manual.

Sorry that it confused you.

Jos

On 29 Oct 2020, at 20:59, Vladyslav Shtabovenko notifications@github.com wrote:

Consider the following example where we have a ,, on the rhs of an id statement:

off statistics; CF g,f;

L exp = g(1,2) + g(2,3);

id g(1,2) = f(1,,2);

print;

.end Apparently FORM interprets ,, as ,0, since I obtain

exp = g(2,3) + f(1,0,2); I checked the manual, but could not find any references to ,,. The closest thing would be the triple dot operator. However, having

id g(2,3) = f(1,...,2); produces

exp = g(2,3) + f(1,2); as expected.

So I'm a bit confused whether the observed behavior is expected or not.

PS ,, initially appeared in my code due to a typo.

Cheers, Vladyslav

— 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/368, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCEWW5KT64QXTVQAMGG3SNHCRLANCNFSM4TEF6YJQ.

vsht commented 3 years ago

I see, many thanks for the clarification.

Cheers, Vladyslav