0% found this document useful (0 votes)
28 views384 pages

Programming in Mathematica - 3rd Ed.

This document serves as a preface and introduction to a book on programming in Mathematica, highlighting the importance of understanding its programming language and features. It emphasizes that while the book provides extensive examples and explanations, familiarity with Mathematica is assumed, and it is not a replacement for the official manual. The document also outlines the book's structure, major updates in Version 3, and the focus on good programming practices.

Uploaded by

robertunp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views384 pages

Programming in Mathematica - 3rd Ed.

This document serves as a preface and introduction to a book on programming in Mathematica, highlighting the importance of understanding its programming language and features. It emphasizes that while the book provides extensive examples and explanations, familiarity with Mathematica is assumed, and it is not a replacement for the official manual. The document also outlines the book's structure, major updates in Version 3, and the focus on good programming practices.

Uploaded by

robertunp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 384

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks.

Where those
designations appear in this book and Addison-Wesley was aware of a trademark claim, the designations have been printed in initial
caps or all caps. Mathematica, MathLink, and MathSource are registered trademarks of Wolfram Research.
The authors and publishers have taken care in the preparation of this book, but make no expressed or implied warranty of any kind
and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection
with or arising out of the use of the information or programs contained herein.
The author, Wolfram Research, Inc., and Addison Wesley Longman, Inc. make no representations, express or implied, with respect
to this documentation or the software it describes, including without limitations, any implied warranties of merchantability or fitness
for a particular purpose, all of which are expressly disclaimed. Users should be aware that included in the terms and conditions
under which Wolfram Research is willing to license Mathematica is a provision that Wolfram Research, Wolfram Media, and their
distribution licensees, distributors and dealers shall in no event be liable for any indirect, incidental or consequential damages, and
that liability for direct damages shall be limited to the amount of the purchase price paid for Mathematica.
In addition to the foregoing, users should recognize that all complex software systems and their documentation contain errors
and omissions. The author, Wolfram Research, Inc., and Addison Wesley Longman, Inc. shall not be responsible under any
circumstances for providing information on or corrections to errors and omissions discovered at any time in this book or the
software it describes, whether or not they are aware of the errors or omissions. The author, Wolfram Research, Inc., and Addison
Wesley Longman, Inc. do not recommend the use of the software described in this book for applications in which errors or omissions
could threaten life, injury or significant loss.

The publisher offers discounts on this book when ordered in quantity for special sales.
For more information, please contact:
Corporate & Professional Publishing Group
Addison-Wesley Publishing Company
One Jacob Way
Reading, Massachusetts 01867

Library of Congress Cataloging-in-Publication Data

Maeder, Roman.
Programming in Mathematica I Roman E. Maeder. - 3rd ed.
p. em.
Includes bibliographical references and index.
ISBN 0-20l-85449-X
1. Science-Data processing. 2. Mathematica (Computer programming language). I. Title.
QI83.9.M34 1996
510' .285 I 53--dc20 96-5714
CIP

This book was prepared by the author, using the TEX typesetting language on a Sun SPARCstation 5 computer.
Copyright © 1997 by Addison Wesley Longman, Inc.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by
any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. Printed in the
United States of America. Published simultaneously in Canada.
ISBN 0-20l-85449-X
2 3 4 5 6 7 CRW 01 00 99 98
2nd Printing July, 1998
II Preface

Mathematica was officially announced in June of 1988. Since then it has found many
uses in very diverse fields. While it is useful to do a few calculations interactively, its
real strength lies in the programming language it offers. Writing programs, one extends
Mathematica with specialized new functions in one's own field of interest. Mathematica's
programming language is unlike any you have encountered before. The language's manual
explains all its features and gives some very basic examples of their use. For writing good
programs, however, this is not enough: there is clearly a need for a book explaining all the
many features in context and giving more extensive examples of their use. The first edition
of this book filled this gap for version 1.2 of Mathematica. Like the second edition, this
third edition was prompted by a major new version of Mathematica, Version 3.
I have been in contact with many early users of Mathematica and I have also given
students at the University of Illinois and the Swiss Federal Institute of Technology an
opportunity to learn about it. I have seen many programs written in Mathematica, good
ones and bad ones. The bad ones invariably solve a particular problem in an unnecessarily
complicated way, perhaps because the programmers were unaware of the elegant constructs
available in Mathematica. Let me point out these constructs and show you how they can
be used to write concise, elegant, and efficient programs.
The best way to teach these Mathematica-specific programming methods is to look at
examples of complete programs that solve some nontrivial problem. Even if the example
chosen does not lie in the particular field of application that you are interested in, you will
be able to use similar ideas for your own programs. Many of the examples presented here
deal with graphics. Graphics applications are especially suited for learning programming,
because it is easy to see whether your code is correct simply by looking at the picture
it produces. Advanced graphics applications are also sufficiently challenging to require
advanced programming methods. Other examples come from symbolic computation,
geometry, dynamics, and numerical mathematics. Along the way, we also develop many
short pieces of code that can be used as parts of larger programs or that help to customize
Mathematica to your particular needs. Many of these found their way into the standard
Mathematica distribution and are now available to all users.
Because there exists an excellent manual, this book does not explain everything from
scratch, but assumes some familiarity with Mathematica. I assume also that you have
access to a computer on which to try out the examples. In this book I want to tell you how
you can use Mathematica for more than just typing in single commands. If you are using
Mathematica for your work, teaching, or solving homework assignments, sooner or later
you will encounter more advanced problems requiring many commands to solve, or you
will be faced with doing the same calculation steps over and over again with different input.
This is the point at which you want to start writing programs. Mathematica includes a rich
and powerful programming language. Unlike the usual languages such as BASIC and C, it
is not restricted to a small number of data types, but allows you to perform all its symbolic
vi Preface

computations. The Mathematica manual can only hint at the possibilities. It explains all
the features but does not show you which ones to use for a particular problem or how to fit
things together into larger programs.
Through design and tradition, each programming language has developed a certain
preferred style of good programming. It is possible to solve the same problem in many
different ways, but there is usually some idea about what is a good or a bad program. In
this book, I want to present examples of what the designers of Mathematica think is good
programming style and show you why this is so. Even if you write your programs strictly
for personal use, you will benefit from following a good style. For developing programs
for others to use, adhering to this style is indispensable.
The programming examples in this book serve two purposes. First, they help explain
concepts and show how things fit together to make up complete programs. Second, they are
designed to be more than mere toy programs and should prove useful in their own right. In
developing an example we always use the same method. We start out with a few commands
or definitions that could be entered directly into Mathematica. We then extract the parts
of the computation that are the same regardless of the input and define some functions or
procedures that automate these steps. Then we apply standard techniques to these functions
to make them into a package, adding documentation and certain programming constructs
that make such a package easier to use. The goal is to write a program that would be
useful not only to its author, who knows how it works, but also to other people. Finally,
we might add a few more functions to the package or look at alternatives to what we did so
far. In Chapter 1 these steps are described in full detail. Later on, when we concentrate on
other aspects, we assume that you are familiar with these basic concepts and we shall not
mention all the steps in detail. All the programs developed in this book are either part of
the standard Mathematica distribution from Wolfram Research, or they are available free
in electronic form.
Version 3 brings major new features. The programming language itself has not changed
all that much, but many problems that required elaborate workarounds and many inconsis-
tencies have been remedied. As a consequence, it is now possible to present the material
on packages in a more logical fashion. The support for developing larger applications
has been improved, and this edition discusses the software engineering issues of writing
and using larger programs in Mathematica. The treatment of exact numeric quantities is
another area of improvement, and the way numerical code should be written has changed.
All programs have been revised to take advantage of the many new built-in functions. I
added more material about functional and structural programming. These techniques are
fundamental to writing good Mathematica code, but they are not available in most other
programming languages and therefore need an expanded treatment.
The most important addition to Version 3 is, of course, the new frontend and the
typesetting capabilities. The fact that notebooks and typeset formulae are represented
as ordinary Mathematica expressions means that they can be manipulated easily with
programs. This capability leads to some fascinating applications, and the new material on
the frontend and typesetting teaches you how to develop such applications.
A complete, larger application (iterated function systems), more exercises, and an
Preface vii

updated bibliography complete this expanded and revised edition.


This book is no replacement for the Mathematica manual "The Mathematica Book"
[40]. I do not expect that you have read everything in the Mathematica book, but you
should have some basic experience with Mathematica before reading this book. Single
commands are usually used without detailed explanation. You can use the index in the
Mathematica book to look up a description of a command that you did not know about. We
also give references to places in the Mathematica book where you can find explanations of
concepts that are particularly relevant to a topic in this book. You should always tum to the
Mathematica book for explanations of features that are assumed known here, but that you
have not used yet. The place to look for an explanation of all variants, defaults, or options
for a particular command is the reference guide in the back of the Mathematica book. All
this information is also available in electronic form and can be accessed through the Help
Browser of Mathematica.
All explanations about how Mathematica works are based on Version 3. The first
edition of this book was about Version 1.2. Many things have changed in the new version.
I added a few sections called "Changes from Earlier Editions" for the benefit of readers
familiar with earlier versions of Mathematica or the first and second edition of this book.
I am grateful to many people who have contributed to this book. My thanks go first to the
other developers of Mathematica. The language was shaped through countless discussions
and many heated arguments. Trying to explain to each other why we think a certain feature
should be done in a certain way has deepened our understanding of the matters involved
and has given the language its overall consistency, despite the fact that it contains hundreds
of commands and unifies many diverse programming paradigms.
Helpful ideas for this book came from Jim Feagin, Theodore Gray, Dan Grayson, Jerry
Keiper, Silvio Levy, Troels Petersen, Will Self, Bruce Smith, Han Vardi, Ferrell Wheeler,
and Stephen Wolfram. Some of the examples I used were inspired by Henry Cejtin,
John Gray, Lee Rubel, William Thurston, Han Vardi, Jorg Waldvogel, and Dave Withoff.
Help with the typographical side of producing this book came from Peter Altenberg, John
Bonadies, Joe Kaiping, Daniel Lee, Cameron Smith, and Gregg Snyder, as well as from
many other people at Wolfram Research, Inc. and the staff of Addison-Wesley. My past
and present publishers, Allan Wylde and Peter Gordon, encouraged me to get started on
this book and this new edition.
R.E.M.
Herrliberg, Switzerland
August 1996

A computer, to print out a fact,


Will divide, multiply, and subtract.
But this output can be
No more than debris,
If the input was short of exact.
-Gigo
• Contents

Preface . v

About This Book


Chapter Overview Xll1
About the Examples XIV
Notation and Terminology XV
The Programming in Mathematica Web Site XVI
Teaching Mathematica Programming. XVI

1 Introduction
1.1 From Calculations to Programs 3
1.2 Basic Ingredients of a Package 8
1.3 A Second Function in the Package 12
1.4 Options . . . . . . . . . . 15
1.5 Defaults for Positional Arguments 21
1.6 Parameter Type Checking 25
2 Packages
2.1 Contexts . . . . . . . . . . . 31
2.2 Packages That Use Other Packages 36
2.3 Protection of Symbols in a Package 41
2.4 Package Framework and Documentation 45
2.5 Loading Packages 49
2.6 Large Projects. . . . . . . . . . . 58
3 Defaults and Options
3.1 Default Values . 63
3.2 Options for Your Functions . 67
3.3 Setting Options of Several Commands 74
4 Functional and Procedural Programming
4.1 Procedures and Local Variables 81
4.2 Loops . 83
4.3 Structured Iteration. . . . . 88
4.4 Iterated Function Application . 94
4.5 Map and Apply . . . . . . 103
4.6 Application: The Platonic Solids 107
4.7 Operations on Lists and Matrices 113

5 Evaluation
5.1 Evaluation of the Body of a Rule 123
5.2 Pure Functions . 130
x Contents

5.3 Nonstandard Evaluation . 135


5.4 Nonlocal Flow of Control 143
5.5 Definitions . . . . . . 146
5.6 Advanced Topic: Scopes of Names 153
6 Transformation Rules
6.1 Simplification Rules and Normal Forms 161
6.2 Application: Trigonometric Simplifications 166
6.3 Globally Defined Rules . . 173
6.4 Pattern Matching for Rules . 177
6.5 Traversing Expressions 185
7 Numerical Computations
7.1 Numbers . . . . . 191
7.2 Numerical Evaluation 197
7.3 Numeric Quantities. 203
7.4 Application: Differential Equations 208
8 Interaction with Built-in Rules
8.1 Modifying the Main Evaluation Loop 217
8.2 User-Defined Rules Take Precedence. 223
8.3 Modifying System Function . . . . 227
8.4 Advanced Topic: A New Mathematical Function 231
9 Input and Output
9.1 Input and Output Formatting . . . 239
9.2 Input from Files and Programs . . 243
9.3 Running Mathematica Unattended. 249
9.4 Session Logging . . . . . . . . 257
9.5 Advanced Topic: Typesetting Mathematics 264
10 Graphics Programming
10.1 Graphics Packages . 273
10.2 Animated Graphics. 277
10.3 The Chapter Pictures 282
11 Notebooks
11.1 Packages and Notebooks 289
11.2 The Structure of Notebooks 294
11.3 Frontend Programming . . 299
12 Application: Iterated Function Systems
12.1 Affine Maps . . . . . 311
12.2 Iterated Function Systems . . . . . 317
12.3 Examples of Invariant Sets . . . . . 327
12.4 Documentation: Help Notebooks and Manuals 331
Contents xi

