COS(3) - [MATHEMATICS:TRIGONOMETRIC] Cosine function
result = cos(x)
elemental TYPE(kind=KIND) function cos(x)TYPE(kind=KIND),intent(in) :: x
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.
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.
o X : The angle in radians to compute the cosine of.
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.
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_cosResults:
> 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
FORTRAN 77
ACOS(3), SIN(3), TAN(3)
Fortran intrinsic descriptions
o Wikipedia:sine and cosine
Nemo Release 3.1 | cos (3fortran) | November 02, 2024 |