Trigonometry Next: Previous: Complex Arithmetic Up: Arithmetic



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).

sin (x) Mapping Function
Compute the sine of each element of x.

cos (x) Mapping Function
Compute the cosine of each element of x.

tan (z) Mapping Function
Compute tangent of each element of x.

sec (x) Mapping Function
Compute the secant of each element of x.

csc (x) Mapping Function
Compute the cosecant of each element of x.

cot (x) Mapping Function
Compute the cotangent of each element of x.

asin (x) Mapping Function
Compute the inverse sine of each element of x.

acos (x) Mapping Function
Compute the inverse cosine of each element of x.

atan (x) Mapping Function
Compute the inverse tangent of each element of x.

asec (x) Mapping Function
Compute the inverse secant of each element of x.

acsc (x) Mapping Function
Compute the inverse cosecant of each element of x.

acot (x) Mapping Function
Compute the inverse cotangent of each element of x.

sinh (x) Mapping Function
Compute the inverse hyperbolic sine of each element of x.

cosh (x) Mapping Function
Compute the hyperbolic cosine of each element of x.

tanh (x) Mapping Function
Compute hyperbolic tangent of each element of x.

sech (x) Mapping Function
Compute the hyperbolic secant of each element of x.

csch (x) Mapping Function
Compute the hyperbolic cosecant of each element of x.

coth (x) Mapping Function
Compute the hyperbolic cotangent of each element of x.

asinh (x) Mapping Function
Compute the inverse hyperbolic sine of each element of x.

acosh (x) Mapping Function
Compute the inverse hyperbolic cosine of each element of x.

atanh (x) Mapping Function
Compute the inverse hyperbolic tangent of each element of x.

asech (x) Mapping Function
Compute the inverse hyperbolic secant of each element of x.

acsch (x) Mapping Function
Compute the inverse hyperbolic cosecant of each element of x.

acoth (x) Mapping Function
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
     

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