MathGroup Archive 2007

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

Search the Archive

Re: using Save/Get with a function definition


congruentialuminaire at yahoo.com wrote:
> Hello Mathematica UG:
> 
> I am trying to use" Get" with a function definition. I can guess I am
> not saving it properly. Any help is greatly appreciated. Here is my
> test:
> 
> Expand[(x+y)^3] >> tmp1
> 
> f[x_] := Sin[x]
> 
> % >> tmp1
> 
> (exit Mathematica)
> 
> (bring up Mathematica)
> 
> << tmp0
> 
> (shows expanded poly)
> 
> << tmp1
> 
> (no output)
> 
> ?f
> 
> Information::notfound: Symbol f not found. >>
> 

"%" is the result of the last evaluation (Out[...]), not the last input 
expression (In[...]).  f[x_] := Sin[x] evaluates to Null, so only Null 
is written to the file.

If you'd like to use the notebook interface to maintain some function 
definitions in a text file, make the relevant cells initialisation cells 
(Cell -> Cell Properties ->), and save the notebook.  Mathematica will 
ask you whether you'd like to create an auto-save package from the 
initialisation cells.  Choose "Yes".

You may also be interested in the Save[] function.

-- 
Szabolcs


  • Prev by Date: Re: Other bug in ContourPlot
  • Next by Date: Re: using Save/Get with a function definition
  • Previous by thread: using Save/Get with a function definition
  • Next by thread: Re: using Save/Get with a function definition