
OpenVMS VAX RTL Mathematics (MTH$) Manual
MTH$CxCOS
The Cosine of a Complex Number routine returns the cosine of a complex
number.
Format
MTH$CDCOS complexcosine ,complexnumber
MTH$CGCOS complexcosine ,complexnumber
Each of the above formats accepts one of the floatingpoint complex
types as input.
RETURNS
None.
Arguments
complexcosine
OpenVMS usage: 
complex_number 
type: 
D_floating complex, G_floating complex 
access: 
write only 
mechanism: 
by reference 
Complex cosine of the complexnumber. The complex
cosine routines that have Dfloating and Gfloating complex input
values write the address of the complex cosine into the
complexcosine argument. For MTH$CDCOS, the
complexcosine argument specifies a Dfloating complex
number. For MTH$CGCOS, the complexcosine argument
specifies a Gfloating complex number.
complexnumber
OpenVMS usage: 
complex_number 
type: 
D_floating complex, G_floating complex 
access: 
read only 
mechanism: 
by reference 
A complex number (r,i) where r and i are floatingpoint numbers. The
complexnumber argument is the address of this complex
number. For MTH$CDCOS, complexnumber specifies a
Dfloating complex number. For MTH$CGCOS,
complexnumber specifies a Gfloating complex number.
Description
The complex cosine is calculated as follows: result = (COS(r) *
COSH(i), SIN(r) * SINH(i))
Condition Values Signaled
SS$_ROPRAND

Reserved operand. The MTH$CxCOS routine encountered a floatingpoint
reserved operand due to incorrect user input. A floatingpoint reserved
operand is a floatingpoint datum with a sign bit of 1 and a biased
exponent of 0. Floatingpoint reserved operands are reserved for future
use by Compaq.

MTH$_FLOOVEMAT

Floatingpoint overflow in Math Library: the absolute value of
i is greater than about 88.029 for Ffloating and
Dfloating values, or greater than 709.089 for Gfloating values.

Example

C+
C This Fortran example forms the complex
C cosine of a Dfloating complex number using
C MTH$CDCOS and the Fortran random number
C generator RAN.
C
C Declare Z and MTH$CDCOS as complex values.
C MTH$CDCOS will return the cosine value of
C Z: Z_NEW = MTH$CDCOS(Z)
C
COMPLEX*16 Z,Z_NEW,MTH$CDCOS
COMPLEX*16 DCMPLX
INTEGER M
M = 1234567
C+
C Generate a random complex number with the
C Fortran generic DCMPLX.
C
Z = DCMPLX(RAN(M),RAN(M))
C+
C Z is a complex number (r,i) with real part "r" and
C imaginary part "i".
C
TYPE *, ' The complex number z is',z
TYPE *, ' '
C+
C Compute the complex cosine value of Z.
C
Z_NEW = MTH$CDCOS(Z)
TYPE *, ' The complex cosine value of',z,' is',Z_NEW
END

This Fortran example program demonstrates the use of MTH$CxCOS, using
the MTH$CDCOS entry point. Notice the high precision of the output
generated:
The complex number z is (0.8535407185554504,0.2043401598930359)
The complex cosine value of (0.8535407185554504,0.2043401598930359) is
(0.6710899028500762,0.1550672019621661)

MTH$CEXP
The Complex Exponential (FFloating Value) routine returns the complex
exponential of a complex number as an Ffloating value.
Format
MTH$CEXP complexnumber
RETURNS
OpenVMS usage: 
complex_number 
type: 
F_floating complex 
access: 
write only 
mechanism: 
by value 
Complex exponential of the complex input number. MTH$CEXP returns an
Ffloating complex number.
Argument
complexnumber
OpenVMS usage: 
complex_number 
type: 
F_floating complex 
access: 
read only 
mechanism: 
by reference 
Complex number whose complex exponential is to be returned. This
complex number has the form (r,i), where r is the real part and i is
the imaginary part. The complexnumber argument is the
address of this complex number. For MTH$CEXP,
complexnumber specifies an Ffloating number.
Description
The complex exponential is computed as follows: complexexponent =
(EXP(r)*COS(i), EXP(r)*SIN(i))
See MTH$CxEXP for the descriptions of the D and Gfloating point
versions of this routine.
Condition Values Signaled
SS$_ROPRAND

