[OpenVMS documentation]
[Site home] [Send comments] [Help with this site] [How to order documentation] [OpenVMS site] [Compaq site]
Updated: 12 December 1998

OpenVMS VAX RTL Mathematics (MTH$) Manual


Previous Contents Index


MTH$CxCOS

The Cosine of a Complex Number routine returns the cosine of a complex number.

Format

MTH$CDCOS complex-cosine ,complex-number

MTH$CGCOS complex-cosine ,complex-number

Each of the above formats accepts one of the floating-point complex types as input.

RETURNS

None.


Arguments

complex-cosine


OpenVMS usage: complex_number
type: D_floating complex, G_floating complex
access: write only
mechanism: by reference

Complex cosine of the complex-number. The complex cosine routines that have D-floating and G-floating complex input values write the address of the complex cosine into the complex-cosine argument. For MTH$CDCOS, the complex-cosine argument specifies a D-floating complex number. For MTH$CGCOS, the complex-cosine argument specifies a G-floating complex number.

complex-number


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 floating-point numbers. The complex-number argument is the address of this complex number. For MTH$CDCOS, complex-number specifies a D-floating complex number. For MTH$CGCOS, complex-number specifies a G-floating 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 floating-point reserved operand due to incorrect user input. A floating-point reserved operand is a floating-point datum with a sign bit of 1 and a biased exponent of 0. Floating-point reserved operands are reserved for future use by Digital.
MTH$_FLOOVEMAT Floating-point overflow in Math Library: the absolute value of i is greater than about 88.029 for F-floating and D-floating values, or greater than 709.089 for G-floating values.

Example


C+ 
C    This Fortran example forms the complex 
C    cosine of a D-floating 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 (F-Floating Value) routine returns the complex exponential of a complex number as an F-floating value.

Format

MTH$CEXP complex-number


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 F-floating complex number.


Argument

complex-number


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 complex-number argument is the address of this complex number. For MTH$CEXP, complex-number specifies an F-floating number.

Description

The complex exponential is computed as follows:
complex-exponent = (EXP(r)*COS(i), EXP(r)*SIN(i))

See MTH$CxEXP for the descriptions of the D- and G-floating point versions of this routine.


Condition Values Signaled

SS$_ROPRAND Reserved operand. The MTH$CEXP routine encountered a floating-point reserved operand due to incorrect user input. A floating-point reserved operand is a floating-point datum with a sign bit of 1 and a biased exponent of 0. Floating-point reserved operands are reserved for future use by Digital.
MTH$_FLOOVEMAT Floating-point overflow in Math Library: the absolute value of r is greater than about 88.029 for F-floating values.

Example


C+ 
C    This Fortran example forms the complex exponential 
C    of an F-floating 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 complex-exponent ,complex-number

MTH$CGEXP complex-exponent ,complex-number

Each of the above formats accepts one of the floating-point complex types as input.

RETURNS

None.


Arguments

complex-exponent


OpenVMS usage: complex_number
type: D_floating complex, G_floating complex
access: write only
mechanism: by reference

Complex exponential of complex-number. The complex exponential routines that have D-floating complex and G-floating complex input values write the complex-exponent into this argument. For MTH$CDEXP, complex-exponent argument specifies a D-floating complex number. For MTH$CGEXP, complex-exponent specifies a G-floating complex number.

complex-number


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 complex-number argument is the address of this complex number. For MTH$CDEXP, complex-number specifies a D-floating number. For MTH$CGEXP, complex-number specifies a G-floating number.

Description

The complex exponential is computed as follows:
complex-exponent = (EXP(r)*COS(i), EXP(r)*SIN(i))

Condition Values Signaled

SS$_ROPRAND Reserved operand. The MTH$CxEXP routine encountered a floating-point reserved operand due to incorrect user input. A floating-point reserved operand is a floating-point datum with a sign bit of 1 and a biased exponent of 0. Floating-point reserved operands are reserved for future use by Digital.
MTH$_FLOOVEMAT Floating-point overflow in Math Library: the absolute value of r is greater than about 88.029 for D-floating values, or greater than about 709.089 for G-floating values.

Example


C+ 
C    This Fortran example forms the complex exponential 
C    of a G-floating 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 G-floating 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 (F-Floating Value) routine returns the complex natural logarithm of a complex number as an F-floating value.

Format

MTH$CLOG complex-number


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 F-floating complex number.


Argument

complex-number


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 complex-number argument is the address of this complex number. For MTH$CLOG, complex-number specifies an F-floating 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 G-floating point versions of this routine.


Condition Value Signaled

SS$_ROPRAND Reserved operand. The MTH$CLOG routine encountered a floating-point reserved operand (a floating-point datum with a sign bit of 1 and a biased exponent of 0) due to incorrect user input. Floating-point reserved operands are reserved for use by Digital.

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 complex-natural-log ,complex-number

MTH$CGLOG complex-natural-log ,complex-number

Each of the above formats accepts one of the floating-point complex types as input.

RETURNS

None.


Arguments

complex-natural-log


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 complex-number. The complex natural logarithm routines that have D-floating complex and G-floating complex input values write the address of the complex natural logarithm into complex-natural-log. For MTH$CDLOG, the complex-natural-log argument specifies a D-floating complex number. For MTH$CGLOG, the complex-natural-log argument specifies a G-floating complex number.

complex-number


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 complex-number argument is the address of this complex number. For MTH$CDLOG, complex-number specifies a D-floating number. For MTH$CGLOG, complex-number specifies a G-floating 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 floating-point reserved operand due to incorrect user input. A floating-point reserved operand is a floating-point datum with a sign bit of 1 and a biased exponent of 0. Floating-point reserved operands are reserved for future use by Digital.
MTH$_INVARGMAT Invalid argument: r = i = 0 . LIB$SIGNAL copies the floating-point reserved operand to the mechanism argument vector CHF$L_MCH_SAVR0/R1. The result is the floating-point 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 D-floating 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 F-Floating Point routine returns a complex number from two floating-point input values.

Format

MTH$CMPLX real-part ,imaginary-part


RETURNS


OpenVMS usage: complex_number
type: F_floating complex
access: write only
mechanism: by value

A complex number. MTH$CMPLX returns an F-floating complex number.


Arguments

real-part


OpenVMS usage: floating_point
type: F_floating
access: read only
mechanism: by reference

Real part of a complex number. The real-part argument is the address of a floating-point number that contains this real part, r, of (r,i). For MTH$CMPLX, real-part specifies an F-floating number.

imaginary-part


OpenVMS usage: floating_point
type: F_floating
access: read only
mechanism: by reference

Imaginary part of a complex number. The imaginary-part argument is the address of a floating-point number that contains this imaginary part, i, of (r,i). For MTH$CMPLX, imaginary-part specifies an F-floating number.

Description

The MTH$CMPLX routine returns a complex number from two F-floating input values. See MTH$xCMPLX for the D- and G-floating point versions of this routine.

Condition Value Signaled

SS$_ROPRAND Reserved operand. The MTH$CMPLX routine encountered a floating-point reserved operand due to incorrect user input. A floating-point reserved operand is a floating-point datum with a sign bit of 1 and a biased exponent of 0. Floating-point reserved operands are reserved for future use by Digital.

Example


C+ 
C    This Fortran example forms two F-floating 
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    F-floating 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) 


Previous Next Contents Index

[Site home] [Send comments] [Help with this site] [How to order documentation] [OpenVMS site] [Compaq site]
[OpenVMS documentation]

Copyright © Compaq Computer Corporation 1998. All rights reserved.

Legal
6117PRO_006.HTML