Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

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?


  • Prev by Date: ListPLot for 2 List
  • Next by Date: Real to String
  • Previous by thread: Re: ListPLot for 2 List
  • Next by thread: Re: Re: Derivative of function with indexed variables