Reserved operand. The MTH$CEXP routine encountered a floatingpoint
reserved operand due to incorrect user input. A floatingpoint reserved
operand is a floatingpoint datum with a sign bit of 1 and a biased
exponent of 0. Floatingpoint reserved operands are reserved for future
use by Compaq.

MTH$_FLOOVEMAT

Floatingpoint overflow in Math Library: the absolute value of
r is greater than about 88.029 for Ffloating values.

Example

C+
C This Fortran example forms the complex exponential
C of an Ffloating complex number using MTH$CEXP
C and the Fortran random number generator RAN.
C
C Declare Z and MTH$CEXP as complex values. MTH$CEXP
C will return the exponential value of Z: Z_NEW = MTH$CEXP(Z)
C
COMPLEX Z,Z_NEW,MTH$CEXP
COMPLEX CMPLX
INTEGER M
M = 1234567
C+
C Generate a random complex number with the
C Fortran generic CMPLX.
C
Z = CMPLX(RAN(M),RAN(M))
C+
C Z is a complex number (r,i) with real part "r"
C and imaginary part "i".
C
TYPE *, ' The complex number z is',z
TYPE *, ' It has real part',REAL(Z),'and imaginary part',AIMAG(Z)
TYPE *, ' '
C+
C Compute the complex exponential value of Z.
C
Z_NEW = MTH$CEXP(Z)
TYPE *, ' The complex exponential value of',z,' is',Z_NEW
END

This Fortran program demonstrates the use of MTH$CEXP as a function
call. The output generated by this example is as follows:
The complex number z is (0.8535407,0.2043402)
It has real part 0.8535407 and imaginary part 0.2043402
The complex exponential value of (0.8535407,0.2043402) is
(2.299097,0.4764476)

MTH$CxEXP
The Complex Exponential routine returns the complex exponential of a
complex number.
Format
MTH$CDEXP complexexponent ,complexnumber
MTH$CGEXP complexexponent ,complexnumber
Each of the above formats accepts one of the floatingpoint complex
types as input.
RETURNS
None.
Arguments
complexexponent
OpenVMS usage: 
complex_number 
type: 
D_floating complex, G_floating complex 
access: 
write only 
mechanism: 
by reference 
Complex exponential of complexnumber. The complex
exponential routines that have Dfloating complex and Gfloating
complex input values write the complexexponent into
this argument. For MTH$CDEXP, complexexponent
argument specifies a Dfloating complex number. For MTH$CGEXP,
complexexponent specifies a Gfloating complex number.
complexnumber
OpenVMS usage: 
complex_number 
type: 
D_floating complex, G_floating complex 
access: 
read only 
mechanism: 
by reference 
Complex number whose complex exponential is to be returned. This
complex number has the form (r,i), where r is the real part
and i is the imaginary part. The
complexnumber argument is the address of this complex
number. For MTH$CDEXP, complexnumber specifies a
Dfloating number. For MTH$CGEXP, complexnumber
specifies a Gfloating number.
Description
The complex exponential is computed as follows: complexexponent =
(EXP(r)*COS(i), EXP(r)*SIN(i))
Condition Values Signaled
SS$_ROPRAND

Reserved operand. The MTH$CxEXP routine encountered a floatingpoint
reserved operand due to incorrect user input. A floatingpoint reserved
operand is a floatingpoint datum with a sign bit of 1 and a biased
exponent of 0. Floatingpoint reserved operands are reserved for future
use by Compaq.

MTH$_FLOOVEMAT

Floatingpoint overflow in Math Library: the absolute value of
r is greater than about 88.029 for Dfloating values,
or greater than about 709.089 for Gfloating values.

Example

C+
C This Fortran example forms the complex exponential
C of a Gfloating complex number using MTH$CGEXP
C and the Fortran random number generator RAN.
C
C Declare Z and MTH$CGEXP as complex values.
C MTH$CGEXP will return the exponential value
C of Z: CALL MTH$CGEXP(Z_NEW,Z)
C
COMPLEX*16 Z,Z_NEW
COMPLEX*16 MTH$GCMPLX
REAL*8 R,I
INTEGER M
M = 1234567
C+
C Generate a random complex number with the Fortran
C generic CMPLX.
C
R = RAN(M)
I = RAN(M)
Z = MTH$GCMPLX(R,I)
TYPE *, ' The complex number z is',z
TYPE *, ' '
C+
C Compute the complex exponential value of Z.
C
CALL MTH$CGEXP(Z_NEW,Z)
TYPE *, ' The complex exponential value of',z,' is',Z_NEW
END