Appendix A Exercises
A.I Programming Exercises 337
A.2 Solutions. . . . . . 339
Appendix B Bibliography
B.I Background Information and Further Reading 347
B.2 References . . . . . . . . . . . . . . 350
Index
Programs . . . 355
Subjects and Names 356
II About This Book

This section gives you hints and recommendations for benefitting the most from the material
in this book.

• Chapter Overview

Chapter 1 develops a package from scratch. It starts with a few simple interactive commands
and then explores ways to combine such commands into small programs. Along the way we
learn how to set up package contexts, define defaults for parameters of functions, and also
look at graphics. The example chosen comes from mathematics: functions of one complex
variable. You can follow the material even if you are not familiar with the mathematical
concepts.
In Chapter 2 we look at the theory of writing good packages. The concepts introduced
here are used throughout the rest of the book. Understanding why things should be done in
a certain way might be interesting on its own, but you can also learn to apply the concepts
in a cookbook-style way. A skeletal package is provided, which you can use as a template
for writing your own packages.
Chapter 3 looks at issues of pattern matching and defining options for your func-
tions. Default values for parameters and options can make commands much easier to use.
Mathematica itself makes heavy use of these features.
Chapter 4 looks at different programming styles possible in Mathematica. It is here
that the preferred functional style is explained. Understanding this chapter allows you to
write better programs.
Chapter 5 looks at some aspects of how expressions are evaluated. If you want to write
sophisticated rules and definition.s you need to know about these things. Otherwise, you
can skip this material and return to it later as needed.
In Chapter 6 we introduce mathematical programming, a way of expressing mathe-
matical relations and formulae that is unique to Mathematica. If your application requires
simplification and transformation of symbolic expressions, you should read this chapter.
Numerical computations are the topic of Chapter 7. It explains how numerical compu-
tations are done and what kind of numbers Mathematica supports. You should consult it
as needed.
Mathematica has built-in rules and procedures for performing certain transformations
automatically. Advanced applications may make it necessary to change these built-in rules
or add others. Chapter 8 explains how this can be done. You should have read Chapter 5
before studying the material in here.
Chapter 9 treats input and output. Mathematica interacts with the rest of your computer
system in many ways, and this chapter deals with this interface. A discussion of typesetting
mathematical expressions in the frontend is also contained in this chapter.
xiv About This Book

Chapter 10 is about graphics programming. It presents some graphic utilities and looks
at the package ParametricPlot3D.m and at animations of graphics.
Chapter 11 looks at notebooks, available with the frontend for Mathematica. It looks
at the relationship between notebooks and packages. If you use notebooks or if you want
to write programs that run on machines with or without the notebook interface, you should
read this chapter. The frontend is programmable; we show some useful applications of
frontend programming.
Chapter 12 presents a larger application, iterated function systems. These systems of
affine maps are one aspect of the study of chaos and dynamical systems. Their implemen-
tation in Mathematica poses a number of interesting programming problems.
Appendix A contains programming exercises and their solutions. Appendix B is an
annotated bibliography for further reading about the topics of this book, and it contains the
list of references.
Some sections are marked as "Applications." They introduce a programming example
that makes use of the concepts covered in the preceding sections. They are independent
of the rest of the text. Some sections are marked "Advanced Topic." They have a higher
level of difficulty than the rest of the book or require higher mathematics. They, too, are
optional. The sections "Changes from Earlier Editions" are intended for readers familiar
with earlier editions of this book. They explain some of the major changes introduced with
Version 3 of Mathematica.

• About the Examples

All examples were tested with Version 3 of Mathematica. The "live" calculation sequences
in this book were computed on a Sun SPARCstation 5 running SunOS 4.1.4. The examples
will not work with earlier versions of Mathematica. Those examples which interact with
the operating system of the computer on which Mathematica is running are, of course,
machine dependent and will look completely different on computers that do not run UNIX.
Listing init.m shows the commands that have been put into the initialization file init.m for
computing the examples in this book.
Some of the packages in this book depend on other packages. To read them into
Mathematica, you must have all of these imported packages available, too.
In the example Mathematica sessions in the later chapters, we generally no longer
show the command to read in the package that is the topic of the example. This com-
mand of the form «ProgramminglnMathematica 'Package' is assumed at the begin-
ning of every session that uses functions from the package in question. Even better
is Needs ["ProgramminglnMathematica 'Package' "] , which avoids loading a package
more than once.
Many examples developed in this book are now part of the standard Mathematica
packages. They can be found in subdirectories of AddOns/StandardPackages inside your
Mathematica installation. All remaining example programs and notebooks are part of the
Mathematica, Version 3, distribution from Wolfram Research. You can access them directly
About This Book xv

SetOptions["stdout", PageWidth->58] (* line width *)


Format[Continuation[_]] .= "" (* no blank lines *)
SeedRandom[10000] (* reproducible "random" numbers *)
Off[ General::spell, General::spel11 ]
SetOptions[ ParametricPlot3D, Axes -> None
Needs["ProgramminglnMathematica'Options''']
SetAllOptions[ ColorOutput -> GrayLevel ]
$DefaultFont = {"Times-Roman", g.O}
Began]." , Private' "]
Unprotect[Short]
Short [e_] := Short[e, 2] (* lines are very short *)
Protect [Short]
End[]
Null

init.m: Mathematica initialization for this book

from the Mathematica CD-ROM or install them onto your hard disk using the Mathematica
installer. They will be installed into the directory AddOns/ExtraPackages/Programming-
InMathematica. A list of all programs is shown on page 355.
If the ProgramminglnMathematica directory is installed in AddOns/ExtraPackages
the help browser of Mathematica may be unable to find the on-line help provided. In
this case you should move the directory to AddOnslApplications or put the directory Ad-
dOns/ExtraPackages on the help path using the frontend's option inspector (item Global
Options e- File Locations [> AddOnHelpPath).

