Chapter 1: Elementary Functions

CARG

This function evaluates the argument of a complex number.

Function Return Value

CARG — Function value.   (Output)
If z = x + iy, then arctan(y/x) is returned except when both x and y are zero. In this case, zero is returned.

Required Arguments

Z — Complex number for which the argument is to be evaluated.   (Input)

FORTRAN 90 Interface

Generic:                              CARG (Z)

Specific:                             The specific interface names are S_CARG and D_CARG.

FORTRAN 77 Interface

Single:              CARG (Z)

Double:                              The double precision function name is ZARG.

Description

Arg(z) is the angle θ in the polar representation z = |z| eiθ, where

If z = x + iy, then θ = tan1 (y/x) except when both x and y are zero. In this case, θ is defined to be zero

Example

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

 

      USE CARG_INT

      USE UMACH_INT

 

      IMPLICIT   NONE

!                                 Declare variables

      INTEGER    NOUT

      REAL       VALUE

      COMPLEX    Z

!                                 Compute

      Z     = (1.0, 1.0)

      VALUE = CARG(Z)

!                                 Print the results

      CALL UMACH (2, NOUT)

      WRITE (NOUT,99999) Z, VALUE

99999 FORMAT (' CARG(', F6.3, ',', F6.3, ') = ', F6.3)

      END

Output

 

CARG( 1.000, 1.000) =  0.785



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