Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11701

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

From Murray Eisenberg <murray@math.umass.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Begginer's question: Saving a function for later use
Date 2012-09-11 06:34 +0000
Message-ID <k2mm12$4v6$1@smc.vnet.net> (permalink)
References <20120910080540.BEE556843@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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





Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Begginer's question: Saving a function for later use Murray Eisenberg <murray@math.umass.edu> - 2012-09-11 06:34 +0000

csiph-web