MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Derivative of Sum


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
>
>



  • Prev by Date: color in SphericalPlot3D
  • Next by Date: Re: Remove["Global`"] ??
  • Previous by thread: Re: Re: Derivative of Sum
  • Next by thread: Kernel init.m File