Real trig functions

Floating point sine, cosine, tangent about θ = 0

The named only argument n must be at least 22 to agree with the ones from Python’s stdlib math.

Tip

For 0 |z| < 1 you can get away with smaller n values to reduce the number of computations.

boring_math.special_functions.trigonometry.trig0.sin0(θ: float, /, n: int = epth)) float

Sine centered at x = 0

Partially factored Taylor series expansion of sine centered at x = 0.

param θ:

Angle in radians.

param n:

Terms in expansion, must have 2 <= n <= 84.

returns:

The value of sine(θ).

Tip

Best n to use

  • n >= 20 when -2π <= θ <= 2π

  • n >= 15 when -π <= θ <= π

  • n >= 12 when -π/2 <= θ <= π/2

The default is n=20.

boring_math.special_functions.trigonometry.trig0.cos0(θ: float, /, n: int = epth)) float

Cosine centered at x = 0

Partially factored Taylor series expansion of cosine centered at x = 0.

param θ:

Angle in radians.

param n:

Terms in expansion, must have 2 <= n <= 84.

returns:

The value of cosine(θ).

Tip

Best n to use

  • n >= 20 when -2π <= θ <= 2π

  • n >= 15 when -π <= θ <= π

  • n >= 12 when -π/2 <= θ <= π/2

The default is n = 20.

boring_math.special_functions.trigonometry.trig0.tan0(θ: float, /, n: int = epth)) float

Tangent centered at θ = 0.

Partially factored Taylor series expansion of tangent centered at θ = 0.

param θ:

Angle in radians.

param n:

Terms in expansion, must have 2 <= n <= 84.

returns:

The value sin0(θ)/cos0(θ).

Tip

Best n to use

  • n >= 20 when -2π <= θ <= 2π

  • n >= 15 when -π <= θ <= π

  • n >= 12 when -π/2 <= θ <= π/2

The default is n=20.

Floating point trigonometric functions.

Valid for all extended real value θ.

boring_math.special_functions.trigonometry.trig.sin(θ: float) float

Sine for all real θ

param θ:

Angle in radians.

returns:

Sine of angle θ.

boring_math.special_functions.trigonometry.trig.cos(θ: float) float

Cosine for all real θ

param θ:

Angle in radians.

returns:

Cosine of angle θ.

boring_math.special_functions.trigonometry.trig.tan(θ: float) float

Tangent for all real θ

param θ:

Angle in radians.

returns:

Tangent of angle θ.