MathGroup Archive 2007

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

Search the Archive

Re: Symbolic Integration of Sums

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79182] Re: Symbolic Integration of Sums
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Fri, 20 Jul 2007 03:31:29 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f7n4pv$286$1@smc.vnet.net>

Peter wrote:
> I am having trouble figuring out how to Mathematica to recognize sums when I
> take derivates.
> 
> Here is a very simple example, define
> 
> portM = Sum[w[i] m[i], {i, 1, n}]
> 
> Then, if I try to take the derivative of portM wrt say w[1] I get 0
> instead of m[1].
> 
> D[portM, w[1]] --> returns 0
> 
> If I spell the sum out explicitly using say for n=10:
> 
> portM = Sum[w[i] m[i], {i, 1, 10}]
> 
> I get the correct answer but this is often messy with the real
> problems I am working with and it also removes the ability to work
> with the length of sum in the other parts of the analysis I am doing.
> 
> Is using Sum in this way simply a level of abstraction more than Mathematica
> can do or am I asking it the wrong question?
> 
> Many thanks.

Adapted from the thread, "partial derivative of a sum",
http://forums.wolfram.com/mathgroup/archive/2005/Aug/msg00572.html

In[1]:= sumD[j_Integer, n_Integer] := If[j > n, 0,
      D[Sum[w[i]*m[i], {i, 1, n}], w[j]]]
sumD[j_Integer, Infinity] := m[j]
sumD[1, 10]

Out[3]= m[1]

The function above might or might not suit your needs, but it is a good 
started. Also, the thread titled "Derivative of Sum" might be of 
interest. See
http://forums.wolfram.com/mathgroup/archive/2004/May/msg00055.html

Regards,
Jean-Marc


  • Prev by Date: Re: generating non-IID random sequences
  • Next by Date: Re: Embedded Style Sheets
  • Previous by thread: Re: Symbolic Integration of Sums
  • Next by thread: Re: Symbolic Integration of Sums