Re: Derivative of InterpolatingFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg59840] Re: Derivative of InterpolatingFunction
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Tue, 23 Aug 2005 05:17:05 -0400 (EDT)
- Organization: The University of Western Australia
- References: <de46fi$r4f$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <de46fi$r4f$1 at smc.vnet.net>, pdickof at scf.sk.ca wrote:
> 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}}];
approx is a pure function (it does not depend explicitly on x or y).
> approxGradient = D[approx[x, y], {{x, y}, 1}]
approxGradient is not. You can use Derivative to compute the partial
derivatives without explicitly including x or y:
dx = Derivative[1,0][approx];
dy = Derivative[0,1][approx];
dxy = Derivative[1,1][approx];
and then evaluate these pure functions for particular x and y:
dx[2,1]
This value should be compared with direct computation of the function:
f[x_, y_] = x^2 Sin[y];
Derivative[1,0][f][2,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?
Yes.
Cheers,
Paul
_______________________________________________________________________
Paul Abbott Phone: 61 8 6488 2734
School of Physics, M013 Fax: +61 8 6488 1014
The University of Western Australia (CRICOS Provider No 00126G)
AUSTRALIA http://physics.uwa.edu.au/~paul