complex_numbers_test
Complex Numbers in FORTRAN77 Programming


complex_numbers_test, a FORTRAN77 program which demonstrates very briefly some of the features of using complex numbers.

The first issue is how to declare a complex variable, including the choice of single precision or double precision, whether the variable is a scalar, vector, or array, and whether the variable is initialized with a value, or assigned one.

A second issue concerns the question of how a complex variable is to be printed out.

Another issue concerns how a complex variable is to operated on by the arithmetic operators of addition, subtraction, multiplication, division, and exponentiation.

The language also provides a number of intrinsic functions that can be applied to a complex variable. The names of these functions can sometimes be easy to forget. Moreover, it is occasionally true that there may be a selection of functions with similar names (say, "exp", "cexp" and "dcexp") which may or may not produce the desired results.

Another issue concerns the details of double precision calculation. Even a single accidental use of a single precision function name in a double precision computation can result in the loss of half the digits of accuracy. Thus, it sometimes really matters whether you use "cmplx" or "dcmplx" to assign values to a double precision complex variable.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

complex_numbers_test is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version and a Python version.

Related Data and Programs:

C4LIB, a FORTRAN77 library which implements certain elementary functions for "C4" or single precision complex variables;

C8LIB, a FORTRAN77 library which implements certain elementary functions for "C8" or double precision complex variables;

F77_INTRINSICS, FORTRAN77 programs which includes some examples of the use of intrinsic functions included with the FORTRAN77 standard language.

G77_INTRINSICS, FORTRAN77 programs which includes some examples of the use of intrinsic functions included with the G77 compiler.

GFORTRAN_INTRINSICS, a FORTRAN77 program which demonstrates the use of some of the intrinsic functions included with the GFORTRAN compiler.

Source Code:


Last revised on 04 November 2010.