Expressions can be grouped into lists with an arbitrary structure. Important special cases are scalar, vector, and tensor expressions.

Vector expressions
Expr v = List(vx, vy, vz);

Heterogeneous lists
Expr v = List(vx, vy, vz);
Expr q = new TestFunction(new Lagrange(1));
Expr state = List(v, q);

Use Expr::size() to find the number of elements at the top level (i.e., first index).
Expr v = List(vx, vy, vz);
Expr q = new TestFunction(new Lagrange(1));
Expr state = List(v, q);
int stateSize = state.size();

Use Expr::totalSize() to find the total number of elements in a list
int totalSize = state.totalSize();
Arithmetic operations are implemented using overloaded operators

Addition The operands must have identical list structures; otherwise, a runtime error is thrown.

Subtraction The operands must have identical list structures; otherwise, a runtime error is thrown.

Multiplication The operands must have list structures such that the product can be interpreted as a scalarvector product or as an inner product between vectors or tensors; otherwise, a runtime error is thrown. The multiplication operator is also used to represent the application of a differential operator.

Division The denominator must be scalarvalued; otherwise, a runtime error is thrown.
Arithmetic operations are implemented using overloaded operators
The userlevel expression subtypes are listed below, along with examples of their use.

UnknownFunction  Represents an unknown function in a finiteelement problem. Unknown function ctors have one mandatory and one optional argument: a BasisFamily (mandatory) and a string name (optional). The name is used only for making diagnostic output more readable and has no effect on calculations. If the name argument is not given, an arbitrary function name will be picked.
Unknown functions can be scalarvalued or vector valued. To create a vectorvalued unknown function, construct with a vectorvalued BasisFamily.
Example of creation of a scalarvalued unknown function:
Expr u = new UnknownFunction(new Lagrange(1));
Example of creation of a vectorvalued unknown function:
Expr u = new UnknownFunction(List(new Lagrange(1), new Lagrange(1)));

TestFunction  Represents a test function in a finiteelement problem. Constructor arguments are identical to those for UnknownFunction.
Example of creation of a scalarvalued test function:
Expr v = new TestFunction(new Lagrange(1));
Example of creation of a vectorvalued test function:
Expr u = new TestFunction(List(new Lagrange(1), new Lagrange(1)));

Derivative  Represents a spatial derivative operator. The constructor takes an integer argument to specify the direction of partial differentiation. Spatial derivatives are applied using the multiplication operator.
Expr dx = new Derivative(0);
Expr convect = (u*dx)*u;
Derivative expressions are scalar valued. However, vector differential operators can be created using the List operator. For example, Expr dx = new Derivative(0);
Expr dy = new Derivative(1);
Expr grad = List(dx, dy);

CoordExpr  Represents a coordinate functions.
Expr x = new CoordExpr(0);
Expr y = new CoordExpr(1);
Expr r = sqrt(x*x + y*y);
Coordinate expressions are scalar valued.

CellDiameterExpr  Represents the diameter of a cell. Cell diameters are often used in stabilized methods.
Expr h = new CellDiameterExpr();
Expr streamlineDiffusion = eps*h*h*((u*grad)*v)*((u*grad)*T);
Cell diameter expressions are scalar valued. y