C Library Functions  - cos (3)

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 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 when X is of type real. If X is of type complex, its real part is regarded as a value in radians, often called the phase.

RESULT

The return value is the cosine of X.

If X is type real, the return value lies in the range -1 <= COS(X) <= 1 [char46]

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 (3) February 23, 2025
Generated by manServer 1.08 from a9f83590-c30f-4863-b05d-fe43a885c124 using man macros.