Re: using Save/Get with a function definition
- To: mathgroup at smc.vnet.net
- Subject: [mg81738] Re: using Save/Get with a function definition
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Tue, 2 Oct 2007 05:46:28 -0400 (EDT)
- References: <fdqd17$n5p$1@smc.vnet.net>
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