Trigonometry#

ACOS

Compute inverse cosine of the input column (in radians).

ACOSD

Compute inverse cosine of the input column (in degrees).

ASIN

Compute inverse sine of the input column (in radians).

ASIND

Compute inverse sine of the input column (in degrees).

ATAN

Compute inverse tangent of the input column (in radians).

ATAND

Compute inverse tangent of the input column (in degrees).

ATAN2

Compute the inverse tangent of column_2/column_1 (in radians).

ATAN2D

Compute the inverse tangent of column_2/column_1 (in degrees).

COT

Compute the cotangent of the input column (in radians).

COTD

Compute cotangent of the input column (in degrees).

COS

Compute the cosine of the input column (in radians).

COSD

Compute the cosine of the input column (in degrees).

DEGREES

Convert between radians and degrees.

RADIANS

Convert between degrees and radians.

SIN

Compute the sine of the input column (in radians).

SIND

Compute the sine of the input column (in degrees).

TAN

Compute the tangent of the input column (in radians).

TAND

Compute the tangent of the input column (in degrees).

ACOS#

Compute inverse cosine of the input column (in radians).

Example:

df = pl.DataFrame(
  {
    "a": [-1.0, -0.5, 0.5, 1],
  }
)

df.sql("SELECT ACOS(a) AS ACOS FROM self")

# shape: (4, 1)
# ┌──────────┐
# │ ACOS     │
# │ ---      │
# │ f64      │
# ╞══════════╡
# │ 3.141593 │
# │ 2.094395 │
# │ 1.047198 │
# │ 0.0      │
# └──────────┘

ACOSD#

Compute inverse cosine of the input column (in degrees).

Example:

df = pl.DataFrame(
  {
    "a": [-1.0, -0.5, 0.5, 1],
  }
)

df.sql("SELECT ACOSD(a) AS ACOSD FROM self")
# shape: (4, 1)
# ┌───────┐
# │ ACOSD │
# │ ---   │
# │ f64   │
# ╞═══════╡
# │ 180.0 │
# │ 120.0 │
# │ 60.0  │
# │ 0.0   │
# └───────┘

ASIN#

Compute inverse sine of the input column (in radians).

Example:

df = pl.DataFrame(
  {
    "a": [-1.0, -0.5, 0.5, 1],
  }
)

df.sql("SELECT ASIN(a) AS ASIN FROM self")
# shape: (4, 1)
# ┌───────────┐
# │ ASIN      │
# │ ---       │
# │ f64       │
# ╞═══════════╡
# │ -1.570796 │
# │ -0.523599 │
# │ 0.523599  │
# │ 1.570796  │
# └───────────┘

ASIND#

Compute inverse sine of the input column (in degrees).

Example:

df = pl.DataFrame(
  {
    "a": [-1.0, -0.5, 0.5, 1],
  }
)

df.sql("SELECT ASIND(a) AS ASIND FROM self")
# shape: (4, 1)
# ┌───────┐
# │ ASIND │
# │ ---   │
# │ f64   │
# ╞═══════╡
# │ -90.0 │
# │ -30.0 │
# │ 30.0  │
# │ 90.0  │
# └───────┘

ATAN#

Compute inverse tangent of the input column (in radians).

Example:

df = pl.DataFrame(
  {
    "a": [-1.0, -0.5, 0.5, 1],
  }
)

df.sql("SELECT ATAN(a) AS ATAN FROM self")
# shape: (4, 1)
# ┌───────────┐
# │ ATAN      │
# │ ---       │
# │ f64       │
# ╞═══════════╡
# │ -0.785398 │
# │ -0.463648 │
# │ 0.463648  │
# │ 0.785398  │
# └───────────┘

ATAND#

Compute inverse tangent of the input column (in degrees).

Example:

df = pl.DataFrame(
  {
    "a": [-1.0, -0.5, 0.5, 1],
  }
)

df.sql("SELECT ATAND(a) AS ATAND FROM self")
# shape: (4, 1)
# ┌────────────┐
# │ ATAND      │
# │ ---        │
# │ f64        │
# ╞════════════╡
# │ -45.0      │
# │ -26.565051 │
# │ 26.565051  │
# │ 45.0       │
# └────────────┘

ATAN2#

Compute the inverse tangent of column_2/column_1 (in radians).

Example:

df = pl.DataFrame(
  {
    "a": [-1.0, -0.5, 0.5, 1],
    "b": [10, 20, 30, 40],
  }
)

df.sql("SELECT ATAN2(a, b) AS ATAN2 FROM self")
# shape: (4, 1)
# ┌───────────┐
# │ ATAN2     │
# │ ---       │
# │ f64       │
# ╞═══════════╡
# │ -0.099669 │
# │ -0.024995 │
# │ 0.016665  │
# │ 0.024995  │
# └───────────┘

ATAN2D#

Compute the inverse tangent of column_2/column_1 (in degrees).

Example:

df = pl.DataFrame(
  {
    "a": [-1.0, -0.5, 0.5, 1],
    "b": [10, 20, 30, 40],
  }
)

df.sql("SELECT ATAN2D(a, b) AS ATAN2D FROM self")
# shape: (4, 1)
# ┌───────────┐
# │ ATAN2D    │
# │ ---       │
# │ f64       │
# ╞═══════════╡
# │ -5.710593 │
# │ -1.432096 │
# │ 0.954841  │
# │ 1.432096  │
# └───────────┘

