a field-theory motivated approach to computer algebra

# Input format

## Mathematical expressions

The input format of Cadabra is closely related to the notation used by LaTeX to denote tensorial expressions. That is, one can use not only bracketed notation to denote child objects, like in
object[child,child]

but also the usual sub- and superscript notation like
object^{child child}_{child}

One can use backslashes in the names of objects as well, just as in LaTeX. All of the symbols that one enters this way are considered "passive", that is, they will go into the expression tree just like one has entered them.
Expressions are entered by using the ':=' operator, as in
ex:=A+B+C_{m} C^{m};
$$\displaystyle{}A+B+C_{m} C^{m}$$
A + B + C_{m} C^{m}
Expressions (the 'ex' above) are ordinary Python objects (of type cadabra2.Ex), and their names can thus only contain normal alphanumeric symbols.
type(ex);
<class 'cadabra2.Ex'>
Lines always have to be terminated with either a ";" or a ":". These delimiting symbols act in the same way as in Maple: the second form suppresses the output of the entered expression. Long expressions can, because of these delimiters, be spread over many subsequent input lines. Any line starting with a "\#" sign is considered to be a comment (even when it appears within a multi-line expression). Comments are always ignored completely (they do not end up in the expression tree.
When entering maths as above (using the ':=' assignment operator) you do not need to indicate that the right-hand side is mathematics. There are situations, however, when you do need to give Cadabra a hint that what you type is maths, not Python. In this case, you add dollar symbols, just as in LaTeX,
substitute($A + B + C$, $C -> D$);
$$\displaystyle{}A+B+D$$
A + B + D
As you can see, this uses an 'inline' definition of a mathematical expression, without giving it a name.

## Algorithms

Algorithms are ordinary Python functions, which act on cadabra2.Ex objects.