Re: Derivative of function with indexed variables
- To: mathgroup at smc.vnet.net
- Subject: [mg83988] Re: Derivative of function with indexed variables
- From: Laurens van der Maaten <l.vandermaaten at micc.unimaas.nl>
- Date: Thu, 6 Dec 2007 02:44:18 -0500 (EST)
Here is the same in proper Mathematica-style: num = Exp[- (y[i] - y[j])^2] den = Sum[Sum[Exp[-(y[k] - y[h])^2], {h, k + 1, n}], {k, 1, n}] expr = Sum[p[i, j]Log[p[i, j]/(num / den)], {j, 1, n}] D[expr, y[i]] The resulting derivative is incorrect, because Mathematica does not seem to notice that y[k] and y[h] are sometimes equal to y[i] (over which we compute the derivative). Any ideas?