Re: Derivative of Sum
- To: mathgroup at smc.vnet.net
- Subject: [mg48006] Re: Derivative of Sum
- From: "Carl K. Woll" <carlw at u.washington.edu>
- Date: Wed, 5 May 2004 08:11:11 -0400 (EDT)
- Organization: University of Washington
- References: <c6o4gn$cju$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Michal,
Here is one possibility:
Unprotect[D];
D[Subscript[i_,j_],Subscript[i_,k_],NonConstants->{Subscript}]:=
DiscreteDelta[j-k]
D[Subscript[i_,j_],Subscript[k_,l_],NonConstants->{Subscript}]:=0
D[HoldPattern[Sum[a_,b_]],c__]:=Sum[D[a,c],b]
Protect[D];
Then, we have
In[8]:=
D[Sum[Subscript[a,k]Subscript[b,k],{k,n}],Subscript[a,i],NonConstants->{Subs
cript}]
Out[8]=
b UnitStep[-1 + i] UnitStep[-i + n]
i
I used Subscript[a,k] to make things legible in this post, but you could of
course use real subscripts and things will work. The only problem is that
Mathematica doesn't know that i is between 1 and n, so the UnitSteps pop up.
You could put in some assumptions, or you could simply extend the range of
the sum, as in
In[9]:=
D[Sum[Subscript[a,k]Subscript[b,k],{k,-Infinity,Infinity}],Subscript[a,i],No
nConstants->{Subscript}]
Out[9]=
b
i
to get rid of the UnitSteps.
Carl Woll
"Michal Kvasnicka" <michal.kvasnicka at _NO_ZpaMM-.quick.cz> wrote in message
news:c6o4gn$cju$1 at smc.vnet.net...
> Is Mathematica 5 able to compute the folowing problem:
> \!\(S = Sum[\(a\_k\) b\_k, {k, 1, n}]\)
>
> then should be
>
> \!\(\[PartialD]\_\(a\_i\)\ S = b\_i\) but the Mathematica gives 0.
>
> Thanks, Michal
>
>