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: [mg66516] Re: Reconstructing data points from a InterpolatingFunction object
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 17 May 2006 03:30:41 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <e4bits$1a9$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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
> 
> 
Hi Eckhard,

Although you can always manipulate the result of NDSolve as any 
expression (see In[1]), using the functions located in the package 
"InterpolatingFunctionAnatomy" (see In[3] and In[4])should be easier and 
better since they are version independent:

"[...] occasionally it is useful to access the data inside [of the 
interpolating function], which includes the actual values and points 
NDSolve computed when taking steps.

The exact structure of an InterpolatingFunction object is arranged to 
make the data storage efficient and evaluation at a given point fast.

This structure may change between Mathematica versions, so code which is 
written in terms of accessing parts of InterpolatingFunction objects may 
not work with new versions of Mathematica.

The DifferentialEquations`InterpolatingFunctionAnatomy` package provides 
an interface to the data in an InterpolatingFunction object which will 
be maintained for future Mathematica versions [1]."

In[1]:=
sol = NDSolve[{Derivative[1][y][x] == y[x],
     y[1] == 2}, y, {x, 0, 3}]
FullForm[sol[[1,1,2]]]

In[3]:=
Needs[
   "DifferentialEquations`InterpolatingFunctionAnatomy`"]

In[4]:=
Names[
   "DifferentialEquations`InterpolatingFunctionAnatomy`*"]

Out[4]=
{InterpolatingFunctionCoordinates,InterpolatingFunctionDerivativeOrder,\
InterpolatingFunctionDomain,InterpolatingFunctionGrid,\
InterpolatingFunctionInterpolationOrder,InterpolatingFunctionValuesOnGrid}

Best regards,
Jean-Marc

[1] 
http://documents.wolfram.com/mathematica/Built-inFunctions/AdvancedDocumentation/DifferentialEquations/NDSolve/DifferentialEquationsUtilityPackages/InterpolatingFunctionAnatomy.html


  • Prev by Date: Re: ContourListPlot
  • Next by Date: RE: Re: Re: level curve selection
  • Previous by thread: Re: Reconstructing data points from a InterpolatingFunction object
  • Next by thread: Re: Reconstructing data points from a InterpolatingFunction object