Skip to content
AlertaChartAlertaScript / docs
AlertaScript / Math

Reference

Math

Guides and navigation are localized. Built-in reference descriptions and code examples are maintained in English.

Name / SignatureDescriptionReturns
alerta.sumsum(source, length)Math namespace alias for sum.series float
alerta.math.absabs(x)Absolute value of x.series float
alerta.math.minmin(x, y)Returns the smaller of two or more values.series float
alerta.math.maxmax(x, y)Returns the larger of two or more values.series float
alerta.math.roundround(x, precision?)Rounds to the nearest integer, or — with `precision` — to that many decimal places. `math.round(x, 2)` is how dashboards trim a figure before `str.tostring`.series float
alerta.math.sqrtsqrt(x)Square root of x.series float
alerta.math.powpow(x, y)x raised to the power of y.series float
alerta.math.loglog(x)Natural logarithm (base e) of x.series float
alerta.math.expexp(x)Returns e raised to x.series float
alerta.math.ceilceil(x)Rounds x upward to nearest integer.series float
alerta.math.floorfloor(x)Rounds x downward to nearest integer.series float
alerta.math.avgavg(a, b)Returns the arithmetic mean of two or more values (na when any of them is na).series float
alerta.math.sinsin(x)Trigonometric sine of x (radians).series float
alerta.math.coscos(x)Trigonometric cosine of x (radians).series float
alerta.math.tantan(x)Trigonometric tangent of x (radians).series float
alerta.math.asinasin(x)Inverse sine of x.series float
alerta.math.acosacos(x)Inverse cosine of x.series float
alerta.math.atanatan(x)Inverse tangent of x.series float
alerta.math.signsign(x)Returns sign of x: -1, 0, 1.series float
alerta.math.log10log10(x)Base-10 logarithm.series float
alerta.math.randomrandom(min?, max?, seed?)Returns a pseudo-random value in range [min, max]. With `seed`, the sequence is REPEATABLE: the same seed yields the same stream of values on every run, which is what a simulation needs so its paths do not redraw differently on each tick.float
alerta.math.round_to_mintickround_to_mintick(x)Rounds value to the nearest multiple of syminfo.mintick, the symbol's tick size.series float
alerta.math.summath.sum(source, length)Namespace form of sum over a rolling window.series float
alerta.math.todegreestodegrees(x)Converts radians to degrees.series float
alerta.math.toradianstoradians(x)Converts degrees to radians.series float
alerta.math.rphimath.rphiThe reciprocal of the golden ratio φ, approximately 0.618. Equivalent to 1/φ or (√5 − 1) / 2.float
alerta.math.pimath.pi → const floatMathematical constant available without calling a function. Use math.pi as a value, without parentheses.const float
alerta.math.emath.e → const floatMathematical constant available without calling a function. Use math.e as a value, without parentheses.const float
alerta.math.phimath.phi → const floatMathematical constant available without calling a function. Use math.phi as a value, without parentheses.const float
AlertaScript

No results found.

Search by name, alias, or keyword.