MathGroup Archive 2006

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

Search the Archive

Re: creating packages of my own.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64239] Re: creating packages of my own.
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Tue, 7 Feb 2006 03:36:20 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 2/6/06 at 2:49 AM, bdsatish at gmail.com (bd satish) wrote:

>I have written a small code , say, "SquaresAll" in
>the form of a Module[...] . Say this is saved in notebook X .

>I want to call the Module "SquaresAll" again in another
>notebook Y in another new Mathematica session. How can I do this ?

>I even tried to write it in the form of a Package , but the
>Mathematica Help was too complicated for me to understand. Can any
>of  you put it in simple words ?

The simplest way to create a set of functions that can be loaded from any notebook would be as follows:

create your functions in a notebook 

select the cells with the functions you want save 

use Cell->Cell Properties->Initialization to mark those cells as initialization cells

use File->Save As Special...->Package Format to save those functions in a package

Once you have done this you can use Get, << or Needs to load your functions into a new notebook.

You can accomplish exactly the same thing by copying the cells with the functions you want to save as InputForm into any text editor and saving the file as a .m file.

About the only things this method lacks from being a "complete" package is there is no context (all the functions will be loaded into the global context) and there are no usage messages for your functions.

To get a good start on creating your own packages try Roman Maeder's book Programming in Mathematica.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: NIntegrate[Abs] bug in v5.1, not v5.0
  • Next by Date: Re: Notebooks, packages, cells, and literate programming
  • Previous by thread: creating packages of my own.
  • Next by thread: MeijerG evaluates an imaginary part, which does not exist