# [R] find max of implicit function OR inversion of 2D mappings.

Fri Jan 31 23:15:05 CET 2003

```Dear R-Users,

I am looking for a help to deal with the following computational problem:

I have a mapping f(x, y) -> (u, v) of [0,1]*[0,1] -> R^2. The mapping is
given by tabulating f(x,y) on a uniform 2D grid and is assumed to be
"interpolatable" in between the grid points (the number of points on each
dimension is rather small, say 5). My ultimate goal is to numerically
maximize v for any given u0, that is find x0(u0), y0(u0) such that v(x0, y0)
= max { v(x,y) : u(x,y)=u0}.

So my broad question is what tools does R have to help out? A narrower
question is whether there is a function that interpolates on a
two-dimensional, but irregular grid? If there is one I could interpolate
fInverse(u,v) -> (x,y) and then restrict u=u0 (does this make sense?).

Another related question deals with efficient tabulation of fInverse(u, v).
In my case it is rather expensive to calculate f(x,y) for any single point
(few hours of computer time). Is there any algorithm that selects next (x,y)
to compute f(x,y) on so that the resulting tabulation of fInverse will be
most efficient? It's probably to much to ask, but just in case.

Thanks,