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

• To: mathgroup at smc.vnet.net
• Subject: [mg72904] Re: taking partial derivatives with respect to vector elements: need
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Wed, 24 Jan 2007 17:45:38 -0500 (EST)
• Organization: Uni Leipzig
• References: <ep4jmf\$p84\$1@smc.vnet.net>

```Hi,

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

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