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

MathGroup Archive 2008

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

Search the Archive

Re: Mixed Numerical Derivatives

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87176] Re: Mixed Numerical Derivatives
  • From: Andrew Moylan <andrew.j.moylan at gmail.com>
  • Date: Thu, 3 Apr 2008 05:15:25 -0500 (EST)
  • References: <fsveco$sp7$1@smc.vnet.net>

On Apr 2, 6:59 pm, "jwmerr... at gmail.com" <jwmerr... at gmail.com> wrote:
> How can I come up with the Hessian of a function, at a particular
> point, which can only be evaluated numerically?  If I had a symbolic
> function, I could do something like
>
> In[123]:=
> D[x^3 + z*y^-1 + z^(1/2), {{x, y, z}, 2}] /. {x -> 3, y -> 5,
>   z -> 12}
>
> Out[123]= {{18, 0, 0}, {0, 24/
>   125, -1/25}, {0, -1/25, -1/(96 Sqrt[3])}}
>
> The function I'm interested in, though, can only be calculated
> numerically.  Using ND, I can find the diagonal elements of the
> Hessian:
>
> In[92]:= rules = Last[
>   FindMaximum[{Total[logPr[vdt, ddt, var, #] & /@ testData], ddt > 0,
>     var > 0}, {{vdt, .9}, {ddt, 120}, {var, 90}}]]
>
> Out[92]= {vdt -> 0.95945, ddt -> 151.097, var -> 103.255}
>
> In[111]:= Needs["NumericalCalculus`"]
>
> In[124]:= ND[
>  Total[logPr[vdtp, ddt, var, #] & /@ testData] /. rules, {vdtp, 2},
>  Evaluate[vdt /. rules]]
>
> Out[124]= -64.4011
>
> But what about the off diagonal elements?

If you'll need to evaluate the derivatives of the function many times,
try setting up a FunctionInterpolation. You can use D on that.


  • Prev by Date: Re: setting elements of an array based on a condition
  • Next by Date: Re: How to put text on a curved surface?
  • Previous by thread: Re: Mixed Numerical Derivatives
  • Next by thread: Re: setting elements of an array based on a condition