How to Derive Inverse (ARC) and Hyperbolic Trig Functions (28249)



The information in this article applies to:

  • Microsoft Visual Basic for MS-DOS
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
  • Microsoft Business Basic Compiler for MS-DOS 1.0
  • Microsoft Business Basic Compiler for MS-DOS 1.1
  • Microsoft GW-BASIC 3.2
  • Microsoft GW-BASIC 3.22
  • Microsoft GW-BASIC 3.23
  • Microsoft GW-BASIC 5.28
  • Microsoft BASIC Interpreter for Apple Macintosh 1.0
  • Microsoft BASIC Interpreter for Apple Macintosh 1.01
  • Microsoft BASIC Interpreter for Apple Macintosh 2.0
  • Microsoft BASIC Interpreter for Apple Macintosh 2.1
  • Microsoft BASIC Interpreter for Apple Macintosh 3.0
  • Microsoft BASIC Compiler
  • Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.1
  • Microsoft Basic Interpreter (BASIC86.EXE) for MS-DOS

This article was previously published under Q28249

SUMMARY

From the built-in BASIC functions LOG, COS, SIN, TAN, SGN, EXP, and SQR, you can derive the other transcendental functions as shown below.

This information is also included with the Help file provided with the Standard and Professional Editions of Microsoft Visual Basic for MS-DOS, version 1.0.

MORE INFORMATION

The following trigonometric and mathematical functions that are not intrinsic to Microsoft Visual Basic for MS-DOS can be calculated as shown. In these formulas, X is an angle measured in radians and Y is a unitless number:

Function                  BASIC Equivalent
--------                  ----------------

Secant                    SEC(X) = 1/COS(X)
Cosecant                  CSC(X) = 1/SIN(X)
Cotangent                 COT(X) = 1/TAN(X)
Inverse Sine              ARCSIN(Y) = ATN(Y/SQR(1-Y*Y))
Inverse Cosine            ARCCOS(Y) = -ATN(Y/SQR(1-Y*Y)) + Pi/2
Inverse Secant            ARCSEC(Y) = ATN(Y/SQR(1-Y*Y)) + (SGN(Y)-1)
                                      * Pi/2
Inverse Cosecant          ARCCSC(Y) = ATN(1/SQR(1-Y*Y)) + (SGN(Y)-1)
                                      * Pi/2
Inverse Cotangent         ARCCOT(Y) = -ATN(Y) + Pi/2
Hyperbolic Sine           SINH(Y) = (EXP(Y) - EXP(-Y))/2
Hyperbolic Cosine         COSH(Y) = (EXP(Y) + EXP(-Y))/2
Hyperbolic Tangent        TANH(Y) = (EXP(Y) - EXP(-Y))/(EXP(Y)
                                    + EXP(-Y))
Hyperbolic Secant         SECH(Y) = 2/(EXP(Y) + EXP(-Y))
Hyperbolic Cosecant       CSCH(Y) = 2/(EXP(Y) - EXP(-Y))
Hyperbolic Cotangent      COTH(Y) = EXP(-Y)/(EXP(Y) - EXP(-Y)) * 2 + 1
Inverse Hyperbolic Sine   ARCSINH(Y) = LOG(Y + SQR(Y*Y+1))
Inverse Hyperbolic Cos    ARCCOSH(Y) = LOG(Y + SQR(Y*Y-1))
Inverse Hyperbolic Tan    ARCCTANH(Y) = LOG((1 + Y)/(1 - Y)) / 2
Inverse Hyperbolic CSC    ARCCSCH(Y) = LOG((SGN(Y)*SQR(Y*Y+1)+1)/Y)
Inverse Hyperbolic Sec    ARCSECH(Y) = LOG((SQR(1-Y*Y)+1) / Y)
Inverse Hyperbolic Cot    ARCCOTH(Y) = LOG((Y+1)/(Y-1)) / 2
				
The general formulas listed above may be used in Microsoft Visual Basic for MS-DOS or any other language. Note that the constant Pi has the following approximate value:
   Pi# = 3.14159265359
   Pi# = 4.0# * ATN(1.0#)
				
To convert degrees to radians, multiply the degrees by pi/180.

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB28249