Chapter 2: Trigonometric and Hyperbolic Functions

TAN

This function extends FORTRAN's generic tan to evaluate the complex tangent.

Function Return Value

TAN — Complex function value.   (Output)

Required Arguments

Z — Complex number representing the angle in radians for which the tangent is desired.   (Input)

FORTRAN 90 Interface

Generic:             TAN (Z)

Specific:                             The specific interface names are CTAN and ZTAN.

FORTRAN 77 Interface

Complex :            CTAN (Z)

Double complex:               The double complex function name is ZTAN.

Description

Let z = x + iy. If |cos z|2 is very small, that is, if x is very close to π/2 or 3π/2 and if y is small, then tan z is nearly singular and a fatal error condition is reported. If |cos z|2 is somewhat larger but still small, then the result will be less accurate than half precision. When 2x is so large that sin 2x cannot be evaluated to any nonzero precision, the following situation results. If |y| < 3/2, then CTAN cannot be evaluated accurately to better than one significant figure. If 3/2 |y| < −1/2 ln ɛ/2, then CTAN can be evaluated by ignoring the real part of the argument; however, the answer will be less accurate than half precision. Here, ɛ = AMACH(4) is the machine precision.

Comments

Informational error

Type Code

3         2                  Result of CTAN(Z) is accurate to less than one-half precision because the real part of Z is too near π/2 or 3π/2 when the imaginary part of Z is near zero or because the absolute value of the real part is very large and the absolute value of the imaginary part is small.

Example

In this example, tan(1 + i) is computed and printed.

 

      USE TAN_INT

      USE UMACH_INT

 

      IMPLICIT   NONE

!                                 Declare variables

      INTEGER    NOUT

      COMPLEX    VALUE, Z

!                                 Compute

      Z     = (1.0, 1.0)

      VALUE = TAN(Z)

!                                 Print the results

      CALL UMACH (2, NOUT)

      WRITE (NOUT,99999) Z, VALUE

99999 FORMAT (' TAN((', F6.3, ',', F6.3, ')) = (', &

          F6.3, ',', F6.3, ')')

      END

Output

 

TAN(( 1.000, 1.000)) = ( 0.272, 1.084)



http://www.vni.com/
PHONE: 713.784.3131
FAX:713.781.9260