MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: interpolating f(x,y) from evaluation

K. Nikolaj Berntsen wrote:

> I want to generate an interpolatingfunction-like object for a
> complicated function of several variables; Interpolation etc. does not
> seem to be able to; but I may have missed something in the
> documentation, anyone got an idea?
> I tried:
> Interpolation[Table[{f[i,j].i.j},{i,3},{j,3}]]

The argument to interpolation needs to be "flattened" and should be of
the form


(Note that you had {f[i,j].i.j} instead of {i,j,f[i,j]}).  For example,

 In[1]:= f[i_, j_] := i^2 + j^2
 In[2]:= Interpolation[Flatten[Table[{i,j,f[i,j]},{i,5},{j,5}],1]];
 In[3]:= Plot3D[%[x, y], {x, 1, 5}, {y, 1, 5}];

Alternatively you can use FunctionInterpolation:
 In[4]:= FunctionInterpolation[f[i, j], {i, 1, 5}, {j, 1, 5}];
 In[5]:= Plot3D[%[x, y], {x, 1, 5}, {y, 1, 5}];


Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia
Nedlands WA  6907                     mailto:paul at

            God IS a weakly left-handed dice player


  • Prev by Date: Re: Memory Leak in 3.0 for students?
  • Next by Date: Directed Graphs with Labels
  • Previous by thread: Re: interpolating f(x,y) from evaluation
  • Next by thread: More: tantamount error messages when interupting