MathGroup Archive 2007

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

Search the Archive

Re: Saving Interpolated Function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81019] Re: Saving Interpolated Function
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 8 Sep 2007 03:49:34 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fbqpja$696$1@smc.vnet.net>

lederer at ssb.rochester.edu wrote:

> I am doing some numerical analysis leading to an interpolated function
> that I will need later.
> 
> These calculations take many minutes, and I want to beable to save the
> interpolated function--so it does not have to be regenerated every
> time I come back to the problem.
> 
> How can I do this.?

The function *DumpSave* should be what you are looking for. Here is an 
example: we save the interpolating function in the default user 
directory, then, in a new session, we load its definition with *Get* (or 
<<).

In[1]:= f =
  First[u /. NDSolve[{u''[t] + u[t] == 0, u[0] == 0, u'[0] == 1},
     u, {t, 0, \[Pi]}]]

Out[1]= InterpolatingFunction[]

In[2]:= DumpSave["f.mx", f]

Out[2]=  InterpolatingFunction[]

In[3]:= Quit[]

(* Later, in a fresh session *)

In[1]:= << f.mx

In[2]:= Plot[{f[t], f'[t]}, {t, 0, \[Pi]}]

[... graphic deleted ...]

Regards,
-- 
Jean-Marc


  • Prev by Date: Re: Saving Interpolated Function
  • Next by Date: Re: Plotting a straight line in a 3D plot
  • Previous by thread: Re: Saving Interpolated Function
  • Next by thread: Re: Saving Interpolated Function