Re: Begginer's question: Saving a function for later use

*To*: mathgroup at smc.vnet.net*Subject*: [mg128049] Re: Begginer's question: Saving a function for later use*From*: Murray Eisenberg <murray at math.umass.edu>*Date*: Tue, 11 Sep 2012 02:34:29 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-newout@smc.vnet.net*Delivered-to*: mathgroup-newsend@smc.vnet.net*References*: <20120910080540.BEE556843@smc.vnet.net>

Mathematica's memory of a definition lasts as long as, and only as long as, a given Mathematica session. You typed that definition into a notebook (with title probably Untitled-1, unless you already saved it with another name). As long as Mathematica is still open, even if you close a notebook where you made a definition such as your "test", that definition is still available at the same session -- until you quit Mathematica. When you start Mathematica again, you must open that notebook and evaluate the cell containing your definition. Or, if you put the definition into a .m package and save that, then you must load that package into Mathematica in order to recreate the definition. (There are methods to have such a package automatically loaded each time you start Mathematica, but that's getting into something more advanced.) On Sep 10, 2012, at 4:05 AM, pedro.roberto at campus.ul.pt wrote: > Hello, > I'm just getting started on Mathematica and trying to define a function for later use. The function is just: > > test[x_]:=x^2 > > While I don't close mathematica, I can use the function on my notebooks but when I close it, the function disappers, I tried to save a .m file with it but It didn't work. What do I do? > > Thanks for time, > Pedro --- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305

**References**:**Begginer's question: Saving a function for later use***From:*pedro.roberto@campus.ul.pt