operation with sum



On 12/12/05, laurent couraud  wrote:

> 1) Is it possible to transform:
>
> sum(x[i]+y[i],i,1,n) to sum(x[i],i,1,n) + sum(y[i],i,1,n)
>
> 2) In the following sequence:
>
> (%i1) x[i]+y[i]=0$
> (%o1) 0 = x[i] + y[i]
> (%i2) sum(rhs(%o1),i,1,n)
> (%o2)  sigma_symbol rhs(0 = x[i] + y[i])

2 things here; (1) by default, sum is not declared to be linear.
i don't remember why that is. (2) sum has recently been
revised to evaluate the summand. that will be in the
upcoming 5.9.3 release. in the meantime, apply quote-quote ''
to the summand, as mentioned by stavros.

so in 5.9.2 or before:

  declare (sum, linear);
  x[i] + y[i] = 0;
  sum (''(lhs(%)), i, 1, n);  => sum of x's + sum of y's

or in 5.9.3 or later:

  declare (sum, linear);
  x[i] + y[i] = 0;
  sum (lhs(%), i, 1, n);  => sum of x's + sum of y's

hope this helps,
robert dodier