Inverse Interpolating Functions
- To: mathgroup at smc.vnet.net
- Subject: [mg29221] Inverse Interpolating Functions
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 5 Jun 2001 04:21:51 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Dear MathGroup, Sometimes we may have an InterpolatingFunction, which is strictly increasing over its domain. A typical case might be the arc length of a curve. Suppose we want to calculate an inverse interpolating function. What is the best way to do this? When I looked at the structure on an InterpolatingFunction I found that it contains a list of x points and a list of y points. So I naively thought I might be able to construct the inverse interpolating function by interchanging the x and y lists, and taking the limits of the new function from the end points of the original y list. Here is a routine to do that. I check that the original y list is strictly increasing. InverseInterpolatingFunction[(f_InterpolatingFunction)? (And @@ Positive /@ ListConvolve[{1, -1}, #1[[4,2]]] & )] := InterpolatingFunction[{{First[f[[4,2]]], Last[f[[4,2]]]}}, f[[2]], {f[[4,2]]}, {f[[4,1]], f[[3,1]]}] Here are several test cases. I plot the error in the inverse interpolation and the error in the original interpolation. f = FunctionInterpolation[Sin[x], {x, -(Pi/2), Pi/2}] g = InverseInterpolatingFunction[f] Plot[g[x] - ArcSin[x], {x, -1, 1}]; Plot[f[x] - Sin[x], {x, -(Pi/2), Pi/2}]; f = FunctionInterpolation[Sin[x], {x, -Pi/2, Pi/2}, InterpolationPoints -> 401, PrecisionGoal -> Automatic, InterpolationPrecision -> Automatic, InterpolationOrder ->7] g = InverseInterpolatingFunction[f] Plot[g[x] - ArcSin[x], {x, -1, 1}]; Plot[f[x] - Sin[x], {x, -Pi/2, Pi/2}]; f = FunctionInterpolation[Sinh[x], {x, -3, 3}] g = InverseInterpolatingFunction[f] Plot[g[x] - ArcSinh[x], {x, -10, 10}]; Plot[f[x] - Sinh[x], {x, -3, 3}]; The results seem to be fairly good. But is this just a fluke? Is there a simple and mathematically sound basis to generate an inverse interpolating function from a strictly increasing interpolating function? David Park djmp at earthlink.net http://home.earthlink.net/~djmp/