Skip to content

numojo.routines.math.trig

Trigonometric routines for NuMojo (numojo.routines.math.trig).

Implements trigonometric and inverse trigonometric functions over NDArrays and Matrices.

Functions

arccos

arccos[dtype: DType](A: Matrix[dtype]) -> Matrix[dtype]

Parameters:

  • dtype (DType)

Args:

  • A (Matrix)

Returns:

  • Matrix

acos

Overload 1

acos[dtype: DType, backend: Backend = Vectorized](array: NDArray[dtype]) -> NDArray[dtype]

Apply acos also known as inverse cosine .

Parameters:

  • dtype (DType): The element type.
  • backend (Backend): Sets utility function origin, defaults to `Vectorized.

Args:

  • array (NDArray): An Array.

Returns:

  • NDArray

Raises

Overload 2

acos[dtype: DType](A: Matrix[dtype]) -> Matrix[dtype]

Parameters:

  • dtype (DType)

Args:

  • A (Matrix)

Returns:

  • Matrix

arcsin

arcsin[dtype: DType](A: Matrix[dtype]) -> Matrix[dtype]

Parameters:

  • dtype (DType)

Args:

  • A (Matrix)

Returns:

  • Matrix

asin

Overload 1

asin[dtype: DType, backend: Backend = Vectorized](array: NDArray[dtype]) -> NDArray[dtype]

Apply asin also known as inverse sine .

Parameters:

  • dtype (DType): The element type.
  • backend (Backend): Sets utility function origin, defaults to `Vectorized.

Args:

  • array (NDArray): An Array.

Returns:

  • NDArray

Raises

Overload 2

asin[dtype: DType](A: Matrix[dtype]) -> Matrix[dtype]

Parameters:

  • dtype (DType)

Args:

  • A (Matrix)

Returns:

  • Matrix

arctan

arctan[dtype: DType](A: Matrix[dtype]) -> Matrix[dtype]

Parameters:

  • dtype (DType)

Args:

  • A (Matrix)

Returns:

  • Matrix

atan

Overload 1

atan[dtype: DType, backend: Backend = Vectorized](array: NDArray[dtype]) -> NDArray[dtype]

Apply atan also known as inverse tangent .

Parameters:

  • dtype (DType): The element type.
  • backend (Backend): Sets utility function origin, defaults to `Vectorized.

Args:

  • array (NDArray): An Array.

Returns:

  • NDArray

Raises

Overload 2

atan[dtype: DType](A: Matrix[dtype]) -> Matrix[dtype]

Parameters:

  • dtype (DType)

Args:

  • A (Matrix)

Returns:

  • Matrix

atan2

atan2[dtype: DType, backend: Backend = Vectorized](array1: NDArray[dtype], array2: NDArray[dtype]) -> NDArray[dtype]

Apply atan2 also known as inverse tangent. atan2 wikipedia.

Constraints

Both arrays must have the same shapes.

Parameters:

  • dtype (DType): The element type.
  • backend (Backend): Sets utility function origin, defaults to `Vectorized.

Args:

  • array1 (NDArray): An Array.
  • array2 (NDArray): An Array.

Returns:

  • NDArray

Raises

cos

Overload 1

cos[dtype: DType, backend: Backend = Vectorized](array: NDArray[dtype]) -> NDArray[dtype]

Apply cos also known as cosine.

Parameters:

  • dtype (DType): The element type.
  • backend (Backend): Sets utility function origin, defaults to `Vectorized.

Args:

  • array (NDArray): An Array assumed to be in radian.

Returns:

  • NDArray

Raises

Overload 2

cos[dtype: DType](A: Matrix[dtype]) -> Matrix[dtype]

Parameters:

  • dtype (DType)

Args:

  • A (Matrix)

Returns:

  • Matrix

sin

Overload 1

sin[dtype: DType, backend: Backend = Vectorized](array: NDArray[dtype]) -> NDArray[dtype]

Apply sin also known as sine .

Parameters:

  • dtype (DType): The element type.
  • backend (Backend): Sets utility function origin, defaults to `Vectorized.

Args:

  • array (NDArray): An Array assumed to be in radian.

Returns:

  • NDArray

Raises

Overload 2

sin[dtype: DType](A: Matrix[dtype]) -> Matrix[dtype]

Parameters:

  • dtype (DType)

Args:

  • A (Matrix)

Returns:

  • Matrix

tan

Overload 1

tan[dtype: DType, backend: Backend = Vectorized](array: NDArray[dtype]) -> NDArray[dtype]

Apply tan also known as tangent .

Parameters:

  • dtype (DType): The element type.
  • backend (Backend): Sets utility function origin, defaults to `Vectorized.

Args:

  • array (NDArray): An Array assumed to be in radian.

Returns:

  • NDArray

Raises

Overload 2

tan[dtype: DType](A: Matrix[dtype]) -> Matrix[dtype]

Parameters:

  • dtype (DType)

Args:

  • A (Matrix)

Returns:

  • Matrix

hypot

hypot[dtype: DType, backend: Backend = Vectorized](array1: NDArray[dtype], array2: NDArray[dtype]) -> NDArray[dtype]

Apply hypot also known as hypotenuse which finds the longest section of a right triangle given the other two sides.

Constraints

Both arrays must have the same shapes.

Parameters:

  • dtype (DType): The element type.
  • backend (Backend): Sets utility function origin, defaults to `Vectorized.

Args:

  • array1 (NDArray): An Array.
  • array2 (NDArray): An Array.

Returns:

  • NDArray

Raises

hypot_fma

hypot_fma[dtype: DType, backend: Backend = Vectorized](array1: NDArray[dtype], array2: NDArray[dtype]) -> NDArray[dtype]

Apply hypot also known as hypotenuse which finds the longest section of a right triangle given the other two sides.

Constraints

Both arrays must have the same shapes.

Parameters:

  • dtype (DType): The element type.
  • backend (Backend): Sets utility function origin, defaults to `Vectorized.

Args:

  • array1 (NDArray): An Array.
  • array2 (NDArray): An Array.

Returns:

  • NDArray

Raises