math
Arc standard library reference for the math module: avg, derivative, max, and min
The math module provides numerical primitives: running averages, running min/max, and
derivatives.
avg
Computes a running average of input values, emitting the updated average on each input.
By default the average accumulates over every sample; set duration or count to reset
the window periodically.
Parameters
Output numeric: the running average, matching the input type.
// `flow` only
sensor -> math.avg{} -> output
// Reset by sample count or time window
sensor -> math.avg{count=100} -> output
sensor -> math.avg{duration=5s} -> output derivative
Computes the rate of change of input values with respect to time. The output is always
f64, regardless of the input type.
Parameters
Output f64: the rate of change between consecutive samples.
// `flow` only
sensor -> math.derivative{} -> rate_output max
Tracks the running maximum of input values, emitting the updated maximum on each input.
By default the maximum accumulates over every sample; set duration or count to reset
the window periodically.
Parameters
Output numeric: the running maximum, matching the input type.
// `flow` only
sensor -> math.max{} -> output
// Reset by sample count or time window
sensor -> math.max{count=100} -> output
sensor -> math.max{duration=5s} -> output min
Tracks the running minimum of input values, emitting the updated minimum on each input.
By default the minimum accumulates over every sample; set duration or count to reset
the window periodically.
Parameters
Output numeric: the running minimum, matching the input type.
// `flow` only
sensor -> math.min{} -> output
// Reset by sample count or time window
sensor -> math.min{count=100} -> output
sensor -> math.min{duration=5s} -> output