MathGroup Archive 2007

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

Search the Archive

Functions with data hidden in them

  • To: mathgroup at
  • Subject: [mg81831] Functions with data hidden in them
  • From: Neil Stewart <neil.stewart at>
  • Date: Thu, 4 Oct 2007 04:29:26 -0400 (EDT)
  • Reply-to: Neil Stewart <neil.stewart at>

The Interpolation[] function somehow "hides" the data passed to it in the
InterpolationFunction object that it returns. In the example below, when
f[1] is evaluated it is using information from the list data, but does not
have the list data passed to it as parameter.

In[1]:= data = {{1, 1}, {2, 2}, {3, 3}}

In[2]:=  f = Interpolation[data]

In[3]:= f[1]
Out[3]= 1

How can I write my own function that stores data inside itself in the same
way that Interpolation does? I'm aiming to write a functions that takes a
number as a parameter and consults a large data set to return a number. I'm
not sure where to start - any ideas very welcome!


  • Prev by Date: RE: Bug ???
  • Next by Date: Re: Multiple nests?
  • Previous by thread: Re: Can Integrate[expr,{x,a,b}] give an incorrect result?
  • Next by thread: Re: Functions with data hidden in them