unipdf(3f) - [M_datapac:PROBABILITY_DENSITY] trivially compute the
Uniform probability density function
SUBROUTINE UNIPDF(X,Pdf)
REAL(kind=wp),intent(in) :: X
REAL(kind=wp),intent(out) :: Pdf
UNIPDF(3f) computes the probability density function value for the
uniform (rectangular) distribution on the unit interval (0,1).
This distribution has mean = 0.5 and standard deviation = sqrt(1/12)
= 0.28867513. this distribution has the probability density function
f(X) = 1
That is, trivially no matter what the input the output is 1.
X The REAL value at which the probability density
function is to be evaluated. X should be between 0 and 1,
inclusively.
PDF The REAL probability density function value.
Sample program:
program demo_unipdf
!@(#) line plotter graph of probability density function
use M_datapac, only : unipdf, label
implicit none
real,allocatable :: x(:), y(:)
integer :: i
call label('unipdf')
x=[(real(i)/10.0,i=0,10,1)]
if(allocated(y))deallocate(y)
allocate(y(size(x)))
do i=1,size(x)
call unipdf( x(i), y(i) )
enddo
write(*,*)y
end program demo_unipdf
Results:
1.00 1.000000 1.000000 1.000000 1.000000
1.00 1.000000 1.000000 1.000000 1.000000
1.00
The original DATAPAC library was written by James Filliben of the
Statistical Engineering Division, National Institute of Standards
and Technology.
John Urban, 2022.05.31
CC0-1.0
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | X | |||
real(kind=wp), | intent(out) | :: |
SUBROUTINE UNIPDF(X,Pdf) REAL(kind=wp),intent(in) :: X REAL(kind=wp),intent(out) :: Pdf ! CHECK THE INPUT ARGUMENTS FOR ERRORS ! IF ( X<0.0_wp .OR. X>1.0_wp ) THEN WRITE (G_IO,99001) 99001 FORMAT(& & ' ***** NON-FATAL DIAGNOSTIC--THE FIRST INPUT ARGUMENT TO UNIPDF(3f) IS OUTSIDE THE USUAL (0,1) INTERVAL *****') WRITE (G_IO,99002) X 99002 FORMAT(' ','***** THE VALUE OF THE ARGUMENT IS ',E15.8, ' *****') Pdf = 0.0_wp RETURN ELSE Pdf = 1.0_wp ENDIF ! END SUBROUTINE UNIPDF