Re: Derivative of InterpolatingFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg59753] Re: Derivative of InterpolatingFunction
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Sat, 20 Aug 2005 03:13:41 -0400 (EDT)
- Organization: Uni Leipzig
- References: <de46fi$r4f$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, whats wrong with data = Table[x^2 Sin[ y], {x, -2., 2.}, {y, -2., 2.}]; approx = ListInterpolation[data, {{-2, 2}, {-2, 2}}]; approxGradient = D[approx[x, y], {{x, y}, 1}]; In[]:=approxGradient /. {x -> 0.4, y -> 0.8} Out[]={0.568249, 0.115655} In[]:=D[x^2 Sin[ y], {{x, y}, 1}] /. {x -> 0.4, y -> 0.8} Out[]={0.573885, 0.111473} Regards Jens <pdickof at scf.sk.ca> schrieb im Newsbeitrag news:de46fi$r4f$1 at smc.vnet.net... |I wish to compute gradients of three-dimensional interpolating | functions. The browser entry for InterpolatingFunction claims taking | derivatives is possible and does not mention limitations in the | dimensionality. My naive attempts based on the example for gradients in | the browser entry for D have failed even for two dimensions: | | data = Table[x^2 Sin[ y], {x, -2., 2.}, {y, -2., 2.}]; | approx = ListInterpolation[data, {{-2, 2}, {-2, 2}}]; | approxGradient = D[approx[x, y], {{x, y}, 1}] | approxGradient[1, 1] | | Searching this newsgroup, the closest thing I have found is the 1996 | post by Paul Abbot (extract below). Have "enhancements for higher | dimensions" been incorporated? | | Peter Dickof | +-------------------------- | In The Mathematica Journal 4(2):31 the following appears: | | Partial Derivatives | | | Presently, Mathematica cannot handle partial derivatives of | InterpolatingFunctions. The package DInterpolatingFunction.m, provided | by Hon Wah Tam (t... at wri.com) and included in the electronic | supplement, computes partial derivatives of two-dimensional | InterpolatingFunctions. Enhancements for higher dimensions will | eventually be incorporated into Mathematica. | +---------------------------------- |