Math Ops
Math Operators & Math Transforms — TA-Lib compatibility shims.
Rolling functions (SUM, MAX, MIN, MAXINDEX, MININDEX) are implemented in Rust using O(n) monotonic deque / prefix-sum algorithms. All other functions are thin NumPy wrappers (element-wise operations).
Functions
- Math Operators:
ADD — Element-wise addition SUB — Element-wise subtraction MULT — Element-wise multiplication DIV — Element-wise division SUM — Rolling sum over timeperiod bars (Rust) MAX — Rolling maximum over timeperiod bars (Rust) MIN — Rolling minimum over timeperiod bars (Rust) MAXINDEX — Index of rolling maximum over timeperiod bars (Rust) MININDEX — Index of rolling minimum over timeperiod bars (Rust)
- Math Transforms (element-wise):
ACOS ASIN ATAN CEIL COS COSH EXP FLOOR LN LOG10 SIN SINH SQRT TAN TANH
Rust backend
Rolling operators delegate to:
from ferro_ta._ferro_ta import rolling_sum, rolling_max, rolling_min, ...
- ferro_ta.math_ops.ACOS(real)[source]
Arc cosine (element-wise). Returns NaN outside [-1, 1].
- Parameters:
real (ArrayLike)
- Return type:
- ferro_ta.math_ops.ADD(real0, real1)[source]
Element-wise addition: real0 + real1.
- Parameters:
real0 (array-like) – Input arrays (same length).
real1 (array-like) – Input arrays (same length).
- Return type:
numpy.ndarray[float64]
- ferro_ta.math_ops.ASIN(real)[source]
Arc sine (element-wise). Returns NaN outside [-1, 1].
- Parameters:
real (ArrayLike)
- Return type:
- ferro_ta.math_ops.ATAN(real)[source]
Arc tangent (element-wise).
- Parameters:
real (ArrayLike)
- Return type:
- ferro_ta.math_ops.CEIL(real)[source]
Ceiling (element-wise).
- Parameters:
real (ArrayLike)
- Return type:
- ferro_ta.math_ops.COS(real)[source]
Cosine (element-wise).
- Parameters:
real (ArrayLike)
- Return type:
- ferro_ta.math_ops.COSH(real)[source]
Hyperbolic cosine (element-wise).
- Parameters:
real (ArrayLike)
- Return type:
- ferro_ta.math_ops.DIV(real0, real1)[source]
Element-wise division: real0 / real1.
- Parameters:
real0 (array-like) – Input arrays (same length).
real1 (array-like) – Input arrays (same length).
- Return type:
numpy.ndarray[float64]
- ferro_ta.math_ops.EXP(real)[source]
Exponential (element-wise).
- Parameters:
real (ArrayLike)
- Return type:
- ferro_ta.math_ops.FLOOR(real)[source]
Floor (element-wise).
- Parameters:
real (ArrayLike)
- Return type:
- ferro_ta.math_ops.LN(real)[source]
Natural logarithm (element-wise). Returns NaN for non-positive inputs.
- Parameters:
real (ArrayLike)
- Return type:
- ferro_ta.math_ops.LOG10(real)[source]
Base-10 logarithm (element-wise). Returns NaN for non-positive inputs.
- Parameters:
real (ArrayLike)
- Return type:
- ferro_ta.math_ops.MAX(real, timeperiod=30)[source]
Rolling maximum over timeperiod bars.
- Parameters:
real (array-like)
timeperiod (int, default 30)
- Returns:
NaN for the first
timeperiod - 1bars.- Return type:
numpy.ndarray[float64]
Notes
Implemented in Rust using O(n) monotonic deque algorithm.
- ferro_ta.math_ops.MAXINDEX(real, timeperiod=30)[source]
Index of the rolling maximum over timeperiod bars.
The index is the absolute position in the input array.
- Parameters:
real (array-like)
timeperiod (int, default 30)
- Returns:
-1 for the first
timeperiod - 1bars (warmup period).- Return type:
numpy.ndarray[int64]
Notes
Implemented in Rust using O(n) monotonic deque algorithm.
- ferro_ta.math_ops.MIN(real, timeperiod=30)[source]
Rolling minimum over timeperiod bars.
- Parameters:
real (array-like)
timeperiod (int, default 30)
- Returns:
NaN for the first
timeperiod - 1bars.- Return type:
numpy.ndarray[float64]
Notes
Implemented in Rust using O(n) monotonic deque algorithm.
- ferro_ta.math_ops.MININDEX(real, timeperiod=30)[source]
Index of the rolling minimum over timeperiod bars.
The index is the absolute position in the input array.
- Parameters:
real (array-like)
timeperiod (int, default 30)
- Returns:
-1 for the first
timeperiod - 1bars (warmup period).- Return type:
numpy.ndarray[int64]
Notes
Implemented in Rust using O(n) monotonic deque algorithm.
- ferro_ta.math_ops.MULT(real0, real1)[source]
Element-wise multiplication: real0 * real1.
- Parameters:
real0 (array-like) – Input arrays (same length).
real1 (array-like) – Input arrays (same length).
- Return type:
numpy.ndarray[float64]
- ferro_ta.math_ops.SINH(real)[source]
Hyperbolic sine (element-wise).
- Parameters:
real (ArrayLike)
- Return type:
- ferro_ta.math_ops.SQRT(real)[source]
Square root (element-wise). Returns NaN for negative inputs.
- Parameters:
real (ArrayLike)
- Return type:
- ferro_ta.math_ops.SUB(real0, real1)[source]
Element-wise subtraction: real0 - real1.
- Parameters:
real0 (array-like) – Input arrays (same length).
real1 (array-like) – Input arrays (same length).
- Return type:
numpy.ndarray[float64]
- ferro_ta.math_ops.SUM(real, timeperiod=30)[source]
Rolling sum over timeperiod bars.
- Parameters:
real (array-like)
timeperiod (int, default 30)
- Returns:
NaN for the first
timeperiod - 1bars.- Return type:
numpy.ndarray[float64]
Notes
Implemented in Rust using O(n) prefix-sum algorithm.