This Fortran example demonstrates how to access MTH$CGEXP as a
procedure call. Because Gfloating numbers are used, this program must
be compiled using the command "Fortran/G filename".
Notice the high precision of the output generated:
The complex number z is (0.853540718555450,0.204340159893036)
The complex exponential value of (0.853540718555450,0.204340159893036) is
(2.29909677719458,0.476447678044977)

MTH$CLOG
The Complex Natural Logarithm (FFloating Value) routine returns the
complex natural logarithm of a complex number as an Ffloating value.
Format
MTH$CLOG complexnumber
RETURNS
OpenVMS usage: 
complex_number 
type: 
F_floating complex 
access: 
write only 
mechanism: 
by value 
The complex natural logarithm of a complex number. MTH$CLOG returns an
Ffloating complex number.
Argument
complexnumber
OpenVMS usage: 
complex_number 
type: 
F_floating complex 
access: 
read only 
mechanism: 
by reference 
Complex number whose complex natural logarithm is to be returned. This
complex number has the form (r,i), where r is the real part and i is
the imaginary part. The complexnumber argument is the
address of this complex number. For MTH$CLOG,
complexnumber specifies an Ffloating number.
Description
The complex natural logarithm is computed as follows: CLOG(x) =
(LOG(CABS(x)), ATAN2(i,r))
See MTH$CxLOG for the D and Gfloating point versions of this
routine.
Condition Value Signaled
SS$_ROPRAND

Reserved operand. The MTH$CLOG routine encountered a floatingpoint
reserved operand (a floatingpoint datum with a sign bit of 1 and a
biased exponent of 0) due to incorrect user input. Floatingpoint
reserved operands are reserved for use by Compaq.

Example
See Section 1.7.4 for examples of using MTH$CLOG from VAX MACRO.
MTH$CxLOG
The Complex Natural Logarithm routine returns the complex natural
logarithm of a complex number.
Format
MTH$CDLOG complexnaturallog ,complexnumber
MTH$CGLOG complexnaturallog ,complexnumber
Each of the above formats accepts one of the floatingpoint complex
types as input.
RETURNS
None.
Arguments
complexnaturallog
OpenVMS usage: 
complex_number 
type: 
D_floating complex, G_floating complex 
access: 
write only 
mechanism: 
by reference 
Natural logarithm of the complex number specified by
complexnumber. The complex natural logarithm routines
that have Dfloating complex and Gfloating complex input values write
the address of the complex natural logarithm into
complexnaturallog. For MTH$CDLOG, the
complexnaturallog argument specifies a Dfloating
complex number. For MTH$CGLOG, the complexnaturallog
argument specifies a Gfloating complex number.
complexnumber
OpenVMS usage: 
complex_number 
type: 
D_floating complex, G_floating complex 
access: 
read only 
mechanism: 
by reference 
Complex number whose complex natural logarithm is to be returned. This
complex number has the form (r,i), where r is the real part and i is
the imaginary part. The complexnumber argument is the
address of this complex number. For MTH$CDLOG,
complexnumber specifies a Dfloating number. For
MTH$CGLOG, complexnumber specifies a Gfloating
number.
Description
The complex natural logarithm is computed as follows: CLOG(x) =
(LOG(CABS(x)), ATAN2(i,r))
Condition Value Signaled
SS$_FLTOVF_F

Floating point overflow can occur. This condition value is signaled
from MTH$CxABS when MTH$CxABS overflows.

SS$_ROPRAND

Reserved operand. The MTH$CxLOG routine encountered a floatingpoint
reserved operand due to incorrect user input. A floatingpoint reserved
operand is a floatingpoint datum with a sign bit of 1 and a biased
exponent of 0. Floatingpoint reserved operands are reserved for future
use by Compaq.

MTH$_INVARGMAT

Invalid argument: r = i = 0 . LIB$SIGNAL copies the floatingpoint
reserved operand to the mechanism argument vector CHF$L_MCH_SAVR0/R1.
The result is the floatingpoint reserved operand unless you have
written a condition handler to change CHF$L_MCH_SAVR0/R1.

Example

