Expand description
Mathematical built-in functions
This module provides:
- Basic math: abs, floor, ceil, round, sqrt, pow
- Trigonometry: sin, cos, tan, asin, acos, atan, atan2
- Logarithms: log, ln, log2
- Exponentials: exp, exp2
- Advanced: factorial, gamma, erf, hypot
- Statistics: mean, median, std, variance, quantile
- Vector operations: dot, norm, cross, distance
- Matrix operations: determinant, transpose, matmul
- Constants: PI, E, TAU, PHI
Functions§
- abs
- 绝对值
- acos
- 反余弦函数
- add_
with_ precision - 带精度加法
- asin
- 反正弦函数
- atan
- 反正切函数
- atan2
- 双参数反正切函数
- ceil
- 向上取整
- clamp
- 限制值在指定范围内
- cos
- 余弦函数
- cosh
- 双曲余弦函数
- cross
- 向量叉积
- determinant
- 计算行列式
- distance
- 向量间的欧几里得距离
- div_
with_ precision - 带精度除法
- dot
- 向量点积
- e
- 自然常数 e
- erf
- 误差函数
- exp
- 自然指数函数
- exp2
- 2的幂运算
- expm1
- exp(x) - 1 精确计算
- factorial
- 阶乘
- floor
- 向下取整
- gamma
- Gamma 函数(广义阶乘)
- hypot
- 斜边长度(勾股定理)
- linear_
regression - 简单线性回归
- ln
- 自然对数(以e为底)
- log
- 常用对数(以10为底)
- log2
- 以2为底的对数
- log1p
- ln(1 + x) 精确计算
- matmul
- 矩阵乘法
- matrix_
inverse - 矩阵求逆
- mean
- 计算平均值(均值)
- median
- 计算中位数
- mul_
with_ precision - 带精度乘法
- norm
- 向量范数(模长)
- normal_
cdf - 正态分布的累积分布函数 (CDF)
- normal_
pdf - 正态分布的概率密度函数 (PDF)
- normalize
- 向量归一化
- phi
- 黄金比例 φ (PHI)
- pi
- 圆周率 π
- poisson_
pmf - 泊松分布的概率质量函数 (PMF)
- pow
- 幂运算
- quantile
- 计算分位数(百分位数)
- round
- 四舍五入
- round_
to - 四舍五入到指定小数位数
- set_
precision - 设置全局计算精度
- sign
- 符号函数
- sin
- 正弦函数
- sinh
- 双曲正弦函数
- sqrt
- 平方根
- std
- 计算标准差
- sub_
with_ precision - 带精度减法
- tan
- 正切函数
- tanh
- 双曲正切函数
- tau
- 圆周率 τ (TAU)
- transpose
- 矩阵转置
- variance
- 计算方差