文档介绍:MathematicaÒ programming: an
advanced introduction
Leonid Shifrin
Part I: The core language
Version
2
3
To my parents
4
Contents
Preface.......................................................................................18
I. Introduction..............................................................................26
First principle: everything is an expression................................................................26
Atoms and the built-in AtomQ predicate......................................................................26
Mathematica normal (composite) expressions............................................................26
Literal equivalents of built-in functions, and mand................................26
. All normal expressions are trees - mand............................................ .27
. Heads of expressions and the mand...........................................................27
Accessing individual parts of expressions through indexing ......................................28
Levels of expressions and the mand...........................................................28
Second principle: pattern-matching and rule substitution...........................................30
Rewrite Rules..............................................................................................................30
An example of a simple pattern-defined function........................................................30
Functions are really rules : mand....................................................31
Example of a function based on a restricted pattern...................................................31
A bit about evaluation..................................................................................................31
Patterns allow for multiple definitions of the same function.........