ACOS(3) - [MATHEMATICS:TRIGONOMETRIC] Arccosine (inverse cosine) function
result = acos(x)
elemental TYPE(kind=KIND) function acos(x)TYPE(kind=KIND),intent(in) :: x
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.
ACOS(3) computes the arccosine of X (inverse of COS(X)).
o X : The value to compute the arctangent of. If the type is real, the value must satisfy |X| <= 1.
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 .
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 , d2rResults:! 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
> 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)
FORTRAN 77 ; for a complex argument - Fortran 2008
Inverse function: COS(3)
Fortran intrinsic descriptions (license: MIT) @urbanjost
o wikipedia: inverse trigonometric functions
Nemo Release 3.1 | acos (3fortran) | November 02, 2024 |