• Notation and Terminology

A package is identified by a name (the context name, as we shall see), for example
ComplexMap. The files in which we store successive versions of this package will be
called CornplexMap1.m, CornplexMap2.m, and so on. The final version will then simply
be called ComplexMap.m. Much of the text in successive versions of the same package is
the same, and we do not generally reproduce it in full.
Mathematica input and output is typeset in typewriter-like style: Expand [ (x-ry) ,,9] .
Parts of such input that are not literal, but denote (meta-)variables, are typeset in italics:
f [var _] : = body. Functions or commands are referred to by their name followed by an
empty argument list, for example Expand. []. Listings of programs are delimited with
horizontal lines and usually have captions beneath them. Major listings, tables, and figures
are numbered by section. The numbers have the form c.s-n, where c is the chapter number,
s is the section number, and n is a consecutive number within a section.
Names of files containing programs are typeset in this boldface style: Parametric-
Plot3D.m. Genuine dialogue with Mathematica is set in two columns. The left column
About This Book

contains explanations and the right column contains the input and output, including graph-
ics. You should be familiar with these conventions from the Mathematica book.
In the programming examples, I have tried to follow a uniform style for the indentation
of lines in a definition. Because Mathematica allows you to write deeply nested expressions,
lines are often rather long and have to be broken up so as to fit on the printed page.
In most programming languages you can define procedures, subroutines, or functions.
In Mathematica, all of these are just another way of looking at definitions, commands of
the form f [x_] : = body. Often we also use the term global rule. These terms are used
interchangeably, depending on which point of view we want to emphasize in a particular
situation. Rules proper are expressions of the form lhs - > rhs or lhs : > rhs. A substitution
is an expression of the form expr /. rule .

• The Programming in Mathematica Web Site


The World Wide Web (WWW) site <http://'W'W'W.'Wolfram . com/Maeder/ProglnMath>
is a repository of information relating to this book. Among other things, you will find
errata, program updates, and links to further information of interest to readers of this book,
as well as an email address and feedback form for contacting the author. You can access
this information using any WWW browser, such as Netscape, Microsoft Internet Explorer,
or Mosaic.

• Teaching Mathematica Programming


Although not designed primarily as a textbook for classes about programming or the use
of Mathematica, this book can be used in advanced classes that want to give a thorough
introduction to Mathematica. Such a course should use computers and encourage students
to experiment. Programming projects selected from the background of the students (from
any science) are more valuable than artificial small (toy) programs, because they emphasize
the use of Mathematica as a tool for doing research in any area rather than as something to
learn for its own sake.
Chapter I of the Mathematica book should be treated first. The step-by-step example
in our Chapter 1 provides the motivation for learning good programming styIe. If time
permits, Chapter 2 should be treated in some detail, at least Section 2.1. The template
package Skeleton.m from Section 2.4 or the notebook Template.nb from Section 11.1 can
be used as a starting point for all programs the students develop themselves. Functional
programming is fundamental to good programming style and the first four sections of
Chapter 4 should be treated in detail. Depending on the applications in mind, Chapters 6,
7, or 8 should be looked at next. The rest of the book can be consulted as a reference
when needed. At this point in a course the emphasis should be put on developing larger
applications. Such courses have been developed even before Mathematica was available,
using a variety of other programs. They can easily be adapted to Mathematica. The
bibliography in Section B.l.3 gives some references.
200 7 Numerical Computations

We can call Nf ] ] directly. Note that the numbers are In[2]:= Nf[5]
not converted to approximate numbers. Out[2]= {5, 16}

Because numbers are not converted to approximate numbers if we call Nf [] direct-


ly, the first statement in the body of Nf [] should probably be nx = N] x , prec] or
nx = Nlx, prec + extra] , where extra is a guess of how much extra precision for inter-
mediate calculations is required. Thus, a typical outline for the numerical procedure Nf []
looks like this.

