The Mathematica Language
In addition to having a large number of built-in functions, Mathematica TE also includes a full programming language, which allows you to add your own extensions to the system.
Mathematica TE is a high-level programming language, in which you can write programs, both large and small. The fact that Mathematica TE is an interactive system means that you can run your programs as soon as you have typed them in.
Example: Define a function to generate a list of primes.
This defines a function f, which makes a list of the first n
prime numbers.
In[8]:= f[n_] := Table[Prime[i], {i, n}]
You can immediately ask for the first dozen prime numbers.
In[9]:= f[12]
Out[9]= 
Mathematica TE programs can make use of the symbolic aspects of Mathematica TE. They can create and manipulate arbitrary symbolic data structures. Mathematica TE programs themselves are also symbolic expressions, and can be combined and manipulated using standard Mathematica TE operations.
Mathematica TE supports several programming styles, including:
Procedural programming, with block structure, conditionals, iteration and recursion.
Functional programming, with pure functions, functional operators and program-structure operations.
Rule-based programming, with pattern matching and object orientation.
Fundamental to much of Mathematica TE is the notion of transformation rules, which specify how symbolic expressions of one form should be transformed into expressions of another form. Transformations are a very general and natural way to represent many kinds of information, particularly mathematical relations.
Using transformation rules you can, for example, transcribe almost directly into Mathematica TE the kind of material that appears in tables of mathematical formulas.
Example: Define your own logarithm function in Mathematica.