Skip to content

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

  • sin the sine of an angle, in radians or an angle unit
  • cos the cosine of an angle, in radians or an angle unit
  • tan the tangent of an angle, in radians or an angle unit
  • asin the angle whose sine is x (arcsine)
  • acos the angle whose cosine is x (arccosine)
  • atan the angle whose tangent is x (arctangent)
  • atan2 the angle from the positive x axis to the point (x, y), from -180° to 180°
  • sinh the hyperbolic sine, (eˣ - e⁻ˣ) / 2
  • cosh the hyperbolic cosine, (eˣ + e⁻ˣ) / 2
  • tanh the hyperbolic tangent, sinh(x) / cosh(x)
  • csc the cosecant of an angle, 1 / sin(x)
  • secant the secant of an angle, 1 / cos(x), not to be confused with sec for seconds
  • cot the cotangent of an angle, 1 / tan(x)
  • acsc the angle whose cosecant is x
  • asec the angle whose secant is x
  • acot the angle whose cotangent is x
  • asinh the inverse hyperbolic sine
  • acosh the inverse hyperbolic cosine, for x of 1 or more
  • atanh the inverse hyperbolic tangent, for x between -1 and 1
  • sech the hyperbolic secant, 1 / cosh(x)
  • csch the hyperbolic cosecant, 1 / sinh(x)
  • coth the hyperbolic cotangent, 1 / tanh(x)
  • sinc the normalized sinc function, sin(pi x) / (pi x), which is 1 at 0
sin(x: num|quantity) -> float

the sine of an angle, in radians or an angle unit

1
sin(30 deg)0.5
2
sin(pi / 2)1
Example outputCtrl+Enter to run

See also cos, tan, asin

cos(x: num|quantity) -> float

the cosine of an angle, in radians or an angle unit

1
cos(60 deg)0.5
Example outputCtrl+Enter to run

See also sin, tan, acos

tan(x: num|quantity) -> float

the tangent of an angle, in radians or an angle unit

1
tan(45 deg)1
Example outputCtrl+Enter to run

See also sin, cos, atan

asin(x: num) -> quantity

the angle whose sine is x (arcsine)

1
asin(1) to deg90 deg
Example outputCtrl+Enter to run

See also sin

acos(x: num) -> quantity

the angle whose cosine is x (arccosine)

1
acos(0) to deg90 deg
Example outputCtrl+Enter to run

See also cos

atan(x: num) -> quantity

the angle whose tangent is x (arctangent)

1
atan(1) to deg45 deg
Example outputCtrl+Enter to run

See also tan, atan2

atan2(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

1
atan2(1, -1) to deg135 deg
Example outputCtrl+Enter to run

See also atan, hypot

sinh(x: num) -> float

the hyperbolic sine, (eˣ - e⁻ˣ) / 2

1
sinh(1)1.1752
Example outputCtrl+Enter to run

See also cosh, tanh

cosh(x: num) -> float

the hyperbolic cosine, (eˣ + e⁻ˣ) / 2

1
cosh(1)1.54308
Example outputCtrl+Enter to run

See also sinh, tanh

tanh(x: num) -> float

the hyperbolic tangent, sinh(x) / cosh(x)

1
tanh(1)0.761594
Example outputCtrl+Enter to run

See also sinh, cosh

csc(x: num|quantity) -> float

the cosecant of an angle, 1 / sin(x)

1
csc(30 deg)2
Example outputCtrl+Enter to run

See also sin, asin

secant(x: num|quantity) -> float

the secant of an angle, 1 / cos(x), not to be confused with sec for seconds

1
secant(60 deg)2
Example outputCtrl+Enter to run

See also cos, acos

cot(x: num|quantity) -> float

the cotangent of an angle, 1 / tan(x)

1
cot(45 deg)1
Example outputCtrl+Enter to run

See also tan, atan

acsc(x: num) -> quantity

the angle whose cosecant is x

1
acsc(2) to deg30 deg
Example outputCtrl+Enter to run

See also csc

asec(x: num) -> quantity

the angle whose secant is x

1
asec(2) to deg60 deg
Example outputCtrl+Enter to run

See also secant

acot(x: num) -> quantity

the angle whose cotangent is x

1
acot(1) to deg45 deg
Example outputCtrl+Enter to run

See also cot

asinh(x: num) -> float

the inverse hyperbolic sine

1
asinh(1)0.881374
Example outputCtrl+Enter to run

See also sinh

acosh(x: num) -> float

the inverse hyperbolic cosine, for x of 1 or more

1
acosh(2)1.31696
Example outputCtrl+Enter to run

See also cosh

atanh(x: num) -> float

the inverse hyperbolic tangent, for x between -1 and 1

1
atanh(0.5)0.549306
Example outputCtrl+Enter to run

See also tanh

sech(x: num) -> float

the hyperbolic secant, 1 / cosh(x)

1
sech(1)0.648054
Example outputCtrl+Enter to run

See also cosh

csch(x: num) -> float

the hyperbolic cosecant, 1 / sinh(x)

1
csch(1)0.850918
Example outputCtrl+Enter to run

See also sinh

coth(x: num) -> float

the hyperbolic cotangent, 1 / tanh(x)

1
coth(1)1.31304
Example outputCtrl+Enter to run

See also tanh

sinc(x: num) -> float

the normalized sinc function, sin(pi x) / (pi x), which is 1 at 0

1
sinc(0.5)0.63662
Example outputCtrl+Enter to run

See also sin

1
# angles can be in degrees
2
sin(30 deg)0.5
3
# radians back to degrees
4
atan2(1, 1) to deg45 deg
Example outputCtrl+Enter to run

Example results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.