Nf[x_, prec_:$MachinePrecision] .=
Module[{nx = N[x, prec]},
(* numerical code goes here *)

A typical numerical procedure

• 7.2.4 Accuracy Control

As we saw in Section 7.2.3, built-in numerical methods typically provide the options
PrecisionGoal, AccuracyGoal, and WorkingPrecision. These options allow fine-
tuning their behavior in numerically critical applications. Let us see how we can add
these options to one of our own numerical methods, the functions defined in the package
Newton1.m from Section 4.4.2. The code described here is in the final package Newton.m.
Let us first turn to NewtonZero [], the main function in this package. The result of
NewtonZero [f, xo] is a number x so that f [x] is close to zero. We can use the value
of the option AccuracyGoal to determine how close to zero we should get. We have
achieved n digits of accuracy if Abs [f [x]] < 10. O"-n. Note that this interpretation
does not mean that x itself has necessarily an accuracy or precision of n. A precision
goal cannot be interpreted in this way, because zero has a precision of O. The default of
AccuracyGoal is Automatic; in this case, we set the accuracy goal to the precision of the
input (bounded below by machine precision, to guard against the case Xo = 0). The default
Automatic of WorkingPrecision translates to the accuracy goal plus a few extra digits
(unless the accuracy goal is smaller than machine precision; in this case we do not want to
perform any computations with arbitrary-precision numbers).
Having determined the working precision, we set the precision of Xo to this value, using
SetPrecision [] . There is one special case: if Xo is 0.0, SetPrecision [0.0, anything]
returns exact O. In this case, we use SetAc curacy [] to get an inexact zero. If the accuracy
of the initial value is smaller than the working precision, this command will increase it. In
most iterative processes, including Newton iteration, the accuracy (and even the value) of
the initial guess is unimportant. The new code of NewtonZero is shown in Listing 7.2-1.
Note that we treat the case where the accuracy goal is infinite specially. We do not need
to adjust any numerical settings, but we test the result for exact zero. The only change
required in NewtonFixedPoint is the treatment of the new options, in the same way that
356 #-Average Index

II Subjects and Names

Mathematica commands are listed in this index only if they are treated in some detail. On
the other hand, you will find here all the commands developed in our example packages.
These commands are not built in and are, therefore, not listed in the Mathematica book.
The main entry for a topic is set in boldface. For typographical conventions, see page xv.

# (Slot), 131 ArgShade,276


& (Function), 131, 181 Argument of complex number, 12,275
'(Derivative[1]),126,225 Arguments
-> (Rule), 157 default, 179
/. (ReplaceAll), 15,68 named, 24
/: (tag), 43, 173, 177 negative symbolic, 162
/ ; (Condition), 180 optional, 24
/~ (Map), 103 positional, 24
: (Optional), 21, 63 real-valued, 227
: (Pattern), 63 Arithmetic
:=(SetDelayed),77,157 rules for, 223
:>(RuleDelayed),157 with mathematical constants, 196
; (CompoundExpression),4,338 with numbers, 194
= (Set), 157 Array, 90
? (Information), 8 Assignments, 146
?(PatternTest),180 evaluation ofleft side, 151
~~(Apply), 72,106,141 multiple, 146
\!,270 parallel, 83
\ (,269 Atoms, 185
\),269 Attributes
___ (BlankNullSequence), 15, 141 Flat, 177
\ (context mark), 9, 32, 49, 54 of pure functions, 76, 132,314
3x + 1 problem, 251 HoldAll,87, 124, 135
HoldAllComplete, 132, 136
a conversion, 133 HoldFirst, 132, 136
Abs,227 HoldRest, 132
Accuracy, 192 interaction with pattern matching, 177
setting of, SetAccuracy, 195 Listable, 92, 114, 132,314
AccuracyGoal, 199 Locked, 42
Active, 299 NHoldFirst, 197
ADA, 347 NHoldRest, 197
Addition NumericFunction,203,233
machine number and exact number, 195 OneIdentity, 180
of approximate numbers, 194 Orderless, 177
AffineMap,311 Protected, 41
AlgExpQ,186 SequenceHold, 132, 141,222
Animate, 277 Stub, 52
Animation, 277-281, 306 Author, 46
AnimationFunction,277 AutoGeneratedPackage,291
$Animat ionFunct ion, 277, 306 Autoloading, 52
APL,88 Automatic, 22, 64, 200
AppendTo,254 Autonomous, 208
Apply, lOS, 141 Average, 105
Arg,275
Index ~ reduction - CylindricalPlot3D 357

~ reduction, 133 Collatz problem, 251, 348


Barnsley, Michael F., 329 ColorCircle,275
Batch-mode, 249 Coloring, 323
Begin, 31 $Columns,279
BeginPackage,10,31,58 Commands
Bessel function, 231, 240 from a file, 249
(animation), 281 frontend, 304
Binding notation of, xv
dynamic, 155 Complex, 191
static, 154 ComplexExpand,44
Binomial formula, 224, 337 Complexity, 150, 170,337
Bisection, 85 logarithmic, 171
Blank Composition, 178,312
multiple, 15, 141 Computations
name for, 63 approximate, 197
Block, 64, 155,204,228 infinite, 251
localizing a system variable, 156,219,277 large, 249
BoxData,296 numerical, 196
Boxes, 264, 299 power series expansion, 233
Break, 143 restarting, 253
Browser, 331 Condition,/;,180
BrowserCategory,331 Conjugate, 14
ButtonBox,267,299 Constants
ButtonData,299 local, 125, 154
ButtonEvaluator,299 mathematical, 196
ButtonFunction,299 Context, 9, 31-35, 46, 58
ButtonNote,299 current, 32
Buttons, 299 empty, 173
ButtonSource,299 global, 9, 32
ButtonStyle,299 importing the global, 51
Byte, 244 manipulation of, 31
package name from, 49
C,82 private, 9, 32
CartesianMap,6,337 Context, 41
Catalan, 196,203 $Context,31
Catch, 145 Context mark, \, 9, 49, 54
Cell, 296 $ContextPath,31,37
CellGroupData,297 ContextToFileName,49,54
Cells Contraction, 313
inactive, 292 Coordinate lines
initialization, 289 picture of, 4, 12
options of, 298 polar, 12
Changes from earlier editions, 38,45,52, 100, 117, 136, 145, transformation of, 3
196,207,228,259,294,299,331 Coordinates
Channel, 257 Cartesian, 39
Chaos Game, 322 polar, 12
ChaosGame,323 spherical, 39
Character, 244 Copyright, 46
Characters, 188 CopyTag,332
Chebyshev polynomials (picture), 139 Cosine function (picture), 7
Clipping, 18 Currying, 157
Close, 243 Curves, 6
CloseLog,258 in space, 39
Code, numerical, 197 plotting, 274
Collatz function (picture), 253 CylindricalPlot3D,51
358 CylindricalPlot3D - Example Index

D,92 Dual polyhedra, 109


Data types, 180 Dynamic binding, 155
Date and Time, 248
Debugging, 32,41, 71,107 E,196,203
of notebooks, 291 11 conversion, 134
DeclarePackage,52 $Echo, 250, 257
Decomposition of expressions, 185 Edges of polyhedra, 107
Default, 179 Edit, 138
Defaults, 21 Efficiency
computed, 21, 64 of recursion, 150
global, 179 of rewrite rules, 170
possible values of, 64 Electrical force field, 116
syntax of, 63 Encapsulation, 10
vs. options, 22 End,3l
Definitions, xvi, 81, 173 EndPackage, 10,31
immediate vs. delayed,99, 146 Equality
overriding built-in, 228 of expressions, 168
Degree, 196,203 of symbols, SameQ, 21
Delimiter, 332 Errors
0,337 in external operations, 243, 246
Delta function, 337 misleading, 25
Denominator, 191 while reading a package, 11
Denominator, 182, 191 EulerGamma, 196,203
Derivative, 126, 185,225 Evaluatable,42
Derivatives, 233 Evaluate, 19,43,73,137,138
of Abs, 227 Evaluation
of Sign, 227 forcing of arguments, 138
plotting of, 337 left side of assignment, 151
rules for, 225 main loop, 217
Differential equations, 208 numerical, 197, 233
Differentiation of arguments, 217
of division, 181
listability of, 92
of pure functions, 133
of powers, 179
of subtraction, 181
of pure functions, 127
on input from a file, 245
Digits, significant, 192
timing of, 135, 138,218,224
Dirac delta function, 337
Even
Dirty tricks, 52, 134, 151, 195,245,259,339 functions, 161
Discussion, 46 numbers, 251
DisplayFunction, 5,74 EvenQ, 162
$DisplayFunction, 277 Example, vi
Distribute,338 accuracy and precision of numbers, 192
Divergence, 115 algebraic expressions, 187
Divide, 182 arrays, 90
Divide and conquer, 170 Chebyshev polynomials, 138
Division, 182 computation with mathematical constants, 196
DO,83,155 constant pure functions, 132
Documentation, 10, 45 defining the sign function, 127
1,8 extracting parts of held expressions, 137
on-line, 331 fixed point iteration, 87
options, 69 fixed points of functions, 95
Dodecahedron (picture), 109 formatting of tensors, 241
Dot,US global defaults for patterns, 179
Downvalue, 223 how FilterOptions works, 71
DownValues, 151 how SwinnertonDyerP works, 119
Index Example - Functions 359

Integration and Differentiation, 168 File names, xv


Jacobian matrix, 117 conversion of, 291
loops, 83 from context names, 49
mapping functions, 103 FileName, 332
Newton's method, 98 FileNames, 50, 54, 59
reading from a file, 244 Files
regular polyhedra, 107 for input, 243
repeated application of rules, 166 master, 53
sequences, 141 names of, 243
shading a parametric surface, 274 of commands, 147
stellated polyhedra, 110 FilterOptions, 18, 70
tables, 89 Fixed points
use of options, 67 Golden Ratio, 87
user-defined options, 69 infinite loops, 95
vector calculus, 116 numerical precision, 200
vector multiplication, 115 ofIFS,318
Examples, 46 FixedPoint,95,319
Exercises, 337 Flat, 177
solutions of, 339 Floating-point numbers, 192
Expand, 34 Fold, 100--102
Expand, 173,217 Fold, 77, 100
Expansion, 166 FoldLeft, 101
of powers, 224 FoldRight, 101
of products, 223 For, 86
Explode, 188,337 For loop, avoiding the, 86
Exponential function (picture), 11, 72 Force field, 116
Exponents Format, 240
negative, 182 Format types, 239
optional, 179 Formatting
Expression, 244 of notebooks, 295
Expressions of output, 239
algebraic, 185 primitive operations for, 241
assigning values to, 146 rules for, 265-269
extracting parts of, 137 FormBox,269
for notebooks, 294 Fourier series, 238
formatting of, 239 Fractals, 216, 321, 354
looking at unevaluated, 151 Freezing, 137
normal form of, 161 $FrontEnd,304
ordering of, 163 Frontend, 289
printing of, 181 FrontEndExecute,300
syntax of, 185 FrontEndToken,306
testing for equality, 161 FuIIForm,63,151,239
types of for input, 244 FullGraphics,330
Extract, 137 Function, 130, 153
Functions, xvi, 81
Faces, 107 that define functions, 127
Faceting of polyhedra, 109 animation, 277
Features applying to lists of arguments, 105
attributes of short pure functions, 132 associative, 102, 177
conditions and local variables, 341 built-in, 8, 231
input prompts in output, 258 commutative, 177
new, 38,45,52, 100, 117, 136, 145,196,207,228,259,294, currying of, 157
299,331 differentiation of, 126
Fern (picture), 310 fixed points of, 96
Fibonacci numbers, 83, 337 iterated application of, 94
360 Functions - Jacobian matrix Index

Functions (cont.) I, 3, 191


listable, 92 i, I, 3
local, 33 Icosahedron
mapping at particular positions, 104 picture of, 109
mapping over lists, 91,103 stellated, 111
mathematical, 3, 231 Identity, 3
names for, 130 picture of, 23
numerical, 200 Identity,S
odd and even, 161 IFS, 317-326
of complex variables, 3 Im, 182, 191,227
plotting of, 3, 138 Imaginary part, 191
powers of trigonometric, 167 Implementation, ]0
preventing evaluation of arguments of, 135 Import, 36, 59
pure, 130 multiple, 38
series expansion of, 232 In, 259
simplification of arguments, 161 Index
that return functions, 125 packages, 355
variables in pure, 154 subjects and names, 356-366
zeroes of, 95 Indices, upper and lower, 241, 267
Inheritance, 36
r function, 234 Initialization, 53
picture of, 26 init.m, 34, 262
Get, 49 InitializationCell,289,291
GetNumber, 144 Inner, 115
Golden Ratio, 87 Input, 243
GoldenRatio,196,203 from files, 249
Gradient, 116 from programs, 246
Grammar, 185 high-level, 247
Graphics prompting for, 144
commands for book pictures, 147 recording of, 257
evaluating first argument of Plot, 138 $Input,55
randomness in, 122 InputForm, 218,239, 251
shading of surfaces in parametric plots, 273 Installation, xv, 58, 333
speeding up parametric plots, 139 Integrals, 233
GraphicsArray,279 NDSolve,212
Gravitational force field, 116 numerical, 208
GrayLevel,275 of Abs, 227
Great dodecahedron (picture), 111 of Sign, 227
Great stellated dodecahedron (picture), 112 Interface, 10
GridBox, 267, 302 Intern, 188
Groups, 297 Interpretation rules, 269-270
open and closed, 303 Inversion (picture), 14, 20
Item, 332
Headers, 45
Iterations, 83-84
HelpDirectoryListing,332
conditional, 84
Hexagon, 327
convergence of, 95
History, 46
of affine maps, see IFS
in kernel, 292
of functions, 98
Hold, 135,245
Iterators
HoldAII, 19,73,87,124,135
for animation, 277
HoldAIIComplete, 132, 136,269
HoldComplete, 136 in ParametricPlot3D, 273
use of structured, 91
HoldFirst, 132, 136
HoldPattern, 151
HoldRest, 132, 136 Jacobian matrix, 116
Hyperlinks,301
Index Kemel- Numbers 361

