Problem with using /.

*To*: mathgroup at smc.vnet.net*Subject*: [mg69207] Problem with using /.*From*: "Nag" <Naga1010 at gmail.com>*Date*: Fri, 1 Sep 2006 18:41:09 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Hello: I am trying to compute the moments of a distribution using the moment generating function, MGF[t,k]. Here is the relevant function for computing the j'th moment. M[j_, t_, k_] := D[MGF[t, k], {t, j}] /. {u -> 0, Sum[Subscript[p, i],{i, 0, k}] = 1}; After taking the j'th derivative, need to set u to 0 and the sum of p(i)'s to 1. When I execute M[3, u, 5], get the following error.(converted output to input form) \!\(\* StyleBox[ ErrorBox[\(Set:: "\<write\>" : "\<Tag \!\(Sum\) in \!\(\(â??\+\(i = 0\)\%5\) p\_i\) is Protected. \!\(\*ButtonBox[\"Moreâ?¦\", ButtonStyle->\"RefGuideLinkText\ \", ButtonFrame->None, ButtonData:>\"General::write\"]\)\>"\)], ShowStringCharacters->True]\) Of course I can explicitly set p0+p1+..+p5 = 1 after executing M[3,u,5] but involves more effort as k increases. Is it possible to make the substitution work for general k in the function definition M[....]? Best Nag