EVERYDAY DISCOUNT OFFER
Buy 3 or more eligible titles and save 40%*—use code BUY3. Shop now.
Register your product to gain access to bonus material or receive a coupon.
NEW TO THIS EDITION
25920-0
“Nancy Blachman's book opens up the world of Mathematica. She has a down-to-earth lucid style of writing and real experience with the system. This belongs on your bookshelf.” —William R. Hearst III
“Nancy Blachman's book is an indispensable resource for anyone who wants to do serious work with Mathematica.” —Hal R. Varian, Dean, School of Information Management & Systems University of California at Berkeley
“Many people that I know have asked me how to get started using Mathematica. I always point them to Mathematica: A Practical Approach.—Dr. Henry Cejtin, One of the eight original Mathematica developers
“This book offers a systematic introduction to Mathematica for people who want to get up to speed quickly. It provides the best presentation that I have seen. It covers all important features of Mathematica thoroughly, with clear explanations, excellent examples, and challenging and instructive problem sets.” —Dr. Cameron Smith, Author of The Mathematica Graphics Guidebook
“This book is very user-friendly. Not only did I use it to learn Mathematica, but I find myself using it to upgrade my skills.” —Vrinda Kadiyali, Assistant Professor of Economics and Marketing Cornell's Johnson School of Management
There are over 100 books published about Mathematica. One of my personal favorites is Mathematica: A Practical Approach.—Ian Collier, Member of Technical Staff Wolfram Research, Inc.
Mathematica: A Practical Approach is the most popular introductory tutorial book on Mathematica. It has been translated into Japanese, Spanish, Dutch, and Portuguese. The new edition, is loaded with even more examples and exercises to get you up and running with Mathematica version 3!
This book teaches how to:
Click here for a sample chapter for this book: 0132592010.pdf
(NOTE: Most chapters end with a Summary and Exercises).
I. USING MATHEMATICA INTERACTIVELY.
1. Getting Started with Mathematica.Starting Mathematica. The In's and Out's of Mathematica. Using On-Line Help. Using Palettes to Enter Formulae. Notation Conventions. Saving Your Work and Quitting. A Quick Tour of Some Commands. Using the Standard Packages.
2. Numerical Capabilities.Arithmetic Operations. Types of Numbers. Random Numbers. Numerical Precision. Integer Functions. Finding Roots of Equations. Numerical Integration. Numerical Differential Equations.
3. Symbolic Capabilities.Manipulating and Simplifying Expressions. Trigonometry. Solving Equations. Differential Calculus. Series. Integral Calculus. Symbolic Sums, Products, and Limits. Symbolic Differential Equations.
4. Plotting Functions.Two-Dimensional Plots. Changing the Appearance of Plots. Combining Plots. Parametric, Implicit and Polar Plots. Frames, Grids, Backgrounds and Ticks. Inserting Annotations to a Plot. Three Dimensional Plots. Contour Plots and Density Plots.
5. Visualizing Data.Plotting Data in Two Dimensions. Error Plots. Log Plots. Bar Charts and Pie Charts. Two-Dimensional Fields.
6. Data Manipulation and Analysis.Lists and Nested Lists As Data Structures. Re-ordering and Partitioning Data. Inserting, Replacing, and Deleting Elements. Selecting Subsets of the Data. Counting and Binning Elements. Mapping Functions over Data. Statistical Analyses. Curve Fitting. Data Interpolation.
7. Getting Around with Notebooks.Initialization Cells. Default Output Form for Formulae. Interacting with Outputs. Cell Brackets. Menus in Notebooks.
II. PROGRAMMING.
8. Writing Your Own Programs.A Simple Program. Multi-Line Programs. Localizing Variables. Programs with Multiple Calling Patterns. Logical Operators and Tests. Conditional Execution. Adding Usage Messages. Adding Error Messages.
9. Rule-Based Programming.Local Rewrite Rules. Rules Don't Always Work As Expected. Controlling How Rules Are Applied. Types of Patterns. Uses of Patterns.
10. Functional Programming.Nesting Function Calls. Recursive Functions. Anonymous (Pure) Functions. Variants of Map. Apply. Select. Functional Alternatives to Loops.
11. Procedural Programming.Arrays. Counter Variables. Loops and Iteration. Conditionals.
12. Graphics, Animation and Sound.Two-Dimensional Graphics Primitives. Setting Styles for Graphics Primitives. Three-Dimensional Graphics Primitives. Creating Animations. Creating Sounds.
13. Writing Interactive Programs.Asking Questions and Getting Replies. Strings. Checking a User's Answer. Managing User Interaction.
14. Notation, Buttons, and Palettes.Special Notation. Defining Buttons. Creating Palettes.
III. Building Larger Applications.
15. Speeding Up Your Programs.Timing Your Programs. Avoid Exact Arithmetic. Avoid Evaluating Data Structures. Avoid the Procedural Style. Compile Numerical Functions.
16. Writing Your Own Packages.Why Write a Package? Contexts. Package Style. Loading Packages. Accidental Shadowing.
17. Working with Files.Telling Mathematica where to Look. Importing Data from Files. Exporting Data. Low-Level File Interaction. Exporting Special Formats. Exporting Graphics. Exporting HTML Files. Exporting Function Definitions. Searching the Contents of a File.
18. Example Applications.Monte Carlo Simulations. Cryptography.
Appendix A: Answers to Odd-Numbered Exercises. Preface
As scientists, engineers, and mathematicians, you spend a great deal of time performing mathematical calculations and manipulations by hand. Many of these calculations can be handled by a software program called Mathematica. This book offers a tutorial introduction to Mathematica.
Mathematica performs three basic types of computation: numerical, symbolic, and graphical. It works with numbers of arbitrary magnitude and precision, as well as with polynomials, power series expansions, matrices, and graphs. Mathematica provides the standard symbolic operations of algebra and calculus, including integration and differentiation. It can also plot functions and data in two or three dimensions.
Even though they included hundreds of functions, the developers of Mathematica were aware that they could not anticipate the needs of all users. Therefore, Mathematica was designed to be extensible by including its own programming language. It is flexible and extremely useful software for anyone who regularly performs complicated mathematical computations.
Although we wrote this book for people new to Mathematica, it also contains information of interest to those who already have experience with the program. For those who do not have Mathematica, this text describes the capabilities of the software in sufficient detail to enable you to decide whether it suits your needs.
Our book does not teach mathematics. It assumes you understand the theory behind what you want to do and just need to be told what Mathematica commands to use to make it happen. It teaches Mathematica by showing some common patterns of usage. It also shows you how to find the commands you need to solve your problems, how to use Mathematica interactively, how to manipulate expressions, how to visualize functions and data, how to write functions and packages, and how to import and export data. Each chapter ends with a set of exercises designed to give you practice with the material presented.
Why did we write this book? Because there wasn't such a book when we were learning Mathematica. Can't you learn Mathematica from Stephen Wolfram's book Mathematica: A System for Doing Mathematics by Computer? Yes, but it's a bit like learning English from a dictionary. As the definitive reference for Mathematica, Wolfram's book describes all the functions built into the program. On the other hand, our book focuses on how to use Mathematica. It provides examples of useful constructs and functions, illustrative problem sets and complete solutions to half the exercises. In our book, we strive to show the versatility of the program as well as its limitations. This book is intended to get you up to speed quickly.
Mathematica: A Practical Approach grew out of an undergraduate course we have been teaching at Stanford University since 1990. Although it was originally designed to be used for teaching courses and giving workshops in Mathematica, the book can also be used for independent study. All readers are encouraged to work through the exercises and to practice their programming skills.
Organization of this Book
This book is divided into three parts. The first discusses how to use Mathematica interactively, the second focuses on programming, and the third describes how to build more complicated applications.
Part I: Introduction to Mathematica explains how to use Mathematica interactively, and is intended for those who have little or no experience with the program. It starts by describing how to start Mathematica, how to create a new Notebook, how to make Mathematica perform a calculation, how to access the on-line help. It then details Mathematica's the numerical, symbolic, graphical, data manipulation and data analysis capabilities.
Part II: Programming is intended for those who have used Mathematica interactively and who are interested in learning how to write their own functions and packages. It discusses rule-based, functional and procedural techniques for programming and describes several tips for speeding up your code. It describes how to write your own packages and how to import, export, and format data and expressions. The final chapter focuses on programming the user interface, i.e., creating buttons, palettes, and special notation.
Part III: Building Larger Applications describes how to write complicated Mathematica programs that integrate symbolic, numeric, graphical, data manipulation, and data analysis capabilities. We emphasize principles of good Mathematica programming that lead to reliable, robust, efficient and elegant code. We also discuss how to interface Mathematica with other programs, e.g., by creating HTML pages suitable for display on any World Wide Web browser.
The Appendix offers additional information on Mathematica. It contains answers to all the odd-numbered exercises and gives an extensive list of Mathematica books that cover more specialized areas.
At the end of each chapter is a problem set to give you practice with the material presented. We strongly urge you to work through the examples in the chapter and the exercises at the end of each chapter. Only through practice will you become proficient at Mathematica.
Although this book was developed using Version 3 of Mathematica (on a Macintosh G3 and a Pentium-based Micron) it illustrates general techniques that can be used with other versions of the software. Be aware, however, that earlier versions of Mathematica do not have some of the capabilities described, and later versions have capabilities that are not addressed. This book focuses on general techniques and thus should be of interest to most Mathematica users regardless of the version of the software they are using. We welcome feedback from our readers. Please feel free to email us at colin@solstice.jpl.nasa.gov, cpw@cs.stanford.edu, and nancy@variablesymbols.com.
Nancy's Background
Nancy Blachman heard about Mathematica in the summer of 1988 when numerous articles started appearing in the press. She first saw Mathematica in action in August of 1988 at SIGGRAPH, a computer graphics conference. She was pleased to see that the program lived up to much of the hype that it had received.
In the fall of 1988, Nancy joined Wolfram Research, where she gave talks, seminars, and workshops on Mathematica. Realizing that corporations, colleges, and universities want training in the use of Mathematica, in 1989, she founded Variable Symbols, Inc. to serve their needs. She has traveled around the world giving hands-on workshops on Mathematica at industrial institutions including: Boeing, Chevron, Hewlett Packard, IBM, MITRE, Naval Research Laboratory, Shell, Xerox, and Wolfram Research, Inc., the developer of Mathematica. She has also given workshops at academic institutions including: Boston University, Massachusetts Institute of Technology, the University of California Berkeley Extension, and the University of California Santa Cruz Extension.
In Winter quarter of 1990, Nancy gave a course at Stanford University entitled "Problem Solving with Mathematica". Stanford has invited her back to teach it again every year since then. Nancy has also given workshops at Mathematica Conferences sponsored by Wolfram Research.
Nancy has written or co-authored several books on Mathematica including "The Mathematica Quick Reference", "The Mathematica Graphics Guidebook", and "CalcLabs with Mathematica" for Stewart's "Calculus Concepts and Contexts".
Before getting involved with Mathematica Nancy was at Stanford University, where she was the instructor for a course on computer graphics and a teaching assistant for Donald Knuth's course in discrete mathematics. In addition to teaching, she has developed software at Bell Laboratories, Resonex, and the Research Institute for Advanced Computer Science at NASA Ames. Nancy holds a B.S. in mathematics from the University of Birmingham in the United Kingdom, an M.S. in operations research from the University of California at Berkeley, and an M.S. in computer science from Stanford University.
Colin's Background
Colin is research computer scientist who works at the Jet Propulsion Laboratory in the areas of quantum computing and quantum communications. He also teaches courses in quantum computing and Mathematica at Stanford University.
Colin first saw Mathematica in January 1990. He had previously written several algebraic manipulation systems in Prolog and LISP and was immediately impressed by the power and expressiveness of the Mathematica system. His first programming project was to simulate how coordination can arise from purely local adaptation rules in a society of mini-robots. The simulation was up and running in just two hours of programming effort! Overnight, Mathematica became Colin's programming language of choice for all mathematical, data analysis and graphical needs. Since that time, Colin has used Mathematica daily and has given numerous workshops and tutorials on Mathematica to engineering research laboratories, banks and government agencies. He has recently published the first book on quantum computing, entitled "Explorations in Quantum Computing", with Scott Clearwater, that comes equipped with a multi-platform CD-ROM packed full of Mathematica simulations that illustrate the ideas of quantum computing in visually appealing ways.
Colin earned a Ph.D. in artificial intelligence from the University of Edinburgh, Scotland, in 1989. He was also awarded a M.Sc. degree in Atmospheric Physics and Dynamics, from Imperial College of Science and Technology, University of London, and a B.Sc. in Mathematical Physics, from the University of Nottingham. Prior to going to Edinburgh, Colin was a research assistant to Prof. Stephen Hawking of Cambridge University. After completing his Ph.D., Colin joined the Dynamics of Computation Group at the Xerox Palo Alto Research Center, where he worked as a research scientist, linking ideas from physics, economics and computer science.
In early 1995 Colin joined Variable Symbols, Inc. and developed new workshops on financial and engineering applications of Mathematica. He has taught the Stanford Mathematica class "CS50: Problem Solving with Mathematica" since 1995.
Colin now leads a research group in quantum computing and quantum communications at the Jet Propulsion Laboratory, California Institute of Technology. He recently finished another book with Scott Clearwater entitled "Ultimate Zero and One: Computing at the Quantum Frontier".
Acknowledgments
Nancy thanks her mother and father, Nelson and Anne Blachman, and Colin thanks his beautiful, talented, supportive, and most importantly, patient wife, Patricia, for their encouragement, and invaluable suggestions.
This book enlarges greatly (!) upon the first edition of "Mathematica: A Practical Approach". It covers even more practical problem solving tips, ideas and suggestions in the light of the excellent feedback we received from several scientists, engineers, mathematicians and analysts. In particular, we would like to thank Paul Abbott, Arnold O. Allen, Helmer Aslaksen, Peter Altenberg, Eric Apgar, Sheldon Axler, Rick Beldin, Susan Blachman, Robert Campbell, John Carroll, Rolan Christofferson, Anne Coleman, Shawn Ewing, Richard Fateman, Harold Falk, Yossi Friedman, Richard Gaylord, Bruce Herman, Thomas Highes, David Jacobson, Pat Lampert, Matthew Lutzker, Rafael O. Marrero, Wanda Martinez, Eddie Mizzi, Julia Olkin, Larry Seiford, Sha Xin Wei, Malcolm Slaney, Cameron Smith, Anton Tran, Ilan Vardi, Roger W. Vidal, Jim Wendel, Stephen Wolfram, and Eran Yehudai.
We used a draft of this book to teach our Mathematica class at Stanford University. Several students gave us great feedback. We are especially grateful to Lyndell L.Asbenson, Greg Baker, Ed DeGrange, Derek Fong, Bonnie Gorsic, Steve Greidinger, Jeff Gruda, Jim Hwang, Blair Ireland, Stan Isaacs, Phil Isubaki, Richard O. Kahn, Karen Kraemer, Bing Kongmebhol, Eric Lim, David G. Lowell, Paul R. McGill, Motegi Tsuyoshi, Wentao Pan, Chris Phoenix, Dave Raisin, Kevin W. Rudd, Haydee Saffari, Valter Sorana, Phil Tsubaki, and Qinping Yang.
We also wish to thank Peter Altenberg for designing the cover for the first edition of the book, Kimberly for adapting the illustration for the second edition, and Kerry Reardon of KR Publishing for helping with production.
Nancy Blachman
Colin P. Williams
Princeton, NJ
San Francisco, CA
November, 1998
November, 1998