Kernel, 289 Maps


Keywords, 46 affine, 311
Killing the kernel, 251 complex, 3
MapThread, 114
A-calculus, 133,347 Mathematica manual, vii
Lambda expression, 347 Matrices, 164
Language, 185 MatrixTrace,114
defining your own, 185 $MaxExtraPrecision,197,204
recognizing a, 186 $MaxPrecision,202
Laplacian, 116 Mean, arithmetic, 105
let, 125 Minimal surface, 30, 346
Lexical scoping, 154 MODULA-2,347
Limitations, 46 modularization, 347
LinearFunction, 128 Module, 6, 8,82, 153
Lines, 15 Multiplication, of approximate numbers, 194
$Lines, 75 MyReadList,247,337
Lines, width of, 337 Mystery, 276
LISP, 88, 125,347 Mobius transform (picture), 2, 66
List plot
multiple, 255 N, 25, 197,217
preparing data for, 113 NDSolve,212
Listability, 92, 210 Needs, 36,49, 173,291
Listable, 92, 114, 132, 314 Negative, 227
Lists, 89 Nest, 94, 98, 320
Li teral, see HoldPattern NestList,98,322
Local Newton's formula, 94
constants, 125, 154 NewtonFixedPoint,96
functions, 148 NewtonZero, 96, 200
variables, 82, 153 NHoldFirst, 197
Locked, 42 NHoldRest, 197
Logarithm (picture), 14 Normal form, 161
Loop, main, 217 for odd and even functions, 163
Loops, 83 Notation, xv
better alternatives for, 88 Notebook, 294
escaping from, 144 NotebookLog,259
evaluation of arguments, 87 Notebooks, 148,294-298
fixed points of, 95 as packages, 289
for input, 243 for on-line help, 331
infinite, 170, 251 options of, 298
without loop variable, 83 NSum, 198
Lorenz equation, 210 Number, 244
NumberForm,218
MakeBoxes,265 NumberQ,25
MakeExpression,269 Numbers, 191
makeHyperlink,301 approximate, 192
MakeMaster,53 argument of complex, 12,275
MakeRuleConditional, 128 arithmetic with, 194
Manual, for Mathematica, vii complex, 3, 182, 191
Map, 103,224 complex (approximate), 193
MapAt, 104 conversion to approximate, N, 197
MapIndexed, 104 exact, 203
Mapping Fibonacci, see Fibonacci
at particular positions, 104 precision of exact, 193
generalized, Apply, 105 rational, 182, 191
of functions, 103 reading from a file, 244
362 Numbers - Pictures Index

