Chapter 2: Trigonometric and Hyperbolic Functions

TANH

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

Function Return Value

TANH — Complex function value.   (Output)

Required Arguments

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

FORTRAN 90 Interface

Generic:                              TANH (Z)

Specific:                             The specific interface names are CTANH and ZTANH.

FORTRAN 77 Interface

Complex:                            CTANH (Z)

Double complex:               The double complex function name is ZTANH.

Description

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

Example

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

 

      USE TANH_INT

      USE UMACH_INT

 

      IMPLICIT   NONE

!                                 Declare variables

      INTEGER    NOUT

      COMPLEX    VALUE, Z

!                                 Compute

      Z     = (1.0, 1.0)

      VALUE = TANH(Z)

!                                 Print the results

      CALL UMACH (2, NOUT)

      WRITE (NOUT,99999) Z, VALUE

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

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

      END

Output

 

TANH(( 1.000, 1.000)) = ( 1.084, 0.272)



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