Book contents
- Frontmatter
- Contents
- Preface
- 1 An introduction to Mathematica
- 2 The Mathematica language
- 3 Lists
- 4 Patterns and rules
- 5 Functional programming
- 6 Procedural programming
- 7 Recursion
- 8 Numerics
- 9 Strings
- 10 Graphics and visualization
- 11 Dynamic expressions
- 12 Optimizing Mathematica programs
- 13 Applications and packages
- Solutions to exercises
- Bibliography
- Index
13 - Applications and packages
Published online by Cambridge University Press: 05 February 2013
- Frontmatter
- Contents
- Preface
- 1 An introduction to Mathematica
- 2 The Mathematica language
- 3 Lists
- 4 Patterns and rules
- 5 Functional programming
- 6 Procedural programming
- 7 Recursion
- 8 Numerics
- 9 Strings
- 10 Graphics and visualization
- 11 Dynamic expressions
- 12 Optimizing Mathematica programs
- 13 Applications and packages
- Solutions to exercises
- Bibliography
- Index
Summary
When you have developed several programs for some related tasks, you will find it convenient to group them together and make them available as a cohesive application that can easily be used and incorporated in your work. Packages and applications are part of the framework in Mathematica that makes this possible. A package is simply a text file containing Mathematica code. Typically you put related functions in a package. So there might be a computational geometry package or a random walks package that includes functions in support of those tasks. An application, in Mathematica, is a set of packages together with various user-interface elements such as documentation, palettes, and perhaps stylesheets.
When you develop an application, it is important to think about how your functions work with each other as well as how well they integrate with the rest of Mathematica. The user's interface to your programs should be as close as possible to that of the built-in functions in Mathematica so that users can more easily pick up the syntax and usage. Packages provide the framework to do this. In this chapter, features such as options, argument checking, messaging, and documentation are all discussed in the context of a larger application – random walks. We will gather much of the code fragments from earlier chapters and add an options framework, error and usage messages, and some new interactive visualization tools as we develop the RandomWalks package in this chapter.
- Type
- Chapter
- Information
- Programming with Mathematica®An Introduction, pp. 533 - 574Publisher: Cambridge University PressPrint publication year: 2013