Basic math¶
The <input> and <output> tags of every module on this page additionally accept the attributes common to all analysis modules.
abs (absolute)¶
Calculates the absolute value of a single input element-wise and writes it to a single output buffer. This module will write as many values as there are values in the input buffer.
Inputs
as |
Count | as required |
Allowed types |
|---|---|---|---|
value |
exactly one | no | buffer, value |
Outputs
as |
Count | as required |
|---|---|---|
abs |
exactly one | no |
add¶
Calculates the sum of all inputs element-wise and writes it to a single output buffer. This module will write as many values as there are values in the biggest input buffer. If a buffer is shorter than the others (especially if one input is a single value), its last value will be repeated. (Exception: If any buffer is empty, the result will be an empty buffer, too.)
Inputs
as |
Count | as required |
Allowed types |
|---|---|---|---|
summand |
at least one | no | buffer, value |
Outputs
as |
Count | as required |
|---|---|---|
sum |
exactly one | no |
divide¶
Calculates the quotient of multiple divisors from a single dividend element-wise and writes it to a single output buffer. This module will write as many values as there are values in the biggest input buffer. If a buffer is shorter than the others (especially if one input is a single value), its last value will be repeated. (Exception: If any buffer is empty, the result will be an empty buffer, too.)
For this simple function you can leave out the as attribute. If you do so, the first input will be used as dividend and all subsequent values as divisors.
<divide>
<input as="dividend">BUFFER</input>
<input as="divisor">BUFFER</input>
<output as="quotient">BUFFER</output>
</divide>
Inputs
as |
Count | as required |
Allowed types |
|---|---|---|---|
dividend |
exactly one | no | buffer, value |
divisor |
at least one | no | buffer, value |
Outputs
as |
Count | as required |
|---|---|---|
quotient |
exactly one | no |
gcd (greatest common divisor)¶
Calculates the greatest common divisor of two inputs element-wise and writes it to a single output buffer. This module will write as many values as there are values in the biggest input buffer. If a buffer is shorter than the others (especially if one input is a single value), its last value will be repeated. (Exception: If any buffer is empty, the result will be an empty buffer, too.)
The domain is non-negative integers: fractional values are rounded to the nearest integer with ties rounding half away from zero (like the formula language's round), while negative and non-finite inputs yield NaN, as do values too large to compute with.
Inputs
as |
Count | as required |
Allowed types |
|---|---|---|---|
value |
exactly 2 | no | buffer, value |
Outputs
as |
Count | as required |
|---|---|---|
gcd |
exactly one | no |
lcm (least common multiple)¶
Calculates the least common multiple of two inputs element-wise and writes it to a single output buffer. This module will write as many values as there are values in the biggest input buffer. If a buffer is shorter than the others (especially if one input is a single value), its last value will be repeated. (Exception: If any buffer is empty, the result will be an empty buffer, too.)
The domain is non-negative integers: fractional values are rounded to the nearest integer with ties rounding half away from zero (like the formula language's round), while negative and non-finite inputs yield NaN, as does a result too large to represent. lcm(0, x) is 0 by the usual convention, including lcm(0, 0).
Inputs
as |
Count | as required |
Allowed types |
|---|---|---|---|
value |
exactly 2 | no | buffer, value |
Outputs
as |
Count | as required |
|---|---|---|
lcm |
exactly one | no |
log¶added in 1.5
Calculates the natural logarithm of a single input element-wise and writes it to a single output buffer. This module will write as many values as there are values in the input buffer.
Inputs
as |
Count | as required |
Allowed types |
|---|---|---|---|
value |
exactly one | no | buffer, value |
Outputs
as |
Count | as required |
|---|---|---|
log |
exactly one | no |
multiply¶
Calculates the product of all inputs element-wise and writes it to a single output buffer. This module will write as many values as there are values in the biggest input buffer. If a buffer is shorter than the others (especially if one input is a single value), its last value will be repeated. (Exception: If any buffer is empty, the result will be an empty buffer, too.)
Inputs
as |
Count | as required |
Allowed types |
|---|---|---|---|
factor |
at least one | no | buffer, value |
Outputs
as |
Count | as required |
|---|---|---|
product |
exactly one | no |
power¶
Calculates the power of a base and an exponent element-wise and writes it to a single output buffer. This module will write as many values as there are values in the biggest input buffer. If a buffer is shorter than the others (especially if one input is a single value), its last value will be repeated. (Exception: If any buffer is empty, the result will be an empty buffer, too.)
<power>
<input as="base">BUFFER</input>
<input as="exponent">BUFFER</input>
<output as="power">BUFFER</output>
</power>
Inputs
as |
Count | as required |
Allowed types |
|---|---|---|---|
base |
exactly one | yes | buffer, value |
exponent |
exactly one | yes | buffer, value |
Outputs
as |
Count | as required |
|---|---|---|
power |
exactly one | no |
round¶added in 1.5
Rounds the values from the single input element-wise and writes the results to a single output buffer. This module will write as many values as there are values in the input buffer. By default it will round to the nearest integer. The attributes ceil and floor can change that to the nearest larger integer or the nearest smaller integer.
Non-finite values pass through unchanged (NaN stays NaN, infinities stay infinite) and, in the default mode, ties round half away from zero like the formula language's round: round(2.5) is 3 and round(-2.5) is -3.
<round ceil="BOOLEAN" floor="BOOLEAN">
<input as="value">BUFFER</input>
<output as="round">BUFFER</output>
</round>
Attributes
- ceil
- See the module description.
- optional, boolean
- floor
- See the module description.
- optional, boolean
Inputs
as |
Count | as required |
Allowed types |
|---|---|---|---|
value |
exactly one | no | buffer, value |
Outputs
as |
Count | as required |
|---|---|---|
round |
exactly one | no |
subtract¶
Calculates the difference of multiple subtrahends from a single minuend element-wise and writes it to a single output buffer. This module will write as many values as there are values in the biggest input buffer. If a buffer is shorter than the others (especially if one input is a single value), its last value will be repeated. (Exception: If any buffer is empty, the result will be an empty buffer, too.)
For this simple function you can leave out the as attribute. If you do so, the first input will be used as minuend and all subsequent values as subtrahends.
<subtract>
<input as="minuend">BUFFER</input>
<input as="subtrahend">BUFFER</input>
<output as="difference">BUFFER</output>
</subtract>
Inputs
as |
Count | as required |
Allowed types |
|---|---|---|---|
minuend |
exactly one | no | buffer, value |
subtrahend |
at least one | no | buffer, value |
Outputs
as |
Count | as required |
|---|---|---|
difference |
exactly one | no |