(***********************************************************************

                    Mathematica-Compatible Notebook

This notebook can be used on any computer system with Mathematica 3.0,
MathReader 3.0, or any compatible application. The data for the notebook 
starts with the line of stars above.

To get the notebook into a Mathematica-compatible application, do one of 
the following:

* Save the data starting with the line of stars above into a file
  with a name ending in .nb, then open the file inside the application;

* Copy the data starting with the line of stars above to the
  clipboard, then use the Paste menu command inside the application.

Data for notebooks contains only printable 7-bit ASCII and can be
sent directly in email or through ftp in text mode.  Newlines can be
CR, LF or CRLF (Unix, Macintosh or MS-DOS style).

NOTE: If you modify the data for this notebook not in a Mathematica-
compatible application, you must delete the line below containing the 
word CacheID, otherwise Mathematica-compatible applications may try to 
use invalid cache data.

For more information on notebooks and Mathematica-compatible 
applications, contact Wolfram Research:
  web: http://www.wolfram.com
  email: info@wolfram.com
  phone: +1-217-398-0700 (U.S.)

Notebook reader applications are available free of charge from 
Wolfram Research.
***********************************************************************)

(*CacheID: 232*)


(*NotebookFileLineBreakTest
NotebookFileLineBreakTest*)
(*NotebookOptionsPosition[     11602,        520]*)
(*NotebookOutlinePosition[     12456,        549]*)
(*  CellTagsIndexPosition[     12412,        545]*)
(*WindowFrame->Normal*)



