In mathematics, a quadratic function, a quadratic polynomial, a polynomial
of degree 2, or simply a quadratic, is a polynomial function in one or more
variables in which the highest-degree term is of the second degree. For example,
a quadratic function in three variables x, y, and z contains exclusively terms
x², y², z², xy, xz, yz, x, y, z, and a constant:

Please note that the function's constructor expects the function
expression to be given on this form. Scalar values must be located
on the left of the variables, and no term should be duplicated in
the quadratic expression. Please take a look on the examples section
of this page for some examples of expected functions.

It is also possible to specify quadratic functions using lambda expressions.
In this case, it is first necessary to create some dummy symbol variables to
act as placeholders in the quadratic expressions. Their value is not important,
as they will only be used to parse the form of the expression, not its value.

Finally, for large problems, it is usually best to declare quadratic
problems using matrices and vectors. Without loss of generality, the
quadratic matrix can always be taken to be symmetric (as the anti-
symmetric part has no contribution to the function). For efficiency
reasons, the quadratic matrix must be symmetric.

Sometimes it is easiest to compose quadratic functions as linear
combinations of other quadratic functions. The QuadraticObjectiveFunction
supports this by overloading the addition and multiplication operators.