Numbers (cont.) reading in twice, 41


test for, 25 template for, 45
zero, 193 testing, 11
Numerator, 191 tiny, 34
Numerator, 182, 191 $Packages,37
Numerical Analysis, 347 Parabola (picture), 39
NumericFunction, 203, 233 Parameters
NumericQ,25,203 named, 24
optional, 24
Oak tree (picture), 329 positional, 24
Odd type checking of, 25
functions, 161 ParametricPlot3D,39,273
numbers, 251 Parentheses
OddEvenRules, 162, 164 in typeset expressions, 265
OddQ, 162 necessary, 127
On,49 Parser, 185
Oneldentity, 180 Part, 109
OpenLog,258 Parts
OpenRead,243 of complex numbers, 3
OptionQ,26,68,77 of expressions, 109, 137
Options, 15-20,67-73 $Path, 50, 58
common defaults, 74 $PathnameSeparator,49
common to several commands, 74 Pattern matching
defining your own, 67 attributes in, 177
documenting, 69 conditional, 180
filtering of, 70 for cells, 297
for built-in functions, 67 for complex numbers, 182, 191
getting current values of, 68 for division, 182
of cells, 298 for rational numbers, 182, 191, 232
of notebooks, 298 for subtraction, 181
passing to another function, 70 Patterns
vs. defaults, 22 for arithmetic operations, 182
Options, 67 for mathematical formulae, 177
OrderedQ, 163 for negative expressions, 163
Ordering, of expressions, 163 for numbers, 182
Orderless, 177 names used as local variables, 124
Oscillator, 211 predicates in, 180
Out, 217, 338 problems with in assignments, 151
Output tests in, ?, 180
formatting of, 239 vs. local variable, 65, 123
recording of, 257 Perlormance, 139, 173,224,234,276
$Output,257 Phase-space plot, 190
OutputForm,239 Pi, 196,203
Pictures
It,196,203 Bessel function, 281
Packages Chebyshev polynomials, 139
developing, 3,45,291 code for chapter openers, 282
extending, 38 Collatz function, 253
from contexts, 49 coordinate lines, 4, 12
from notebooks, 291 cosine function, 7
hidden import, 37 curve on sphere, 39
import of, 36 dodecahedron, 109
index of, 355 exponential function, II
master, 53 fern, 310
reading in, 31, 52 fractal tile, 216
Index Pictures - Pure functions 363

r function, 26 Powers
great dodecahedron, 111 expansion of, 166,224,337
great stellated dodecahedron, 112 negative, 182
hyperbolic sine, 75 PowerSum, 10
icosahedron, 109 $Pre, 217, 219
identity, 23 Pre-evaluation, 217
inversion, 14,20 Precision, 192
logarithm, 14 in numerical procedures, 199
minimal surface, 30, 346 increase of, 96, 195
Mobius transform, 2, 66 machine, 193
oak tree, 329 setting of, SetPrecision, 195
random walk, 336 Predicates
saddle surface, 160,274,275 for a language, 186
saw-tooth curve, 238 in patterns, 180
Sierpiriski gasket, 321, 324 pure functions as, 181
Sierpiriski sponge, 354 $PrePrint, 217, 251
sign function, 128 Prime number theorem, 84
sine function, 5, 276 PrimePi,84
small stellated dodecahedron, 112 primePi,84
sphere, 122,275 Print forms, 240
spherical harmonic, 140 Printing expressions, 181
spiral staircase, 288 PrintTime,135,217,218
square root, 18 Priority
Struve function, 235 of &, 131, 181
in typeset expressions, 265
tetrahedron, 108
of And and Or, 26
Van der Pol equation, 190
Probabilities, 323
Sfunction, 16 Probabilities, cumulative, 100, 322
Placeholder, 300
Procedures, xvi, 81
Platonic solids, 107
auxiliary, 33
Plot3D,273
numerical, 198
PlotLegend, 229 Product, 88, 155
Plots Products, 88
functions of complex variables, 3 expansion of, 166, 223
of several functions, 229 inner, 115
parametric, 39, 273 outer, 116
utilities for, 275 Programming
PlotStyle, 323 bad style, 34, 91
Point, 313 dynamic, 147, 150
Point, decimal, 192 efficient, 139, 173, 224, 234, 253, 276
PolarMap, 337 functional, 91, 347
Polygon, 107 functional in numerical codes, 210
Polyhedra good style, vi, 88, 92
description of, 107 mathematical, 88
regular, 107 numerical, 233
symbolic manipulation of, 109 object-oriented, 36, 347
Polyhedron, 107 procedural, 88, 347
Polynomials system, 279
normal form for, 161 Prompts, 258
Swinnerton-Dyer, 118, 150 Protect, 41
Position, 101, 104 Protected, 41
Position, in mapping, 104 PSDirect.m, 277
Positive, 227 Pure functions, 130,347
$Post,217,259 as predicates, 181
Post-evaluation, 217 constant, 132
364 Pure functions - Sorting Index

