RE: Shared Functions
- To: mathgroup at smc.vnet.net
- Subject: [mg46413] RE: Shared Functions
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 17 Feb 2004 07:05:45 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Massimo, The most obvious answer is to make a Mathematica package and put the shared functions in the package. The best reference for writing packages is probably "Programming in Mathematica: Third Edition" by Roman Maeder. But if you are new to Mathematica, and don't want to get into writing packages yet, the next best thing is to make a Routines Section near the top of your notebook and put the routines you develop there. (Be sure to write usage statements for them.) You can also make the routines initialization cells (and when you save the notebook choose NOT to create an autoload package). Then just copy and paste the Routines Section to new notebooks. Whenever you evaluate a statement in such a notebook, Mathematica will automatically ask if you want to evaluate the initialization cells first. Also, if you evaluate the routines in one notebook, they are available to any other notebook you open in the same Mathematica session. When I'm studying some subject or text I create just such a Routines Section and carry it over when I create new notebooks for new sections or chapters in the book. I keep adding routines as I need them. Then when I finish, or get far enough, I have a lot of nice routines that I can sweep into a package. Once you have the routines and usage statements for them, it's not difficult at all to make a package. And one last word. My experience is that Mathematics is not so much a toolbox for doing mathematics as it is a metatoolbox for making the tools to do mathematics in some specific area. You will almost always have to write routines to get something that is convenient for whatever subject you are dealing with. So it's worthwhile to know how to do it. Writing routines is a good way to come to grips with the guts of any subject. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Massimo Sironi [mailto:massimo.sironi at st.com] To: mathgroup at smc.vnet.net Hi All, I have a notebook with some functions that I want to use in some other notebook. Is possible to "include" a Mathematica notebook into another one? Or, how I can create a "shared" function (in Mathematica Language, not in C or Java...) and reuse it? Thanks for help, Massimo Sironi