# Wolfram Mathematica

Implementation of programming language Wolfram Mathematica

The official (and the only) implementation of Mathematica, develoed by Wolfram Research. First released in 1988. It is proprietary, the cost of the license depends on the intended usage.

The system is written in Mathematica itself and partly in C (for speeding up time-consuming computations). It consists of two main parts — the kernel which interprets expressions and performs the computations and front-end. The standard front-end is a Notebook user interface which allows to create programs (possibly free-form which is later converted into code), debug them, format them, insert GUI elements, images etc. Two alternate front-ends exist: Wolfram Workbench (Eclipse-based IDE) and command line.

## Examples:

### Factorial:

Example for versions Wolfram Mathematica 8.0.4

This example uses recursive factorial definition. The first line defines `Fact` function. Note that the names of function arguments must have an underscore `_` appended to them.

``````Fact[n_] := If[n == 0, 1, Fact[n - 1]*n];
For[i = 0, i <= 16, i++, Print[i, "! = ", Fact[i]]];
``````

Example for versions Wolfram Mathematica 8.0.4

After accepting user input we define variable `y` which is a quadratic equation with the given coefficients. Since `x` is not defined yet, it stays a variable — for example, `Print[y]` will output the notation of the equation `c + b x + a x^2` (with c, b and a replaced with values entered by the user). `Reduce` calculates the values of the variables which satisfy the condition “equation value equals zero”.

``````a = Input["Input a", 0];
b = Input["Input b", 0];
c = Input["Input c", 0];
y = a*x^2 + b*x + c;
Print[Reduce[y == 0]];
``````

### Hello, World!:

Example for versions Mathics 0.5, Wolfram Mathematica 8.0.4

Evaluation of this expression results in a string “Hello, World!” itself; since it is not followed by a semicolon, it will be printed as a separate `Out`, which is not always convenient.

``````"Hello, World!"
``````

### Hello, World!:

Example for versions Mathics 0.5, Wolfram Mathematica 8.0.4

`Print` function outputs its argument(s) to the main output stream. Streams can nest, so for convenience it’s recommended to to use a single stream for all output throughout the program.

``````Print["Hello, World!"];
``````

### Factorial:

Example for versions Mathics 0.5, Wolfram Mathematica 8.0.4

This example uses built-in factorial function `!`.
`Do` is one of the ways to run a loop — it evaluates its first argument for a sequence of numbers defined by the second argument. In this case it’s all values of `i` from 0 to 16, inclusive, with step of 1.

``````Do[Print[i, "! = ", i!] , {i, 0, 16, 1}]
``````

### Fibonacci numbers:

Example for versions Mathics 0.5, Wolfram Mathematica 8.0.4

`Print` always outputs a newline after the output, so to prints the numbers in a single line, one has to accumulate them into a string and print it. `<>` is concatenation operator, it works only on strings, so the result of `Fibonacci` call must be converted to string explicitly using `ToString` function.

``````msg = "";
Do[msg = msg <> ToString[Fibonacci[i]] <> ", " , {i, 16} ];
Print[msg, "..."];
``````