Math node
Evaluates a formula over up to four inputs.
What it does
Evaluates the Formula with the values from A, B, C and D and outputs the answer on Result. The formula can use operators (+ - * / ^ %), parentheses and functions such as sqrt(a), round(a, 2) or max(a, b).
Notes
- Inputs that are not wired count as
0. - Indexes in a formula start at 1:
a[1]is the first item of an array on A. - A formula that cannot be evaluated gives
NaNinstead of an error, so check the formula if you see it. - Values are not limited to numbers: arrays and matrices work with the functions that accept them.
- An empty Formula falls back to
a + b + c + d.
Example
The hypotenuse of a 3-4-5 triangle:
#fdl 1
flow "Hypotenuse"
x(number) value=3
y(number) value=4
calc(math) formula="sqrt(a^2 + b^2)"
out(number)
x.out -> calc.a
y.out -> calc.b
calc.result -> out.in
The result is 5.
Related nodes
Number · Comparison · Counter