MathGroup Archive 2007

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

Search the Archive

Re: taking partial derivatives with respect to vector elements: need


Hi,

a)
y = Table[x[i], {i, 1, 8}]
D[Plus @@ y, x[3]]

should work,
b) avoid the symbol N because Mathematica use a function N[]
    to convert a symbolic value into a floating point number
c) Mathematica can't know that in D[Sum[x[i],{i,nn}],x[j]]
    j is an integer, and that it can have a value in the range
    Element[j,{1,2,..,nn}] and you have to add the rule to build
    the derivative by yourself.

Regards
   Jens

kai_spam at web.de wrote:
> Hi, I'd appreciate any help on the following simply(?) syntax problem:
> 
> I would like to take a partial derivative with respect to a variable
> which is indexed within a sum.
> Among other things I'm trying the following:
> 
> Sum[x[[i]], {i, N}]
> 
> which works when I specify x={1,2,3} and N=3, but I want to keep x and
> N unspecified. In which case it produces the message:
> 
> Part:::pspec : Part specification i is neither an integer nor a list of
> integers.
> 
> I am aiming for something similar to the following:
> 
> D[Sum[x[[i]],{i,N}],x[2]] or even D[Sum[x[[i]],{i,N}],x[j]]
> 
> I realize this is quite a rookie-question but I couldn't figure it out
> with the mathematica help + book.
> Thanks in advance, Kai
> 


  • Prev by Date: Re: FourierTransform help
  • Next by Date: RE: Re: how to quickly read a >10MB big file
  • Previous by thread: Re: 2D interpolation
  • Next by thread: Is it possible?