Re: Differentiating sums
- To: mathgroup at smc.vnet.net
- Subject: [mg63814] Re: [mg63770] Differentiating sums
- From: Pratik Desai <pdesai1 at umbc.edu>
- Date: Sun, 15 Jan 2006 05:43:27 -0500 (EST)
- References: <200601140732.CAA00260@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Zvi Tarem wrote: >How can I use Mathematica to represent sums in a way that can be >differentiated correctly? Here is a trivial example: > >If x and y are both vectors of length N then the derivative of the product >of the vectors with respect to any element x[i] is simply y[i]. I cannot >make Mathematica 'understand' the concept of indexing. Here is what I tried: > >prod = Sum[x[i] y[i], {i, N}] >D[prod, x[j]] >I get 0 > >D[prod, x[i]] >I get Sum[y[i],{i,N}] which is wrong. > > I don't think that is wrong. I am no mathematician, but I have used Fourier Series /ad nauseam /and this is what is called as Term by Term Differentiation. I am not quite sure mathematica understands what you mean when you say you want to differentiate with respect to x[i]?, I think mathematica thinks that this applies to all x[i]'s. If you want to differentiate with particular x[i]'s then, I think, you must give a finite N. Maybe something like this In[90]:= Clear[x,y,prod] prod[N_,j_,var_]:= D[Sum[Subscript[x,i]*Subscript[y,i], {i, N}],Subscript[var,j]] prod[10,2,y] Out[92]= \!\(x\_2\) Hope this helps Pratik >The same for subscript notation. > >Then I tried Array[] and Part[], but they require constants as the limit and >selectors. > >Can anyone help? > > > >
- References:
- Differentiating sums
- From: "Zvi Tarem" <zvi.tarem@cern.ch>
- Differentiating sums