COT#

Compute the cotangent of the input column (in radians).

Example:

import math

df = pl.DataFrame(
  {
    "angle": [0.0, math.pi/2, math.pi, 3*math.pi/2],
  }
)

df.sql("SELECT COT(angle) AS COT FROM self")
# shape: (4, 1)
# ┌────────────┐
# │ COT        │
# │ ---        │
# │ f64        │
# ╞════════════╡
# │ inf        │
# │ 6.1232e-17 │
# │ -8.1656e15 │
# │ 1.8370e-16 │
# └────────────┘

COTD#

Compute cotangent of the input column (in degrees).

Example:

df = pl.DataFrame(
  {
    "angle": [0, 90, 180, 270]
  }
)

df.sql("SELECT COTD(angle) AS COTD FROM self")
# shape: (4, 1)
# ┌────────────┐
# │ COTD       │
# │ ---        │
# │ f64        │
# ╞════════════╡
# │ inf        │
# │ 6.1232e-17 │
# │ -8.1656e15 │
# | 1.8370e-16 │
# └────────────┘

COS#

Compute the cosine of the input column (in radians).

Example:

import math

df = pl.DataFrame(
  {
    "angle": [0.0, math.pi/2, math.pi, 3*math.pi/2],
  }
)

df.sql("SELECT COS(angle) AS COS FROM self")
# shape: (4, 1)
# ┌─────────────┐
# │ COS         │
# │ ---         │
# | f64         │
# ╞═════════════╡
# │ 1.0         │
# │ 6.1232e-17  │
# │ -1.0        │
# │ -1.8370e-16 │
# └─────────────┘

COSD#

Compute the cosine of the input column (in degrees).

Example:

df = pl.DataFrame(
  {
    "angle": [0, 90, 180, 270]
  }
)

df.sql("SELECT COSD(angle) AS COSD FROM self")
# shape: (4, 1)
# ┌─────────────┐
# │ COSD        │
# │ ---         │
# | f64         │
# ╞═════════════╡
# │ 1.0         │
# │ 6.1232e-17  │
# │ -1.0        │
# │ -1.8370e-16 │
# └─────────────┘

DEGREES#

Convert between radians and degrees.

Example:

import math

df = pl.DataFrame(
  {
    "angle": [0.0, math.pi/2, math.pi, 3*math.pi/2],
  }
)

df.sql("SELECT DEGREES(angle) AS DEGREES FROM self")
# shape: (4, 1)
# ┌─────────┐
# │ DEGREES │
# │ ---     │
# │ f64     │
# ╞═════════╡
# │ 0.0     │
# │ 90.0    │
# │ 180.0   │
# │ 270.0   │
# └─────────┘

RADIANS#

Convert between degrees and radians.

Example:

df = pl.DataFrame(
  {
    "angle": [0, 90, 180, 270]
  }
)

df.sql("SELECT RADIANS(angle_degrees) FROM self")
# shape: (4, 1)
# ┌───────────────┐
# │ angle_degrees │
# │ ---           │
# │ f64           │
# ╞═══════════════╡
# │ 0.0           │
# │ 1.570796      │
# │ 3.141593      │
# │ 4.712389      │
# └───────────────┘

SIN#

Compute the sine of the input column (in radians).

Example:

import math

df = pl.DataFrame(
  {
    "angle": [0.0, math.pi/2, math.pi, 3*math.pi/2],
  }
)

df.sql("SELECT SIN(angle) AS SIN FROM self")
# shape: (4, 1)
# ┌────────────┐
# │ SIN        │
# │ ---        │
# │ f64        │
# ╞════════════╡
# │ 0.0        │
# │ 1.0        │
# │ 1.2246e-16 │
# │ -1.0       │
# └────────────┘

SIND#

Compute the sine of the input column (in degrees).

Example:

df = pl.DataFrame(
  {
    "angle": [0, 90, 180, 270]
  }
)

df.sql("SELECT SIND(angle) FROM self")
# shape: (4, 1)
# ┌────────────┐
# │ SIND       │
# │ ---        │
# | f64        │
# ╞════════════╡
# │ 0.0        │
# │ 1.0        │
# │ 1.2246e-16 │
# │ -1.0       │
# └────────────┘

TAN#

Compute the tangent of the input column (in radians).

Example:

import math

df = pl.DataFrame(
  {
    "angle": [0.0, math.pi/2, math.pi, 3*math.pi/2],
  }
)

df.sql("SELECT TAN(angle) AS TAN FROM self")
# shape: (4, 1)
# ┌─────────────┐
# │ TAN         │
# │ ---         │
# │ f64         │
# ╞═════════════╡
# │ 0.0         │
# │ 1.6331e16   │
# │ -1.2246e-16 │
# │ 5.4437e15   │
# └─────────────┘

TAND#

Compute the tangent of the input column (in degrees).

Example:

df = pl.DataFrame(
  {
    "angle": [0, 90, 180, 270]
  }
)

df.sql("SELECT TAND(angle) AS TAND FROM self")
# shape: (4, 1)
# ┌─────────────┐
# │ TAND        │
# │ ---         │
# │ f64         │
# ╞═════════════╡
# │ 0.0         │
# │ 1.6331e16   │
# │ -1.2246e-16 │
# │ 5.4437e15   │
# └─────────────┘