Notebook[{

Cell[CellGroupData[{
Cell["Package Template", "Title",
  TextAlignment->Center],

Cell["by Roman E. Maeder", "Subsubtitle",
  TextAlignment->Center],

Cell["\<\
This notebook is a template for package and notebook development.\
\
\>", "Text"],

Cell[CellGroupData[{

Cell["Reference", "Section"],

Cell[CellGroupData[{

Cell["Title", "Subsubsection"],

Cell[TextData[StyleBox["Package template",
  FontSlant->"Italic"]], "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Author", "Subsubsection"],

Cell["Roman E. Maeder", "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Summary", "Subsubsection"],

Cell["\<\
This notebook is a template for package and notebook development.\
\
\>", "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Copyright", "Subsubsection"],

Cell[TextData[{
  "\[Copyright] Copyright 1996, ",
  StyleBox["your name or institution",
    FontSlant->"Italic"],
  ".\n\nPermission is granted to distribute this file for any purpose except \
for inclusion in commercial software or program collections. This copyright \
notice must remain intact.."
}], "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Notebook Version", "Subsubsection"],

Cell["1.0", "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[{
  StyleBox["Mathematica",
    FontSlant->"Italic"],
  " Version"
}], "Subsubsection"],

Cell["3.0", "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell["History", "Subsubsection"],

Cell[TextData[{
  "Version 1.0 for ",
  StyleBox["Programming in ",
    FontSlant->"Italic"],
  StyleBox["Mathematica",
    FontSlant->"Italic"],
  ", 3rd edition."
}], "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Keywords", "Subsubsection"],

Cell["programming, notebooks, packages, template", "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Source", "Subsubsection"],

Cell[TextData[{
  "Maeder, R. ",
  StyleBox["Programming in ",
    FontSlant->"Italic"],
  StyleBox["Mathematica",
    FontSlant->"Italic"],
  ", 3rd ed. Addison-Wesley, 1996."
}], "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Warnings", "Subsubsection"],

Cell[TextData[StyleBox["description of global effects, incompatibilities",
  FontSlant->"Italic"]], "Text"],

Cell[TextData[{
  "Note: all cells marked as \"InitializationCell\" will be written to the \
Auto-Save package. This package can then be read in programs that use it with \
",
  StyleBox["Needs[\"Template`\"]", "Input"],
  ". Cells not intended to belong to the package should not have this \
property."
}], "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Limitation", "Subsubsection"],

Cell[TextData[StyleBox["special cases not handled, known problems",
  FontSlant->"Italic"]], "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Discussion", "Subsubsection"],

Cell[TextData[StyleBox["description of algorithm, information for experts",
  FontSlant->"Italic"]], "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Requirements", "Subsubsection"],

Cell[TextData[StyleBox["Context`Package`",
  FontFamily->"Courier",
  FontWeight->"Bold",
  FontSlant->"Italic"]], "Text"]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{

Cell["Setup", "Section"],

Cell["\<\
This section contains commands needed to load the corresponding \
package. It may be omitted for notebooks that are used only to generate an \
auto-save package.\
\>", "Text"],

Cell[CellGroupData[{

Cell["Development", "Subsubsection",
  Background->GrayLevel[0.499992]],

Cell["\<\
The path on your system may be different from the path used for the \
final package. For convenience, you can put the development path here. Delete \
this subsection before distributing this notebook.\
\>", "Text"],

Cell[TextData[{
  "SetDirectory[\"",
  StyleBox["development directory",
    FontSlant->"Italic"],
  "\"]"
}], "Input",
  Background->GrayLevel[0.499992]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Search Path", "Subsubsection"],

Cell["\<\
Make sure that the directory containing the packages is either the \
current directory\
\>", "Text"],

Cell[TextData[{
  "SetDirectory[\"",
  StyleBox["full path name",
    FontSlant->"Italic"],
  "\"]"
}], "Input"],

Cell["or is on the search path", "Text"],

Cell[TextData[{
  "AppendTo[$Path, \"",
  StyleBox["full path name",
    FontSlant->"Italic"],
  "\"]"
}], "Input"],

Cell["\<\
Note: the two input cells above have been made un-evaluatable \
because you first have to enter the correct path name for your system before \
you can evaluate one of them (make the one you chose evaluatable to do so).\
\
\>", "Text"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Read in the Package", "Subsubsection"],

Cell[TextData[{
  "The code is contained in the package ",
  StyleBox["Template",
    FontFamily->"Courier",
    FontWeight->"Bold",
    FontSlant->"Italic"],
  StyleBox[".m",
    FontFamily->"Courier",
    FontWeight->"Bold"],
  ", which is simply read in here."
}], "Text"],

Cell[TextData[{
  "Needs[\"",
  StyleBox["Template",
    FontSlant->"Italic"],
  "`\"]"
}], "Input"],

Cell["Standard packages needed for the examples:", "Text"],

Cell["Needs[\"Graphics`Animation`\"]", "Input"]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{

Cell["Interface", "Section",
  InitializationCell->True],

Cell["\<\
This part declares the publicly visible functions, options, and \
values.\
\>", "Text",
  InitializationCell->True],

Cell[CellGroupData[{

Cell["Set up the package context, including public imports", "Subsection",
  InitializationCell->True],

Cell["\<\
BeginPackage[\"ProgrammingInMathematica`Template`\",
\t\"ProgrammingInMathematica`Package1`\", \
\"ProgrammingInMathematica`Package2`\"]\
\>", "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["\<\
Usage messages for the exported functions and the context \
itself\
\>", "Subsection",
  InitializationCell->True],

Cell["\<\
Template::usage = \"Template.m is a package that does \
nothing.\"\
\>", "Input",
  InitializationCell->True],

Cell["Function1::usage = \"Function1[n] does nothing.\"", "Input",
  InitializationCell->True],

Cell["\<\
Function2::usage = \"Function2[n, (m:17)] does even more nothing.\"\
\
\>", "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["Error messages for the exported objects", "Subsection",
  InitializationCell->True],

Cell["\<\
Template::badarg = \"You twit, you called `1` with argument \
`2`!\"\
\>", "Input",
  InitializationCell->True]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{

Cell["Implementation", "Section",
  InitializationCell->True],

Cell["\<\
This part contains the actual definitions and any auxiliary \
functions that should not be visible outside.\
\>", "Text"],

Cell[CellGroupData[{

Cell["Begin the private context (implementation part)", "Subsection",
  InitializationCell->True],

Cell["Begin[\"`Private`\"]", "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["Read in any hidden imports", "Subsection",
  InitializationCell->True],

Cell["Needs[\"ProgrammingInMathematica`Package3`\"]", "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["\<\
Unprotect any system functions for which definitions will be made\
\
\>", "Subsection",
  InitializationCell->True],

Cell["protected = Unprotect[ Sin, Cos ]", "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["\<\
Definition of auxiliary functions and local (static) variables\
\>",
   "Subsection",
  InitializationCell->True],

Cell[CellGroupData[{

Cell[TextData[StyleBox["Aux[]", "Input"]], "Subsubsection",
  InitializationCell->True],

Cell["Aux[f_] := Do[something]", "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[StyleBox["staticvar", "Input"]], "Subsubsection",
  InitializationCell->True],

Cell["staticvar = 0", "Input",
  InitializationCell->True]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Definition of the exported functions", "Subsection",
  InitializationCell->True],

Cell[CellGroupData[{

Cell[TextData[StyleBox["Function1[]", "Input"]], "Subsubsection",
  InitializationCell->True],

Cell["Function1[n_] := n", "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[StyleBox["Function2[]", "Input"]], "Subsubsection",
  InitializationCell->True],

Cell["\<\
Function2[n_, m_:17] := n m /; n < 5 || Message[Template::badarg, \
Function2, n]\
\>", "Input",
  InitializationCell->True]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Definitions for system functions", "Subsection",
  InitializationCell->True],

Cell["Sin/: Sin[x_]^2 := 1 - Cos[x]^2", "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["Restore protection of system symbols", "Subsection",
  InitializationCell->True],

Cell["Protect[ Evaluate[protected] ]", "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["End the private context", "Subsection",
  InitializationCell->True],

Cell["End[ ]", "Input",
  InitializationCell->True]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{

Cell["Epilog", "Section",
  InitializationCell->True],

Cell["This section protects exported symbols and ends the package.", "Text"],

Cell[CellGroupData[{

Cell["Protect exported symbol", "Subsection",
  InitializationCell->True],

Cell["Protect[ Function1, Function2 ]", "Input",
  InitializationCell->True],

Cell["Alternative: protect all exported symbols", "Text",
  InitializationCell->True],

Cell["Protect[Evaluate[$Context <> \"*\"]]", "Input",
  Evaluatable->False,
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["End the package context", "Subsection",
  InitializationCell->True],

Cell["EndPackage[ ]", "Input",
  InitializationCell->True]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{

Cell["Examples, Tests", "Section"],

Cell[TextData[StyleBox[
"Examples, tests for the use of the package can go here.",
  FontSlant->"Italic"]], "Text"]
}, Closed]]
}, Open  ]]
},
FrontEndVersion->"X 3.0 Beta 3",
ScreenRectangle->{{0, 1280}, {0, 1024}},
AutoGeneratedPackage->Automatic,
CellGrouping->Automatic,
WindowSize->{520, 600},
WindowMargins->{{366, Automatic}, {140, Automatic}},
PrivateNotebookOptions->{"ColorPalette"->{RGBColor, 128}},
ShowCellLabel->True,
RenderingOptions->{"ObjectDithering"->True,
"RasterDithering"->False}
]


(***********************************************************************
Cached data follows.  If you edit this Notebook file directly, not using
Mathematica, you must remove the line containing CacheID at the top of 
the file.  The cache data will then be recreated when you save this file 
from within Mathematica.
***********************************************************************)

(*CellTagsOutline
CellTagsIndex->{}
*)

(*CellTagsIndex
CellTagsIndex->{}
*)

(*NotebookFileOutline
Notebook[{

Cell[CellGroupData[{
Cell[1731, 51, 58, 1, 103, "Title"],
Cell[1792, 54, 66, 1, 52, "Subsubtitle"],
Cell[1861, 57, 91, 3, 32, "Text"],

Cell[CellGroupData[{
Cell[1977, 64, 28, 0, 53, "Section"],

Cell[CellGroupData[{
Cell[2030, 68, 30, 0, 42, "Subsubsection"],
Cell[2063, 70, 75, 1, 32, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[2175, 76, 31, 0, 42, "Subsubsection"],
Cell[2209, 78, 31, 0, 32, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[2277, 83, 32, 0, 42, "Subsubsection"],
Cell[2312, 85, 91, 3, 32, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[2440, 93, 34, 0, 42, "Subsubsection"],
Cell[2477, 95, 313, 7, 86, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[2827, 107, 41, 0, 42, "Subsubsection"],
Cell[2871, 109, 19, 0, 32, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[2927, 114, 101, 4, 42, "Subsubsection"],
Cell[3031, 120, 19, 0, 32, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[3087, 125, 32, 0, 42, "Subsubsection"],
Cell[3122, 127, 176, 7, 32, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[3335, 139, 33, 0, 42, "Subsubsection"],
Cell[3371, 141, 58, 0, 32, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[3466, 146, 31, 0, 42, "Subsubsection"],
Cell[3500, 148, 188, 7, 32, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[3725, 160, 33, 0, 42, "Subsubsection"],
Cell[3761, 162, 107, 1, 32, "Text"],
Cell[3871, 165, 315, 7, 68, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[4223, 177, 35, 0, 42, "Subsubsection"],
Cell[4261, 179, 100, 1, 32, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[4398, 185, 35, 0, 42, "Subsubsection"],
Cell[4436, 187, 108, 1, 32, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[4581, 193, 37, 0, 42, "Subsubsection"],
Cell[4621, 195, 122, 3, 35, "Text"]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{
Cell[4792, 204, 24, 0, 33, "Section"],
Cell[4819, 206, 185, 4, 50, "Text"],

Cell[CellGroupData[{
Cell[5029, 214, 71, 1, 58, "Subsubsection"],
Cell[5103, 217, 224, 4, 68, "Text"],
Cell[5330, 223, 154, 6, 47, "Input"]
}, Open  ]],

Cell[CellGroupData[{
Cell[5521, 234, 36, 0, 42, "Subsubsection"],
Cell[5560, 236, 110, 3, 32, "Text"],
Cell[5673, 241, 112, 5, 31, "Input"],
Cell[5788, 248, 40, 0, 32, "Text"],
Cell[5831, 250, 115, 5, 31, "Input"],
Cell[5949, 257, 244, 5, 68, "Text"]
}, Open  ]],

Cell[CellGroupData[{
Cell[6230, 267, 44, 0, 42, "Subsubsection"],
Cell[6277, 269, 275, 10, 35, "Text"],
Cell[6555, 281, 100, 5, 31, "Input"],
Cell[6658, 288, 58, 0, 32, "Text"],
Cell[6719, 290, 47, 0, 27, "Input"]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{
Cell[6815, 296, 56, 1, 33, "Section",
  InitializationCell->True],
Cell[6874, 299, 125, 4, 32, "Text",
  InitializationCell->True],

Cell[CellGroupData[{
Cell[7024, 307, 102, 1, 45, "Subsection",
  InitializationCell->True],
Cell[7129, 310, 189, 5, 57, "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{
Cell[7355, 320, 124, 4, 45, "Subsection",
  InitializationCell->True],
Cell[7482, 326, 119, 4, 42, "Input",
  InitializationCell->True],
Cell[7604, 332, 94, 1, 27, "Input",
  InitializationCell->True],
Cell[7701, 335, 122, 4, 42, "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{
Cell[7860, 344, 89, 1, 45, "Subsection",
  InitializationCell->True],
Cell[7952, 347, 121, 4, 42, "Input",
  InitializationCell->True]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{
Cell[8122, 357, 61, 1, 33, "Section",
  InitializationCell->True],
Cell[8186, 360, 131, 3, 50, "Text"],

Cell[CellGroupData[{
Cell[8342, 367, 97, 1, 45, "Subsection",
  InitializationCell->True],
Cell[8442, 370, 65, 1, 27, "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{
Cell[8544, 376, 76, 1, 45, "Subsection",
  InitializationCell->True],
Cell[8623, 379, 90, 1, 27, "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{
Cell[8750, 385, 125, 4, 45, "Subsection",
  InitializationCell->True],
Cell[8878, 391, 78, 1, 27, "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{
Cell[8993, 397, 123, 4, 45, "Subsection",
  InitializationCell->True],

Cell[CellGroupData[{
Cell[9141, 405, 87, 1, 41, "Subsubsection",
  InitializationCell->True],
Cell[9231, 408, 69, 1, 27, "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{
Cell[9337, 414, 91, 1, 41, "Subsubsection",
  InitializationCell->True],
Cell[9431, 417, 58, 1, 27, "Input",
  InitializationCell->True]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{
Cell[9538, 424, 86, 1, 45, "Subsection",
  InitializationCell->True],

Cell[CellGroupData[{
Cell[9649, 429, 93, 1, 41, "Subsubsection",
  InitializationCell->True],
Cell[9745, 432, 63, 1, 27, "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{
Cell[9845, 438, 93, 1, 41, "Subsubsection",
  InitializationCell->True],
Cell[9941, 441, 134, 4, 42, "Input",
  InitializationCell->True]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{
Cell[10124, 451, 82, 1, 45, "Subsection",
  InitializationCell->True],
Cell[10209, 454, 76, 1, 27, "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{
Cell[10322, 460, 86, 1, 45, "Subsection",
  InitializationCell->True],
Cell[10411, 463, 75, 1, 27, "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{
Cell[10523, 469, 73, 1, 45, "Subsection",
  InitializationCell->True],
Cell[10599, 472, 51, 1, 27, "Input",
  InitializationCell->True]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{
Cell[10699, 479, 53, 1, 33, "Section",
  InitializationCell->True],
Cell[10755, 482, 76, 0, 32, "Text"],

Cell[CellGroupData[{
Cell[10856, 486, 73, 1, 45, "Subsection",
  InitializationCell->True],
Cell[10932, 489, 76, 1, 27, "Input",
  InitializationCell->True],
Cell[11011, 492, 85, 1, 32, "Text",
  InitializationCell->True],
Cell[11099, 495, 103, 2, 27, "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{
Cell[11239, 502, 73, 1, 45, "Subsection",
  InitializationCell->True],
Cell[11315, 505, 58, 1, 27, "Input",
  InitializationCell->True]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{
Cell[11422, 512, 34, 0, 33, "Section"],
Cell[11459, 514, 115, 2, 32, "Text"]
}, Closed]]
}, Open  ]]
}
]
*)




(***********************************************************************
End of Mathematica Notebook file.
***********************************************************************)

