the Technology Interface / Spring97
Derived Trigonometric Functions
from the Technology Interface

#### by

Richard M. Bender PE
rick@vms.cis.pitt.edu
Engineering Technology Division
University of Pittsburgh at Johnstown

Many times in computer programming you need a trig function that is not in the programming language library. Below are a few that my students and I found useful. These are written in BASIC but are easily converted to PASCAL, FORTRAN, C and other languages.

#### DERIVED EQUATION (using standard BASIC functions)

• SECANT SEC(X) = 1/COS(X)
• COSECANT CSC(X) = 1/SIN(X)
• COTANGENT COT(X) = 1/TAN(X)
• COMMON LOG LOG10(X) = LOG(X)/2.3025851

#### INVERSE

• SINE ARCSIN(X) = ATN(X/SQR(-X*X+1))
• COSINE ARCCOS(X) = -ATN(X/SQR(-X*X+1))+1.570796
• SECANT ARCSEC(X) = ATN(SQR(X*X-1))+(SGN(X)-1)*1.570796
• COSECANT ARCCSC(X) = ATN(1/SQR(X*X-1))+(SGN(X)-1)*1.570796
• COTANGENT ARCCOT(X) = -ATN(X)+1.570796

#### HYPERBOLIC

• SINE SINH(X) = (EXP(X)-EXP(-X))/2
• COSINE COSH(X) = (EXP(X)+EXP(-X))/2
• TANGENT TANH(X) = -EXP(-X)/(EXP(X)+EXP(-X))*2+1
• SECANT SECH(X) = 2/(EXP(X)+EXP(-X))
• COSECANT CSCH(X) = 2/(EXP(X)-EXP(-X))
• COTANGENT COTH(X) = EXP(-X)/(EXP(X)-EXP(-X))*2+1

#### INVERSE HYPERBOLIC

• SINE ARCSINH(X) = LOG(X+SQR(X*X+1))
• COSINE ARCCOSH(X) = LOG(X+SQR(X*X-1))
• TANGENT ARCTANH(X) = LOG((1+X)/(1-X))/2
• SECANT ARCSECH(X) = LOG((SQR(-X*X+1)/X)
• COSECANT ARCSCH(X) = LOG((SGN(X)*SQR(X*X+1)+1)/X)
• COTANGENT ARCCOTH(X) = LOG((X+1)/(X-1))/2

NOTE: All angles are expressed in radians!