vermaseren / form

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

Problem to realize sum function #346

Open zhaoli-IHEP opened 4 years ago

zhaoli-IHEP commented 4 years ago

How can we make this work?

#-
auto symbol x;
auto symbol n;
CFunction f, summation;

Local expr = summation(f(n1),n1);
.sort

id summation(x?,n1) = sum_(n1,0,10,x);
.sort
vermaseren commented 4 years ago

Hi,

The problem is that in the sum_ the n1 is a wildcard and hence has basically not an identity. You can take care of that with

id summation(x?,n1) = sum(n2,0,10,x*replace(n1,n2));

Now it first does the sum, gets the sum done with the values of n2 and after that inside x it will replace n1 by n2.

Cheers

Jos

On 28 May 2020, at 21:57, zhaoli-IHEP notifications@github.com wrote:

How can we make this work?

-

auto symbol x; auto symbol n; CFunction f, summation;

Local expr = summation(f(n1),n1); .sort

id summation(x?,n1) = sum_(n1,0,10,x); .sort — 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/346, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCEQDTLZF7RHNREMNIH3RT26Z3ANCNFSM4NNMFDPQ.

zhaoli-IHEP commented 4 years ago

Hi, The problem is that in the sum the n1 is a wildcard and hence has basically not an identity. You can take care of that with id summation(x?,n1) = sum(n2,0,10,x*replace_(n1,n2)); Now it first does the sum, gets the sum done with the values of n2 and after that inside x it will replace n1 by n2. Cheers Jos

Thank you so much!