Manual Reference Pages  - cos (3fortran)

NAME

COS(3) - [MATHEMATICS:TRIGONOMETRIC] Cosine function

SYNOPSIS

result = cos(x)

         elemental TYPE(kind=KIND) function cos(x)

TYPE(kind=KIND),intent(in) :: x

CHARACTERISTICS

o X is of type real or complex of any valid kind.
o KIND may be any kind supported by the associated type of X.
o The returned value will be of the same type and kind as the argument X.

DESCRIPTION

COS(3) computes the cosine of an angle X given the size of the angle in radians.

The cosine of a real value is the ratio of the adjacent side to the hypotenuse of a right-angled triangle.

OPTIONS

o X : The angle in radians to compute the cosine of.

RESULT

The return value is the tangent of X.

If X is of the type real, the return value is in radians and lies in the range -1 <= COS(X) <= 1 .

If X is of type complex, its real part is regarded as a value in radians, often called the phase.

EXAMPLES

Sample program:

    program demo_cos
    implicit none
    character(len=*),parameter :: g2=’(a,t20,g0)’
    doubleprecision,parameter :: PI=atan(1.0d0)*4.0d0
       write(*,g2)’COS(0.0)=’,cos(0.0)
       write(*,g2)’COS(PI)=’,cos(PI)
       write(*,g2)’COS(PI/2.0d0)=’,cos(PI/2.0d0),’EPSILON=’,epsilon(PI)
       write(*,g2)’COS(2*PI)=’,cos(2*PI)
       write(*,g2)’COS(-2*PI)=’,cos(-2*PI)
       write(*,g2)’COS(-2000*PI)=’,cos(-2000*PI)
       write(*,g2)’COS(3000*PI)=’,cos(3000*PI)
    end program demo_cos

Results:

     > COS(0.0)=          1.000000
     > COS(PI)=           -1.000000000000000
     > COS(PI/2.0d0)=     .6123233995736766E-16
     > EPSILON=           .2220446049250313E-15
     > COS(2*PI)=         1.000000000000000
     > COS(-2*PI)=        1.000000000000000
     > COS(-2000*PI)=     1.000000000000000
     > COS(3000*PI)=      1.000000000000000

STANDARD

FORTRAN 77

SEE ALSO

ACOS(3), SIN(3), TAN(3)

RESOURCES

o Wikipedia:sine and cosine
Fortran intrinsic descriptions


Nemo Release 3.1 cos (3fortran) November 02, 2024
Generated by manServer 1.08 from 84831521-9247-407b-acb3-6dc4917fb4b1 using man macros.