Re: Derivative of InterpolatingFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg59754] Re: Derivative of InterpolatingFunction
- From: Peter Pein <petsie at dordos.net>
- Date: Sat, 20 Aug 2005 03:13:42 -0400 (EDT)
- References: <de46fi$r4f$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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}}];
> 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.
> +----------------------------------
>
Hi Peter,
your _list_ approxGradient contains two _calls_ to functions.
1.) it doesn't make sense to try a function call {<something>}[1,1].
2.) trying to apply an already applied function f[x][1] is meaningful,
iff f[x] _returns_ a function.
you propably want approxGradient/.{x->1,y->1}
Peter
--
Peter Pein
Berlin