Skip to content

Math

The math interface is utilized to specify arbitrary profiles for operands in other interfaces.

Math Expression

MathExpr represents a mathematical expression.

Primitives

The primitives of the math interface consist of:

MathNum represents a number.

Note

Numbers are considered to belong to the real numbers, i.e. they can be positive or negative floats.

MathImag represents the imaginary unit.

MathVar represents a protected named variable to be substituted during compile time or runtime.

Operators

The compatible operators for the math interface consist of:

MathAdd represents an addition of two expressions.

MathMul represents an multiplication of two expressions.

MathPow represents an exponentiation of an expression with the other expression.

MathSub represents an subtraction of two expressions.

MathDiv represents an division of two expressions.

MathFunc represents the application of a named function on an expression.

The compatible named functions include:

  • trigonometric (sin, cos, tan)
  • hyperbolic trigonometric (sinh, cosh, tanh)
  • exponential (exp)
  • logarithm (log)

Usage

Example

\[ 10 \sin^2(\omega t + \phi) \]
expr = (
    10
    * MathFunc(
        func="sin", expr=MathVar(name="omega") * MathVar(name="t") + MathVar(name="phi")
    )
    ** 2
)