Derivative of function with indexed variables
- To: mathgroup at smc.vnet.net
- Subject: [mg83719] Derivative of function with indexed variables
- From: Laurens van der Maaten <l.vandermaaten at micc.unimaas.nl>
- Date: Thu, 29 Nov 2007 06:18:04 -0500 (EST)
I am trying to compute the following derivative in Mathematica (I wrote it down in Latex-notation): num = Exp[-(y_{i} - y_{j})^{2}] den = \sum_{k=1}^{n} \sum{h=k+1}^{n} Exp[-(y_{k} - y_{h})^{2}] expr = \sum_{j=1}^{n} p_{i,j} Log[p_{i,j} / (num / den)] D[expr, y_{i}] However, the resulting derivative Mathematica comes up with is incorrect (I checked that by numerical comparison), because it does not seem to understand that y_{k} and y_{h} will be in some cases equal to y_{i}. How can I resolve this problem?