math.trig
sine, cosine, tangent and their inverses, in radians or degrees
Sine, cosine, tangent and their inverses.
A plain number is read as radians, where a full turn is 2 pi. To use degrees, give an angle unit, like 30 deg. The inverses return an angle, which you can convert with to deg.
Tags: geometry
sinthe sine of an angle, in radians or an angle unitcosthe cosine of an angle, in radians or an angle unittanthe tangent of an angle, in radians or an angle unitasinthe angle whose sine is x (arcsine)acosthe angle whose cosine is x (arccosine)atanthe angle whose tangent is x (arctangent)atan2the angle from the positive x axis to the point (x, y), from -180° to 180°sinhthe hyperbolic sine, (eˣ - e⁻ˣ) / 2coshthe hyperbolic cosine, (eˣ + e⁻ˣ) / 2tanhthe hyperbolic tangent, sinh(x) / cosh(x)cscthe cosecant of an angle, 1 / sin(x)secantthe secant of an angle, 1 / cos(x), not to be confused withsecfor secondscotthe cotangent of an angle, 1 / tan(x)acscthe angle whose cosecant is xasecthe angle whose secant is xacotthe angle whose cotangent is xasinhthe inverse hyperbolic sineacoshthe inverse hyperbolic cosine, for x of 1 or moreatanhthe inverse hyperbolic tangent, for x between -1 and 1sechthe hyperbolic secant, 1 / cosh(x)cschthe hyperbolic cosecant, 1 / sinh(x)coththe hyperbolic cotangent, 1 / tanh(x)sincthe normalized sinc function, sin(pi x) / (pi x), which is 1 at 0
Functions
Section titled “Functions”sin(x: num|quantity) -> float
the sine of an angle, in radians or an angle unit
1sin(30 deg)0.52sin(pi / 2)1cos(x: num|quantity) -> float
the cosine of an angle, in radians or an angle unit
1cos(60 deg)0.5tan(x: num|quantity) -> float
the tangent of an angle, in radians or an angle unit
1tan(45 deg)1asin(x: num) -> quantity
the angle whose sine is x (arcsine)
1asin(1) to deg90 degSee also sin
acos(x: num) -> quantity
the angle whose cosine is x (arccosine)
1acos(0) to deg90 degSee also cos
atan(x: num) -> quantity
the angle whose tangent is x (arctangent)
1atan(1) to deg45 degatan2(y: quantity, x: quantity) -> quantity / atan2(y: num, x: num) -> quantity
the angle from the positive x axis to the point (x, y), from -180° to 180°
Unlike atan(y / x), it knows which quarter the point is in. Note y comes first
1atan2(1, -1) to deg135 degsinh(x: num) -> float
the hyperbolic sine, (eˣ - e⁻ˣ) / 2
1sinh(1)1.1752cosh(x: num) -> float
the hyperbolic cosine, (eˣ + e⁻ˣ) / 2
1cosh(1)1.54308tanh(x: num) -> float
the hyperbolic tangent, sinh(x) / cosh(x)
1tanh(1)0.761594csc(x: num|quantity) -> float
the cosecant of an angle, 1 / sin(x)
1csc(30 deg)2secant
Section titled “secant”secant(x: num|quantity) -> float
the secant of an angle, 1 / cos(x), not to be confused with sec for seconds
1secant(60 deg)2cot(x: num|quantity) -> float
the cotangent of an angle, 1 / tan(x)
1cot(45 deg)1acsc(x: num) -> quantity
the angle whose cosecant is x
1acsc(2) to deg30 degSee also csc
asec(x: num) -> quantity
the angle whose secant is x
1asec(2) to deg60 degSee also secant
acot(x: num) -> quantity
the angle whose cotangent is x
1acot(1) to deg45 degSee also cot
asinh(x: num) -> float
the inverse hyperbolic sine
1asinh(1)0.881374See also sinh
acosh(x: num) -> float
the inverse hyperbolic cosine, for x of 1 or more
1acosh(2)1.31696See also cosh
atanh(x: num) -> float
the inverse hyperbolic tangent, for x between -1 and 1
1atanh(0.5)0.549306See also tanh
sech(x: num) -> float
the hyperbolic secant, 1 / cosh(x)
1sech(1)0.648054See also cosh
csch(x: num) -> float
the hyperbolic cosecant, 1 / sinh(x)
1csch(1)0.850918See also sinh
coth(x: num) -> float
the hyperbolic cotangent, 1 / tanh(x)
1coth(1)1.31304See also tanh
sinc(x: num) -> float
the normalized sinc function, sin(pi x) / (pi x), which is 1 at 0
1sinc(0.5)0.63662See also sin
More examples
Section titled “More examples”1# angles can be in degrees2sin(30 deg)0.53# radians back to degrees4atan2(1, 1) to deg45 degExample results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.