Pure functions (cont.) Saddle surface (picture), 160,274,275


differentiation of, 97 SameQ,22
how they are applied to arguments, 133 Saw-tooth curve (picture), 238
name of variable in, 133 Scan, 77
short forms of, 131 SCHEME, 347
special forms of, 134 Scoping, 153-158
Pyramids, 110 Searching, 143
Section style, 303
Random walk (picture), 336 Self-similarity, 327
RandomDistributed, 101 Semantics
RasterFunction,277 of assignments, 146, 151
$RasterFunction, 277, 306 of pure functions, 133
Rational, 191 substitution, 64, 123
Rational numbers, see Numbers, rational unevaluated arguments, 135
Re,42, 182, 191,227 Sequence, 71,137,141,222,241
Read, 243,244 SequenceForm,241
Reading SequenceHold, 132, 141,222
packages, «,247 Series, 232
without evaluation, 245 Session logging, 257
ReadList,247,337 automatic, 262
ReadLoop,243 Set, 146
Real, 244 SetAccuracy, 195
Real part, 191 SetAllOptions, 75
$RecursionLimit,184 SetAttributes,42
Reference Guide, vii SetDelayed, 146
Reference, call by, 82 SetDirectory,50
References, in packages, 45, 289 SetOptions,15,67,239
ReleaseHold, 137 SetPrecision,195,200
Remove, 51 Sets, invariant, 318
Replace, 260 Shading, of surface in parametric plot, 272
Replacement, 68 Shadowing of symbols, 51
Requirements, 46 Share, 217
ResetDirectory,50 Short, 218
RGBColor,275 Show, 5,277
RKSolve, 209, 211 ShowAnimation,277
RKStep,209 ShowTime,218,338
RotateShape,36 Sierpiriski gasket (picture), 321, 324
RowBox,265 Sierpiriski sponge, 348
Rules, 177 picture of, 354
evaluation of body of, 123 Sign, 227
for a grammar, 186 Sign function (picture), 128
for arithmetic operations, 223 Signature, 175
for derivatives, 225 Simplification
for numerical procedures, 199 automatic, 173
for print forms, 240 into normal form, 161
for simplification of expressions, 161 of negative arguments, 163
global, xvi, 173 trigonometric, 166-171
instead of defaults, 65 SIMULA,347
for options, 15 hyperbolic sine (picture), 75
order of application of, 223 Sine function (picture), 5, 276
ordering of, 66 Skeleton, 45, 244, 289
for powers, 167 Slot, #,131
run time of, 170
Small stellated dodecahedron (picture), 112
Runge-Kutta method, 208
SMALLTALK-80, 347
Sorting, 175
Index Sources - TrigArgument 365

Sources, 46 Swinnerton-Dyer polynomials, 118, 150


Sphere (picture), 122,275 SwinnertonDyerP, 119, 151
Spherical harmonics Symbol table, 9
evaluation of, 139 Symbols, 32
picture of, 140 as commands, 147
SphericalCurve,39 attaching rules to, TagSet, 173
Spiral (fractal) (picture), 80 hiding of, 51
Spiral staircase (picture), 288 local, 153
Splicing of sequences, 141 problems with, 51
Square root (picture), 18 protection of, 41
SquareList,9l stub, 52, 59
StandardForm,268 unprotected, 43
Static binding, 154 unprotecting, 42
Stellate, 110 Symmetry, 164, 175
Stellation of polyhedra, 109 Syntax, 185
Step function, 127 of defaults, 63
Step size, 209 System programming, 218, 279
StepFunction, 127, 128
Strange attractor, 210 Table, 89, 155
Streams, 257 TableForm,89
String, 244 Tables, compared to arrays, 90
StringReplace,54 Tags, 332
Structure TagSet,223
of expressions, 185 Template, 45, 289
of typeset expressions, 264 Tensor, 241
Struve function, 231, 268 Tensors, 164,241,337
picture of, 235 Terminology, xv
StruveH,231 Tetrahedron (picture), 108
Stub, 52 TEX, 242, 265, 337
StyleBox,296 TeXForm,337
Styles TextData,296
for buttons, 300 Thread, 114, 134
of cells, 298 Through, 315
Subcontext, 10 Throw, 145
Subroutines, xvi Thurston, Bill, 216
Subscripted, 241 Tile, fractal, 327
Substitution, 133 picture of, 216
/.,15,68 Timing
in body of rule, 127 invisible, 218
semantics of, 134, 158 of evaluation, 135, 138,218,224
using With, 134 Timing, 135
Subtle point, 164, 176,218,225,246,259,314 Title, 46
Subtract, 181 ToBoxes, 260, 264
Subtraction, patterns for, 181 ToExpression,76,188,264
Subvalue, 225 ToFileName,332
Sum, 88, 155 Together, 217
Summary, 46 Token, 64
Summation, 88 $TopDirectory, 301, 332
numerical, 234 ToString, 188
Sums Tracing nested function calls, 107
numerical evaluation of, 198 TraditionalForm,268
prefix, 100 Transcript of session, 259
Surfaces Transpose, 113
minimal, 30, 346 Transposition, 113-114
parametric, 62, 274 TrigArgument, 169
366 TrigExpand - Zero Index

TrigExpand, 170 global,74


TrigLinear, 167 initialized, 123
trigLinearRules, 166 local, 33, 65, 82, 123, 153
Trigonometry, 166-171 localizing in a block, 155,219
TrigReduce, 169 meta, xv
Type checking, 25 problems with local, 8
Typesetting, 264-270 renaming of in pure functions, 133
Typewriter style, xv simplification of real, 44
Typo,25 system, 156,219,277
Vector calculus, 115
Unevaluated, 137, 140, 176, 184,223 Version numbers, 46
UNIX, 249 Vertices, 107
UnixDate, 246,248 Vertices of polyhedra, 107
Unprotect,41
UnsameQ, 176 Warnings, 46
Until,86 While, 84,243
Upvalue, 43, 223 Wildcards, 41
usage, 10 With,6, 125, 126, 129, 134, 150, 153, 154
Wolfram Research, Inc., xiv, 111
Value, call by, 82 Word,244
Values WorkingPrecision, 199
assigning to expressions, 146 WrapHold, 137
local, 155, 157
numeric, 203 X Windows, 277
Van der Pol equation (picture), 190
Vandermonde matrix, 89 Y,366
Variables
declaring as real, 42 ~ function (picture), 16
default in pure functions, 131 Zero, 193

You might also like