MathGroup Archive 2004

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

Search the Archive

Re: about Package

  • To: mathgroup at
  • Subject: [mg52899] Re: [mg52883] about Package
  • From: "David Park" <djmp at>
  • Date: Thu, 16 Dec 2004 03:40:36 -0500 (EST)
  • Sender: owner-wri-mathgroup at

The best place to put the package is in a folder that is in the user's
Application directory. You can find this folder by evaluating

$UserBaseDirectory in Version 5 or later. ($AddOnsDirectory in Version 4)

or you could use $BaseDirectory.

In that directory you should find a Folder named Applications.

Now suppose you have a package named MyPackage and you want to keep it in a
logical place, say PhysicsCourse.

Then create a folder named PhysicsCourse in the Applications folder. Put
your package in the PhysicsCourse folder.

Write the BeginPackage statement as


Note that the BeginPackage statement has to give the path from the
Applications folder down to the package. Mathematica knows enough to look in
the Applications folder.

If your create the package with a package notebook, MyPackage.nb that has
Initialization cells for all of the package statements, then choose
AutoSavePackage when you first save the notebook. This will create the
package file MyPackage.m.

Load the package with

<<PhysicsCourse`MyPackage`  or Needs["PhysicsCourse`MyPackage`"]

Hope that helps.

David Park
djmp at

From: Khoa Vat Ly [mailto:physics.nsu at]
To: mathgroup at

Dear friends
    I make a package, but I don't know put it in  what mathematica's
directory to call it if I need
Because I 'm new mathmember. If you know how about that, please guide me(in
detail) .
Thanks for your kind

  • Prev by Date: Re: shuffling (randomizing) a series
  • Next by Date: Re: shuffling (randomizing) a series
  • Previous by thread: Re: about Package
  • Next by thread: Using JLink to get a Complex number out