Differentiating w.r.t. A Subscript



The case below could be handled by the transformations sum(a+b,...) =>
sum(a, ...) + sum(b,...) (which is valid only if the summation limit is
finite) and then

    sum( kron_delta(a*i+b,j)* <...>, i, a, b) => if j>=a and j<=b then
subst((j-b)/a,i,<...>) else 0

In the case below, this would result in

    (if j>=1 and j<=n then x[n-j+1]) + (if j>=1 and j<=n then x[n-j+1])

which Maxima can simplify to

    2*(if j >= 1 and j <= n then x[n-j+1])

I'd think that such a method could be added to simpsum, but I haven't looked
at its internals.

Other useful simplifications for kron_delta include:

     kron_delta(i,j)*kron_delta(i,k) =>
kron_delta(i,j)*kron_delta(i,k)*kron_delta(j,k)

Strangely enough, making it bigger like this really is a simplification in
that explicitly including the j,k case enables
kron_delta(i,1)*kron_delta(i,2) => 0



On Wed, Jun 8, 2011 at 09:14, Stavros Macrakis <macrakis at alum.mit.edu>wrote:

> It is straightforward to have diff(x[i],x[j]) give kron_delta(i,j).  The
> problem, though, is that you get messy expressions which Maxima doesn't know
> how to simplify usefully.
>
> For example, diff( sum( x[i]*x[n-i+1], i, 1, n) , x[j] ) would result in
>
>         'sum(kron_delta(i,j)*x[n-i+1]+x[i]*kron_delta(n-i+1,j),i,1,n)
>
> The hard part is getting that to simplify to
>
>        if n>=j then 2*x[n-j+1] else 0
>
> As far as I know, no one has implemented such simplifications. It would
> certainly be a useful area to work on; an important special case of the more
> general problem of simplifying expressions involving conditionals.
>
>            -s
>
> On Tue, Jun 7, 2011 at 10:44, David Simcha <dsimcha at gmail.com> wrote:
>
>> Let's say I want to differentiate a sum w.r.t. one of its terms.  Below is
>> a trivial case, though my real case is more complex.
>>
>> (%i1) expr : sum(x[i], i, 1, N);
>>                                     N
>>                                    ====
>>                                    \
>> (%o1)                               >    x
>>                                    /      i
>>                                    ====
>>                                    i = 1
>> (%i2) diff(expr, x[1]);
>> (%o2)                                  0
>> (%i3)
>>
>> Of course the answer I'm looking for is 1.  I want Maxima to treat the
>> summation as if I had written out, for some fixed N:
>>
>> expr : x[1] + x[2] + x[3] + ... + x[N];
>>
>> How do I get Maxima to behave more intelligently w.r.t. subscripts?
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>>
>