Skip to main content

Advanced Math

Runs on: Shared — pure logic, runs on the Streamerly backend or inside a chatbox overlay.

The Advanced Math node evaluates a freeform mathematical expression using the mathjs library. You write the formula as a text expression, and up to four number inputs — named a, b, c, and d — map to the corresponding variable names in your expression. The result is output as a single number.

This goes well beyond the basic Math node's single-operation model. You can compose multi-step calculations, use built-in functions like sqrt, abs, round, floor, ceil, sin, cos, min, max, and more, and chain them together in a single expression. Use it whenever a single arithmetic operation is not enough.

Inputs

NameTypeDescription
anumberVariable a in the expression.
bnumberVariable b in the expression.
cnumberVariable c in the expression.
dnumberVariable d in the expression.

Outputs

NameTypeDescription
outputnumberThe result of evaluating the expression.

Configuration

  • Expression: The mathematical formula to evaluate, written in mathjs syntax. Variables a, b, c, and d refer to the four input handles. Example: sqrt(a^2 + b^2) or round(a / b * 100).

Example

A viewer redeems channel points and types in two numbers. Extract each number with Regex Extract nodes and wire them to a and b. Set the expression to round(sqrt(a^2 + b^2)) to compute the hypotenuse of the triangle they described, then post the result back to chat.