C+
C This Fortran example forms the complex logarithm of a Dfloating complex
C number by using MTH$CDLOG and the Fortran random number generator RAN.
C
C Declare Z and MTH$CDLOG as complex values. Then MTH$CDLOG
c returns the logarithm of Z: CALL MTH$CDLOG(Z_NEW,Z).
C
C Declare Z, Z_LOG, MTH$DCMPLX as complex values, and R, I as real values.
C MTH$DCMPLX takes two real arguments and returns one complex number.
C
C Given complex number Z, MTH$CDLOG(Z) returns the complex natural
C logarithm of Z.
C
COMPLEX*16 Z,Z_NEW,MTH$DCMPLX
REAL*8 R,I
R = 3.1425637846746565
I = 7.43678469887
Z = MTH$DCMPLX(R,I)
C+
C Z is a complex number (r,i) with real part "r" and imaginary part "i".
C
TYPE *, ' The complex number z is',z
TYPE *, ' '
CALL MTH$CDLOG(Z_NEW,Z)
TYPE *,' The complex logarithm of',z,' is',Z_NEW
END

This Fortran example program uses MTH$CDLOG by calling it as a
procedure. The output generated by this program is as follows:
The complex number z is (3.142563784674657,7.436784698870000)
The complex logarithm of (3.142563784674657,7.436784698870000) is
(2.088587642177504,1.170985519274141)

MTH$CMPLX
The Complex Number Made from FFloating Point routine returns a complex
number from two floatingpoint input values.
Format
MTH$CMPLX realpart ,imaginarypart
RETURNS
OpenVMS usage: 
complex_number 
type: 
F_floating complex 
access: 
write only 
mechanism: 
by value 
A complex number. MTH$CMPLX returns an Ffloating complex number.
Arguments
realpart
OpenVMS usage: 
floating_point 
type: 
F_floating 
access: 
read only 
mechanism: 
by reference 
Real part of a complex number. The realpart argument
is the address of a floatingpoint number that contains this real part,
r, of (r,i). For MTH$CMPLX, realpart specifies an
Ffloating number.
imaginarypart
OpenVMS usage: 
floating_point 
type: 
F_floating 
access: 
read only 
mechanism: 
by reference 
Imaginary part of a complex number. The imaginarypart
argument is the address of a floatingpoint number that contains this
imaginary part, i, of (r,i). For MTH$CMPLX,
imaginarypart specifies an Ffloating number.
Description
The MTH$CMPLX routine returns a complex number from two Ffloating
input values. See MTH$xCMPLX for the D and Gfloating point versions
of this routine.
Condition Value Signaled
SS$_ROPRAND

Reserved operand. The MTH$CMPLX routine encountered a floatingpoint
reserved operand due to incorrect user input. A floatingpoint reserved
operand is a floatingpoint datum with a sign bit of 1 and a biased
exponent of 0. Floatingpoint reserved operands are reserved for future
use by Compaq.

Example

C+
C This Fortran example forms two Ffloating
C point complex numbers using MTH$CMPLX
C and the Fortran random number generator RAN.
C
C Declare Z and MTH$CMPLX as complex values, and R
C and I as real values. MTH$CMPLX takes two real
C Ffloating point values and returns one COMPLEX*8 number.
C
C Note, since CMPLX is a generic name in Fortran, it would be
C sufficient to use CMPLX.
C CMPLX must be declared to be of type COMPLEX*8.
C
C Z = CMPLX(R,I)
C
COMPLEX Z,MTH$CMPLX,CMPLX
REAL*4 R,I
INTEGER M
M = 1234567
R = RAN(M)
I = RAN(M)
Z = MTH$CMPLX(R,I)
C+
C Z is a complex number (r,i) with real part "r" and
C imaginary part "i".
C
TYPE *, ' The two input values are:',R,I
TYPE *, ' The complex number z is',z
z = CMPLX(RAN(M),RAN(M))
TYPE *, ' '
TYPE *, ' Using the Fortran generic CMPLX with random R and I:'
TYPE *, ' The complex number z is',z
END

This Fortran example program demonstrates the use of MTH$CMPLX. The
output generated by this program is as follows:
The two input values are: 0.8535407 0.2043402
The complex number z is (0.8535407,0.2043402)
Using the Fortran generic CMPLX with random R and I:
The complex number z is (0.5722565,0.1857677)

