Basic calculations

Mathics can be used to calculate basic stuff:

To submit a command to Mathics, press Shift+Return in the Web interface or Return in the console interface. The result will be printed in a new line below your query.

Mathics understands all basic arithmetic operators and applies the usual operator precedence. Use parentheses when needed:

The multiplication can be omitted:

Powers can be entered using ^:

Integer divisions yield rational numbers:

To convert the result to a floating point number, apply the function N:

As you can see, functions are applied using square braces [ and ], in contrast to the common notation of ( and ). At first hand, this might seem strange, but this distinction between function application and precedence change is necessary to allow some general syntax structures, as you will see later.

Mathics provides many common mathematical functions and constants, e.g.:

When entering floating point numbers in your query, Mathics will perform a numerical evaluation and present a numerical result, pretty much like if you had applied N.

Of course, Mathics has complex numbers:

Abs calculates absolute values:

Mathics can operate with pretty huge numbers:

(! denotes the factorial function.) The precision of numerical evaluation can be set:

Division by zero is forbidden:

Other expressions involving Infinity are evaluated:

In contrast to combinatorial belief, 0^0 is undefined:

The result of the previous query to Mathics can be accessed by %: