Differentiation of the summation?



Followup on my previous answer, replying to RJF's comments:

> Your expectation is, I think, wrong....
> do you expect
> diff(sum(y*x[k],k,0,n),x[i])  to also be y?

Yes, if 0<=i<=n.  But Maxima currently doesn't ask.  At least a noun
form is correct, if not terribly useful.

> how about the specifics
> diff (sum(y*x[k],k,0,5),x[12]) ?
>   shouldn't this be 0?

Yes.

> How about
> diff (sum(i^2,i,0,n),i) ?   the sum doesn't depend on i. it 
> depends on n.
> so the derivative is 0.

Maxima gets this one right; and also diff(...,n) => noun form.  A noun
form is reasonable here since the summation is implicitly declaring 'n'
to be an integer.  Though I suppose you could also "cheat" and treat the
result of the summation as a continuous function in n and get
(6*n^2+6*n+1)/6.

      -s