Mathematica is a computer program used widely in scientific, engineering and mathematical fields. It is mainly known as a computer algebra system, but it has various other features for technical computing. It was originally conceived by Stephen Wolfram and developed by a team of mathematicians and programmers that he assembled and led. It is developed by Wolfram Research of Champaign, Illinois.
Mathematica is split into two parts, the "kernel" and the "front end". The kernel interprets expressions (Mathematica code) and returns result expressions. The Front End provides a document-centered GUI.
Documents can be structured using a hierarchy of cells, which allow for outlining and sectioning of a document and support automatic numbering index creation. Documents can be presented a slide show environment for presentations. Starting with version 3.0 of the software, notebooks and their contents are represented as Mathematica expressions that can be created, modified or analysed by Mathematica programs. This allows conversion to other formats such as TeX or XML.
The Mathematica Front End includes development tools such as a debugger, input completion and automatic syntax coloring.
The kernel and the front end communicate via the MathLink protocol. It is possible to use the kernel on one computer and the front end on another.
The standard Mathematica front end is used by default, but alternative front ends are available:
Version 5.2 (2005) added automatic multi-threading when computations are performed on modern multi-core computers. This release included CPU specific optimized libraries. In addition Mathematica is supported by third party specialist acceleration hardware such as ClearSpeed.
In 2002 gridMathematica was introduced to allow user level parallel programming on heterogeneous clusters and multiprocessor systems and supports grid technology such as the Microsoft Compute Cluster Server.
Using .NET/Link, a .NET program can ask Mathematica to perform computations; likewise, a Mathematica program can load .NET classes, manipulate .NET objects and perform method calls. This makes it possible to build .NET graphical user interfaces from within Mathematica. Similar functionality is achieved with J/Link, but with Java programs instead of .NET programs.
Communication with SQL databases is achieved through built-in support for JDBC..
Mathematica can also install web services from a WSDL description.
Out[1]= 0
So the determinant of such a matrix is 0 (i.e. it is singular).
The following numerically calculates the root of the equation ex = x2 + 2, starting at the point x = -1.
In[2]:= FindRoot[Exp[x] == x^2 + 2, {x, -1}] Out[2]= {x -> 1.3190736768573652}
Mathematica can do integral and differential calculus, in particular evaluation of integrals in terms of special functions. For example:
In[3]:= Integrate[x/Sin[x], x]//OutputForm
Out[3]= x (Log[1 - EI x] - Log[1 + EI x]) + I (PolyLog[2, -EI x] - PolyLog[2, EI x])
Here, E and I are the fundamental constants e and i respectively, and PolyLog[s,z] is the polylogarithm function .
Symbolic sums can be calculated. For example:
In[4]:= Sum[z^k/k^s, {k, 1, Infinity}]
Out[4]= PolyLog[s, z]
The most concise approach is to use one of the many specialized functions:
In[3]:= Array[GCD, {5, 5}] Out[3]= {{1, 1, 1, 1, 1}, {1, 2, 1, 2, 1}, {1, 1, 3, 1, 1}, {1, 2, 1, 4, 1}, {1, 1, 1, 1, 5}}
There are at least three other approaches to this: In[4]:= Table[GCD[x, y], {x, 1, 5}, {y, 1, 5}] Out[4]= {{1, 1, 1, 1, 1}, {1, 2, 1, 2, 1}, {1, 1, 3, 1, 1}, {1, 2, 1, 4, 1}, {1, 1, 1, 1, 5}}
An APL-style approach:
In[5]:= Outer[GCD, Range[5], Range[5]]Out[5]= {{1, 1, 1, 1, 1}, {1, 2, 1, 2, 1}, {1, 1, 3, 1, 1}, {1, 2, 1, 4, 1}, {1, 1, 1, 1, 5}} Outer corresponds to the generalized outer product operator, Range corresponds to the iota operator. Outer admits general functions, whether they be named, or anonymous. Anonymous functions are specified by using #n to as the function argument and appending an &. The above function could be equivalently specified as Outer[GCD[#1, #2] &, Range[5], Range[5]].
An approach using loops: In[6]:= l1 = {}; (* initialize as empty list, since we want a list in the end *) Do[l2 = {}; Do[l2 = Append[l2, GCD[i, j]], {j, 1, 5}];
l1 = Append[l1, l2], (* append the sublist, that is, the row *){i, 1, 5}]
In[7]:= l1Out[7]= {{1, 1, 1, 1, 1}, {1, 2, 1, 2, 1}, {1, 1, 3, 1, 1}, {1, 2, 1, 4, 1}, {1, 1, 1, 1, 5}} Note that this solution is considerably larger than the previous ones.
In[8]:= x^4 + 1
Out[8]= 1+x4
If the FullForm command is used on this expression however:
In[9]:= FullForm[x^4 + 1]
Out[9]= Plus[1, Power[x, 4]]
All objects in Mathematica, except atomic ones such as symbols, numbers, and strings, have the basic form head[e1, e2, ...] (which may be displayed or entered in some other fashion). For example, the head of the above expression is Plus. Lists have this structure too, where the head is List, and the elements are e1, e2, etc. The concept of head is defined for atomic objects as well (Symbol for symbols, Integer for whole numbers, etc.), but they have no extractable subparts.
The principle permits ordinary expressions unrelated to lists to be operated on with list operators:
In[10]:= Expand[(Cos[x] + 2 Log[x^11])/13][[2, 1]]
Out[10]= 2/13The reverse can also occur -- lists can be modified to behave like ordinary expressions: In[11]:= Map[Apply[Log, #] &, {{2, x}, {3, x}, {4, x}}] Out[11]= {Log[x]/Log[2], Log[x]/Log[3], Log[x]/Log[4]} where the Apply function changes the head of its second argument to that of the first, and Map behaves like the map function found in many functional languages. Note that Log[b,x] is the base b logarithm, which is converted to Log[x]/Log[b] on input.
Because of this equivalence between a regular mathematical object represented in Mathematica to that of a simple list structure, some built-in Mathematica functions permit threading, where functions map themselves over lists without much further specification. Indeed, Apply threads itself over lists when invoked as In[12]:= Apply[Log, {{2,x}, {3,x}, {4,x}}, 1] Out[12]= {Log[x]/Log[2], Log[x]/Log[3], Log[x]/Log[4]} where the third argument being a 1 specifies that Apply replaces the heads of its argument only at the first level in the list, which is what we want, and is equivalent to the above example.
When writing a large piece of code ("Module"), variables references are by default global rather than local and must be declared at the top rather than inline.
A regular single-user license for Mathematica 6.0 includes one year of service which includes updates, technical support, a home use license, a webMathematica Amateur license, and a Wolfram Workbench license. Discounts are available for government, charity, educational, pre-college, school, student and retiree use and depend on geographical region. Educational site licenses allow use by students at home. A license manager similar to Flexlm is available to provide efficient sharing of licenses within a group.
Wolfram Research has released the following versions of Mathematica: