Next: , Previous: Complex Arithmetic, Up: Arithmetic


19.3 Trigonometry

Octave provides the following trigonometric functions. Angles are specified in radians. To convert from degrees to radians multipy by pi/180 (e.g. sin (30 * pi/180) returns the sine of 30 degrees).

— Mapping Function: sin (x)

Compute the sine of each element of x.

— Mapping Function: cos (x)

Compute the cosine of each element of x.

— Mapping Function: tan (z)

Compute tangent of each element of x.

— Mapping Function: sec (x)

Compute the secant of each element of x.

— Mapping Function: csc (x)

Compute the cosecant of each element of x.

— Mapping Function: cot (x)

Compute the cotangent of each element of x.

— Mapping Function: asin (x)

Compute the inverse sine of each element of x.

— Mapping Function: acos (x)

Compute the inverse cosine of each element of x.

— Mapping Function: atan (x)

Compute the inverse tangent of each element of x.

— Mapping Function: asec (x)

Compute the inverse secant of each element of x.

— Mapping Function: acsc (x)

Compute the inverse cosecant of each element of x.

— Mapping Function: acot (x)

Compute the inverse cotangent of each element of x.

— Mapping Function: sinh (x)

Compute the hyperbolic sine of each element of x.

— Mapping Function: cosh (x)

Compute the hyperbolic cosine of each element of x.

— Mapping Function: tanh (x)

Compute hyperbolic tangent of each element of x.

— Mapping Function: sech (x)

Compute the hyperbolic secant of each element of x.

— Mapping Function: csch (x)

Compute the hyperbolic cosecant of each element of x.

— Mapping Function: coth (x)

Compute the hyperbolic cotangent of each element of x.

— Mapping Function: asinh (x)

Compute the inverse hyperbolic sine of each element of x.

— Mapping Function: acosh (x)

Compute the inverse hyperbolic cosine of each element of x.

— Mapping Function: atanh (x)

Compute the inverse hyperbolic tangent of each element of x.

— Mapping Function: asech (x)

Compute the inverse hyperbolic secant of each element of x.

— Mapping Function: acsch (x)

Compute the inverse hyperbolic cosecant of each element of x.

— Mapping Function: acoth (x)

Compute the inverse hyperbolic cotangent of each element of x.

Each of these functions expect a single argument. For matrix arguments, they work on an element by element basis. For example,

     sin ([1, 2; 3, 4])
          =>  0.84147   0.90930
              0.14112  -0.75680

— Mapping Function: atan2 (y, x)

Compute atan (y / x) for corresponding elements of y and x. The result is in range -pi to pi.