Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace TrigCyclic

Index

Functions

Functions

acos

  • Calculates the inverse trigonometric cosine of a number with rounding according to the given context.

    Method:

    If \( \lvert x \rvert < 0.5 \), \[ \cos^{-1} x = \frac{\pi}{2} - \sin^{-1} x \]

    otherwise, \[ \cos^{-1} x = 2 \sin^{-1} \sqrt{\frac{1-x}{2}} \]

    see

    asin

    Parameters

    Returns Component

asin

  • Calculates the inverse trigonometric sine of a number with rounding according to the given context.

    Method:

    If \( x < 0.5 \) use the definition from integration:

    \[ \sin^{-1} x = \int_0^x \frac{dt}{\sqrt{1-t^2}} \]

    Since \( x < 1 \)

    \[ \sin^{-1} = \sum_{n=0}^\infty \frac{(2n-1)!!}{2^n n!} \cdot \frac{x^{2n+1}}{2n+1} \]

    If \( x \geqslant 0.5 \)

    \[ \sin^{-1} x = \frac{\pi}{2} - \sin^{-1} \sqrt{\frac{1-x}{2}} \]

    Parameters

    Returns Component

atan

  • Calculates the inverse trigonometric tangent of a number with rounding according to the given context.

    Method:

    The input can be divided into 4 regions for fast convergence.

    1. \( 0 \leqslant x < \sqrt{2}-1 \):

    \[ \tan^{-1} = \sum_{n=0}^{\infty} (-1)^n \frac{x^{2n+1}}{2n+1} \]

    1. \( \sqrt{2}-1 \leqslant x < 1 \):

    \[ \tan^{-1} x = \frac{\pi}{4} - \tan^{-1} \left( \frac{1-x}{1+x} \right) \]

    1. \( 1 \leqslant x < \sqrt{2}+1 \):

    \[ \tan^{-1} x = \frac{\pi}{4} + \tan^{-1} \left( \frac{x-1}{x+1} \right) \]

    1. \( x \geqslant \sqrt{2}+1 \):

    \[ \tan^{-1} x = \frac{\pi}{4} + \tan^{-1} \left( \frac{1}{x} \right) \]

    Parameters

    Returns Component

atan2

  • Calculates the solution for \( \theta \) for the set of equations

    \[ \begin{align} x &= r \cos \theta \\ y &= r \sin \theta \end{align} \]

    Put simply, the above boils down to \[ \operatorname{atan2}(y, x) = \begin{cases} \arctan(\frac{y}{x}) &\text{if } x > 0, \\ \arctan(\frac{y}{x}) + \pi &\text{if } x < 0 \text{ and } y \geqslant 0, \\ \arctan(\frac{y}{x}) - \pi &\text{if } x < 0 \text{ and } y < 0, \\ +\frac{\pi}{2} &\text{if } x = 0 \text{ and } y > 0, \\ -\frac{\pi}{2} &\text{if } x = 0 \text{ and } y < 0, \\ \text{undefined} &\text{if } x = 0 \text{ and } y = 0 \end{cases} \]

    Parameters

    Returns Component

cos

  • Calculates the trigonometric cosine with rounding according to the given context.

    Method:

    For \( x < 2\pi \) The Taylor series converges for all \( x \).

    \[ \cos x = \sum_{n=0}^{\infty} (-1)^n \frac{x^{2n}}{(2n)!} \]

    For \( x \geqslant 2\pi \), range reduction can be performed. The \( \cos x \) function has a periodicity of \( 2\pi \).

    \[ x \equiv f \pmod{2\pi} \]

    Parameters

    Returns Component

sin

  • Calculates the trigonometric sine with rounding according to the given context.

    Method:

    For \( x < 2\pi \) The Taylor series converges for all \( x \).

    \[ \sin x = \sum_{n=0}^{\infty} (-1)^n \frac{x^{2n+1}}{(2n+1)!} \]

    For \( x \geqslant 2\pi \), range reduction can be performed. The \( \sin x \) function has a periodicity of \( 2\pi \).

    \[ x \equiv f \pmod{2\pi} \]

    Parameters

    Returns Component

tan

Generated using TypeDoc