Math
math functions
This page lists scalar math functions. Inputs are converted to real; outputs are real.
sin(x)— sine ofxradians.cos(x)— cosine ofxradians.tan(x)— tangent ofxradians.asin(x)/asin2(x)— arcsine ofx(radians).acos(x)/acos2(x)— arccosine ofx(radians).atan(x)— arctangent ofx(radians).atan2(y, x)— arctangent using signs ofyandx(radians).pow(base, exponent)— base raised to exponent.pi()— constant π.radians(degrees)— converts degrees to radians.degrees(radians)— converts radians to degrees.
Examples
Basic trig:
datatable(angle:real)[0, 1.5707963267948966]
| extend s = sin(angle), c = cos(angle), t = tan(angle) | angle | s | c | t |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 1.5707963267948966 | 1 | 0 | 1.633123935319537e+16 |
Inverse trig:
datatable(v:real)[-1, 0, 1]
| extend a_sin = asin(v), a_cos = acos(v), a_tan = atan(v) | v | a_sin | a_cos | a_tan |
|---|---|---|---|
| -1 | -1.5707963267948966 | 3.141592653589793 | -0.7853981633974483 |
| 0 | 0 | 1.5707963267948966 | 0 |
| 1 | 1.5707963267948966 | 0 | 0.7853981633974483 |
Powers and constants:
print eight = pow(2, 3), pi_val = pi() | eight | pi_val |
|---|---|
| 8 | 3.141592653589793 |
Degree/radian conversion:
datatable(deg:real)[0, 180]
| extend rad = radians(deg), back = degrees(rad) | deg | rad | back |
|---|---|---|
| 0 | 0 | 0 |
| 180 | 3.141592653589793 | 180 |