MathGroup Archive 2012

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

Search the Archive

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

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 

(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 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
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

  • Prev by Date: Re: Landau letter, Re: Mathematica as a New Approach...
  • Next by Date: Re: DiagramPlot and PlanarGraphPlot colors
  • Previous by thread: Re: Begginer's question: Saving a function for later use
  • Next by thread: Re: Begginer's question: Saving a function for later use