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
| Name | Type | Description |
|---|---|---|
a | number | Variable a in the expression. |
b | number | Variable b in the expression. |
c | number | Variable c in the expression. |
d | number | Variable d in the expression. |
Outputs
| Name | Type | Description |
|---|---|---|
output | number | The result of evaluating the expression. |
Configuration
- Expression: The mathematical formula to evaluate, written in mathjs syntax. Variables
a,b,c, anddrefer to the four input handles. Example:sqrt(a^2 + b^2)orround(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.