MathGroup Archive 2006

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

Search the Archive

Re: Reconstructing data points from a InterpolatingFunction object

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66489] Re: [mg66483] Reconstructing data points from a InterpolatingFunction object
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Wed, 17 May 2006 03:29:15 -0400 (EDT)
  • References: <200605160349.XAA01097@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 16 May 2006, at 12:49, Eckhard Schlemm wrote:

> Hello everyone,
>
> My question is probably rather simple to answer but I just don't  
> know how to
> do it.
>
> I am nummerically solving a differential equation using NDSolve and  
> then I
> want to apply a NonlinearFit on the resulting InterpolatingFunction
> object....and therefore need to have access to the data points  
> which NDSolve
> created and from which the InterpolatingFunction is created....Is  
> there any
> fast and direct way to get these data points ? (There must be....)
>
> Thanks in advance
>
> Eckhard
>
>

Indeed, the data points can be got out from any  
InterpolatingFunction, but the most direct method to do so depends on  
which version of Mathematica you are using. You can see it on an  
example. I Mathematica 5.1:

ls = {{0, .1}, {1, .2}, {2, .3}, {3, .4}};
f = Interpolation[ls, InterpolationOrder -> 1];
f//InputForm
InterpolatingFunction[{{0., 3.}}, {2, 0, True, Real, {1},
   {0}}, {{0., 1., 2., 3.}}, {{0, 1, 2, 3, 4},
   {0.1, 0.2, 0.3, 0.4}}, {Automatic}]

Hence your data list is

f[[-2]]

{{0,1,2,3,4},{0.1,0.2,0.3,0.4}}

On the other hand in Mathematica 4.1 the same code returns

InterpolatingFunction[{{0., 3.}}, {1, 0, True, Real, {1},
   {0}}, {{0., 1., 2., 3.}}, {{0, 1, 2, 3, 4},
   {0.1, 0.2, 0.3, 0.4}}]

So you can get the data with f[[-1]].


Andrzej Kozlowski


  • Prev by Date: Re: Lists and rules
  • Next by Date: Re: Lists and rules
  • Previous by thread: Reconstructing data points from a InterpolatingFunction object
  • Next by thread: Re: Reconstructing data points from a InterpolatingFunction object