# [SciPy-User] Interpolation of function on a line vs 2D interpolation

igor Halperin ighalp@gmail....
Thu Apr 8 11:21:48 CDT 2010

```Hi,

I am a bit stuck with the following interpolation problem. I have to compute
a function
z = f(x,y) whose arguments are realizations of components of a
two-dimensional random  variable (X,Y), obtained by Monte Carlo. As each
Monte Carlo simulation gives me a pair (x(t), y(t)) where t = 0,...,N-1
enumerates Monte Carlo runs, I can equivalently say that my function f is
defined on a discretized line t = 0,..., N-1 in a 2D space. Now, as
calculation of function f is costly but the function itself is smooth, I
want to calculate it on a sparse subset of simulated 2D points (x(t),y(t)),
and then interpolate for the rest of points.  (my sparse set includes
scenarios providing extreme values of x,y to avoid the need to
extrapolate).

Though this problem could be viewed as a 2D interpolation and solved using
function interpolate.bisplrep, in practice I run out of memory with this
method as the number N of 2D points is about 100,000, and I get memory error
when trying to produce matrices of dimension 100,000x100,000 needed for
interpolate.bisplrep using function meshgrid. However, in view of what is
said above,
the problem can alternatively be viewed as interpolation of a function
defined on a line. I was unable to figure out how/whether I could use
function interpolate.splprep to this end.

Any help on this would be greatly appreciated.

Igor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100408/c24be9ba/attachment.html
```