MathGroup Archive 2007

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

Search the Archive

Derivative of function with indexed variables


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?


  • Prev by Date: Re: Possible bug in HamiltonianCycle
  • Next by Date: Re: Convert nxn matrix to a column vector with (n^2) elements
  • Previous by thread: Style Sheets - Palette - SubScript Entry
  • Next by thread: Re: Mathematica 6 and system of matrix and scalar ODEs in NDSolve: