Introduction to Programming with Mathematica, Third Edition

Chapter 12: Writing Packages

Packages are text files that contain Mathematica commands. They are designed to make it easy to distribute your programs to others, but they also provide a mechanism for you to write programs that integrate with Mathematica in a seamless manner. In this chapter we will discuss the organization and creation of packages including a discussion of contexts, which are a mechanism for organizing new names and symbols in your Mathematica sessions.

12.1 Introduction

When you begin a Mathematica session, the built-in functions are immediately available for you to use. There are, however, many more functions that you can access that reside in files supplied with Mathematica. In principle, the only difference between those files and the ones you create is that those were written by professional programmers. There is another difference: the definitions in those files are placed in special structures called packages. Indeed, these files themselves are often called "packages" instead of "files."

Packages are a name localizing construct, analogous to Module, but for entire files of definitions. Their purpose is to allow the programmer to define a collection of functions for export. These exported functions are for the users of the package to work with and are often referred to as public functions. Other functions, those that are not for export, are auxiliary, or private functions, and are not intended to be accessible to users.

In this chapter, you will learn how to write your own packages. Much of...

UNLIMITED FREE ACCESS TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Billing Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.