ACOSPI(3) - [MATHEMATICS:TRIGONOMETRIC] Circular Arccosine (inverse circular cosine) function
result = acospi(x)
elemental real(kind=KIND) function acospi(x)real(kind=KIND),intent(in) :: x
o KIND may be any real kind o The returned value will be of the same type and kind as the argument.
ACOSPI(3) computes the circular arccosine of X (inverse of COSPI(X)). The result is expressed in half-revolutions (ie. PIs) and lies in the range
0 <= ACOSPI (X) <= 1.
o X : The value to compute the circular arctangent of. The value must satisfy |X| <= 1.
The result has a value equal to a processor-dependent approximation to the arc cosine of X.
The return value is of the same type and kind as X.
It is expressed in half-revolutions and lies in the range 0 <= ACOSPI (X) <= 1.
Sample program:
program demo_acospi use, intrinsic :: iso_fortran_env, only : real32,real64,real128 implicit none character(len=*),parameter :: all=(*(g0,1x)) real(kind=real64) :: x , d2r real(kind=real64),parameter :: & & PI = 3.14159265358979323846264338327950288419716939937510_real64Results:! basics x = PI/4.0_real64 print all,acospi(,x,) is , acospi(x)
! acospi(-1) should be PI write(*,*) acospi(-1.0_real64) d2r=acospi(-1.0_real64)/180.0_real64 print all,90 degrees is , d2r*90.0_real64, radians ! elemental print all,elemental,acospi([-1.0,-0.5,0.0,0.50,1.0]) ! print *,-1.0,acospi( -1.0 ) print *, 0.0,acospi( 0.0 ) print *, 1.0,acospi( 1.0 )
end program demo_acospi
> acospi( 0.78539816339744828 ) is 0.21245823046654463 > 1.0000000000000000 > 90 degrees is 0.50000000000000000 radians > elemental 1.00000000 0.666666687 0.500000000 0.333333343 0.00000000 > -1.0 1.00000000 > 0.0 0.500000000 > 1.0 0.00000000
Fortran 2023
o arc cosine in radians: ACOS(3) o arc cosine in degrees: ACOSD(3) o Inverse function: COS(3)
Fortran intrinsic descriptions (license: MIT) @urbanjost
o wikipedia: inverse trigonometric functions
Nemo Release 3.1 | acospi (3fortran) | November 02, 2024 |