Manual Reference Pages  - acos (3fortran)

NAME

ACOS(3) - [MATHEMATICS:TRIGONOMETRIC] Arccosine (inverse cosine) function

SYNOPSIS

result = acos(x)

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

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

CHARACTERISTICS

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

DESCRIPTION

ACOS(3) computes the arccosine of X (inverse of COS(X)).

OPTIONS

o X : The value to compute the arctangent of. If the type is real, the value must satisfy |X| <= 1.

RESULT

The return value is of the same type and kind as X. The real part of the result is in radians and lies in the range 0 <= ACOS(X%RE) <= PI .

EXAMPLES

Sample program:

    program demo_acos
    use, intrinsic :: iso_fortran_env, only : real32,real64,real128
    implicit none
    character(len=*),parameter :: all=’(*(g0,1x))’
    real(kind=real64) :: x , d2r

! basics x = 0.866_real64 print all,’acos(’,x,’) is ’, acos(x)

! acos(-1) should be PI print all,’for reference’, new_line(’a’), & &’PI ~= 3.14159265358979323846264338327950288419716939937510’ write(*,*) acos(-1.0_real64) d2r=acos(-1.0_real64)/180.0_real64 print all,’90 degrees is ’, d2r*90.0_real64, ’ radians’ ! elemental print all,’elemental’,acos([-1.0,-0.5,0.0,0.50,1.0]) ! complex print *,’complex’,acos( (-1.0, 0.0) ) print *,’complex’,acos( (-1.0, -1.0) ) print *,’complex’,acos( ( 0.0, -0.0) ) print *,’complex’,acos( ( 1.0, 0.0) )

end program demo_acos

Results:

     > acos( 0.86599999999999999 ) is  0.52364958093182890
     > for reference
     >  PI ~= 3.14159265358979323846264338327950288419716939937510
     >    3.1415926535897931    
     > 90 degrees is  1.5707963267948966  radians
     > elemental 3.14159274 2.09439516 1.57079637 1.04719758 0.00000000
     >  complex            (3.14159274,-0.00000000)
     >  complex             (2.23703575,1.06127501)
     >  complex             (1.57079637,0.00000000)
     >  complex            (0.00000000,-0.00000000)

STANDARD

FORTRAN 77 ; for a complex argument - Fortran 2008

SEE ALSO

Inverse function: COS(3)

RESOURCES

o wikipedia: inverse trigonometric functions
Fortran intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 acos (3fortran) November 02, 2024
Generated by manServer 1.08 from fdf1eead-42d1-4775-8d0f-e3489b27c566 using man macros.