program main c*********************************************************************72 c cc cdflib_test() tests cdflib(). c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 17 November 2006 c c Author: c c John Burkardt c implicit none call timestamp ( ) write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'cdflib_test():' write ( *, '(a)' ) ' Fortran77 version' write ( *, '(a)' ) ' Test cdflib().' call test005 ( ) call test01 ( ) call test02 ( ) call test03 ( ) call test04 ( ) call test05 ( ) call test06 ( ) call test07 ( ) call test08 ( ) call test09 ( ) call test10 ( ) call test11 ( ) call test12 ( ) call test13 ( ) call test14 ( ) call test15 ( ) call test16 ( ) call test17 ( ) call test18 ( ) call test19 ( ) call test20 ( ) call test21 ( ) call test22 ( ) call test23 ( ) call test24 ( ) call test25 ( ) call test26 ( ) call test27 ( ) c c Terminate. c write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'cdflib_test():' write ( *, '(a)' ) ' Normal end of execution.' write ( *, '(a)' ) ' ' call timestamp ( ) stop 0 end subroutine test005 ( ) c*********************************************************************72 c cc test005 tests BETA_INC and BETA_INC_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 20 September 2005 c c Author: c c John Burkardt c implicit none double precision a double precision b double precision ccdf_compute double precision ccdf_lookup double precision cdf_compute double precision cdf_lookup integer ierror integer n_data double precision x double precision y write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test005' write ( *, '(a)' ) ' BETA_INC computes incomplete Beta ratio.' write ( *, '(a)' ) ' BETA_INC_CDF_VALUES looks up some values.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' X Y A B CDF CDF' write ( *, '(a)' ) ' ' // & ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call beta_inc_values ( n_data, a, b, x, cdf_lookup ) if ( n_data == 0 ) then exit end if y = 1.0D+00 - x call bratio ( a, b, x, y, cdf_compute, ccdf_compute, & ierror ) write ( *, '(4f10.6,2g14.6)' ) x, y, a, b, cdf_lookup, & cdf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' X Y A B ' // & '1-CDF CCDF' write ( *, '(a)' ) & ' ' // & '(Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call beta_inc_values ( n_data, a, b, x, cdf_lookup ) if ( n_data == 0 ) then exit end if ccdf_lookup = 1.0D+00 - cdf_lookup y = 1.0D+00 - x call bratio ( a, b, x, y, cdf_compute, ccdf_compute, ierror ) write ( *, '(4f10.6,2g14.6)' ) x, y, a, b, ccdf_lookup, & ccdf_compute end do return end subroutine test01 ( ) c*********************************************************************72 c cc test01() tests CDFBET. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision a double precision b double precision bound double precision p double precision q integer status integer which double precision x double precision y write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test01()' write ( *, '(a)' ) ' CDFBET computes one missing parameter' write ( *, '(a)' ) ' from the BETA CDF:' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' BETA_CDF ( (P,Q), (X,Y), A, B )' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' P Q X Y A B' write ( *, '(a)' ) ' ' do which = 1, 4 if ( which == 1 ) then p = huge ( p ) q = huge ( q ) x = 0.25D+00 y = 1.0D+00 - x a = 2.0D+00 b = 3.0D+00 else if ( which == 2 ) then p = 0.261719D+00 q = 1.0D+00 - p x = huge ( x ) y = huge ( y ) a = 2.0D+00 b = 3.0D+00 else if ( which == 3 ) then p = 0.261719D+00 q = 1.0D+00 - p x = 0.25D+00 y = 1.0D+00 - x a = huge ( a ) b = 3.0D+00 else if ( which == 4 ) then p = 0.261719D+00 q = 1.0D+00 - p x = 0.25D+00 y = 1.0D+00 - x a = 2.0D+00 b = huge ( b ) end if call cdfbet ( which, p, q, x, y, a, b, status, bound ) if ( status /= 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a,i6)' ) ' CDFBET returned STATUS = ', status cycle end if write ( *, '(6f10.6)' ) p, q, x, y, a, b end do return end subroutine test02 ( ) c*********************************************************************72 c cc test02() tests CDFBIN. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision bound double precision ompr double precision p double precision pr double precision q double precision s integer status integer which double precision xn write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test02' write ( *, '(a)' ) ' CDFBIN computes one missing parameter' write ( *, '(a)' ) ' from the Binomial CDF:' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' BINOMIAL_CDF ( (P,Q), S, XN, (PR,OMPR) )' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' P Q S XN PR OMPR' write ( *, '(a)' ) ' ' do which = 1, 4 if ( which == 1 ) then p = huge ( p ) q = huge ( q ) s = 5.0D+00 xn = 8.0D+00 pr = 0.875D+00 ompr = 1.0D+00 - pr else if ( which == 2 ) then p = 0.067347D+00 q = 1.0D+00 - p s = huge ( s ) xn = 8.0D+00 pr = 0.875D+00 ompr = 1.0D+00 - pr else if ( which == 3 ) then p = 0.067347D+00 q = 1.0D+00 - p s = 5.0D+00 xn = huge ( xn ) pr = 0.875D+00 ompr = 1.0D+00 - pr else if ( which == 4 ) then p = 0.067347D+00 q = 1.0D+00 - p s = 5.0D+00 xn = 8.0D+00 pr = huge ( pr ) ompr = huge ( ompr ) end if call cdfbin ( which, p, q, s, xn, pr, ompr, status, bound ) if ( status /= 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a,i6)' ) ' CDFBIN returned STATUS = ', status cycle end if write ( *, '(6f10.6)' ) p, q, s, xn, pr, ompr end do return end subroutine test03 ( ) c*********************************************************************72 c cc test03() tests CDFCHI. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision bound double precision df double precision p double precision q integer status integer which double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test03()' write ( *, '(a)' ) ' CDFCHI computes one missing parameter' write ( *, '(a)' ) ' from the Chi Square CDF:' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' CHI_CDF ( (P,Q), X, DF )' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' P Q X DF' write ( *, '(a)' ) ' ' do which = 1, 3 if ( which == 1 ) then p = huge ( p ) q = huge ( q ) x = 5.0D+00 df = 8.0D+00 else if ( which == 2 ) then p = 0.242424D+00 q = 1.0D+00 - p x = huge ( x ) df = 8.0D+00 else if ( which == 3 ) then p = 0.242424D+00 q = 1.0D+00 - p x = 5.0D+00 df = huge ( df ) end if call cdfchi ( which, p, q, x, df, status, bound ) if ( status /= 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a,i6)' ) ' CDFCHI returned STATUS = ', status cycle end if write ( *, '(4f10.6)' ) p, q, x, df end do return end subroutine test04 ( ) c*********************************************************************72 c cc test04() tests CDFCHN. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision bound double precision df double precision p double precision pnonc double precision q integer status integer which double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test04' write ( *, '(a)' ) ' CDFCHN computes one missing parameter' write ( *, '(a)' ) ' from the Chi Square CDF:' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' CHI_Noncentral_CDF ( (P,Q), X, DF, PNONC )' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' P Q X DF PNONC' write ( *, '(a)' ) ' ' do which = 1, 4 if ( which == 1 ) then p = huge ( p ) q = huge ( q ) x = 5.0D+00 df = 8.0D+00 pnonc = 0.5D+00 else if ( which == 2 ) then p = 0.211040D+00 q = 1.0D+00 - p x = huge ( x ) df = 8.0D+00 pnonc = 0.5D+00 else if ( which == 3 ) then p = 0.211040D+00 q = 1.0D+00 - p x = 5.0D+00 df = huge ( df ) pnonc = 0.5D+00 else if ( which == 4 ) then p = 0.211040D+00 q = 1.0D+00 - p x = 5.0D+00 df = 8.0D+00 pnonc = huge ( pnonc ) end if call cdfchn ( which, p, q, x, df, pnonc, status, bound ) if ( status /= 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a,i6)' ) ' CDFCHN returned STATUS = ', status cycle end if write ( *, '(5f10.6)' ) p, q, x, df, pnonc end do return end subroutine test05 ( ) c*********************************************************************72 c cc test05() tests CDFF. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision bound double precision dfd double precision dfn double precision f double precision p double precision q integer status integer which write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test05()' write ( *, '(a)' ) ' CDFF computes one missing parameter' write ( *, '(a)' ) ' from the F CDF:' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' F_CDF ( (P,Q), F, DFN, DFD )' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' P Q F DFN DFD' write ( *, '(a)' ) ' ' do which = 1, 4 if ( which == 1 ) then p = huge ( p ) q = huge ( q ) f = 5.0D+00 dfn = 8.0D+00 dfd = 3.0D+00 else if ( which == 2 ) then p = 0.893510D+00 q = 1.0D+00 - p f = huge ( f ) dfn = 8.0D+00 dfd = 3.0D+00 else if ( which == 3 ) then p = 0.893510D+00 q = 1.0D+00 - p f = 5.0D+00 dfn = huge ( dfn ) dfd = 3.0D+00 else if ( which == 4 ) then p = 0.893510D+00 q = 1.0D+00 - p f = 5.0D+00 dfn = 8.0D+00 dfd = huge ( dfn ) end if call cdff ( which, p, q, f, dfn, dfd, status, bound ) if ( status /= 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a,i6)' ) ' CDFF returned STATUS = ', status cycle end if write ( *, '(5f10.6)' ) p, q, f, dfn, dfd end do return end subroutine test06 ( ) c*********************************************************************72 c cc test06() tests CDFFNC. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision bound double precision dfd double precision dfn double precision f double precision p double precision pnonc double precision q integer status integer which write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test06()' write ( *, '(a)' ) ' CDFFNC computes one missing parameter' write ( *, '(a)' ) ' from the noncentral F CDF:' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' F_noncentral_CDF ( (P,Q), F, DFN, DFD, PNONC )' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' P Q F DFN DFD PNONC' write ( *, '(a)' ) ' ' do which = 1, 5 if ( which == 1 ) then p = huge ( p ) q = huge ( q ) f = 5.0D+00 dfn = 8.0D+00 dfd = 3.0D+00 pnonc = 17.648016D+00 else if ( which == 2 ) then p = 0.60D+00 q = 1.0D+00 - p f = huge ( f ) dfn = 8.0D+00 dfd = 3.0D+00 pnonc = 17.648016D+00 else if ( which == 3 ) then p = 0.60D+00 q = 1.0D+00 - p f = 5.0D+00 dfn = huge ( dfn ) dfd = 3.0D+00 pnonc = 17.648016D+00 else if ( which == 4 ) then p = 0.60D+00 q = 1.0D+00 - p f = 5.0D+00 dfn = 8.0D+00 dfd = huge ( dfd ) pnonc = 17.648016D+00 else if ( which == 5 ) then p = 0.60D+00 q = 1.0D+00 - p f = 5.0D+00 dfn = 8.0D+00 dfd = 3.0D+00 pnonc = huge ( pnonc ) end if call cdffnc ( which, p, q, f, dfn, dfd, pnonc, status, bound ) if ( status /= 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a,i6)' ) ' CDFFNC returned STATUS = ', status cycle end if write ( *, '(6f10.6)' ) p, q, f, dfn, dfd, pnonc end do return end subroutine test07 ( ) c*********************************************************************72 c cc test07() tests CDFGAM. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision bound double precision p double precision q double precision scale double precision shape integer status integer which double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test07()' write ( *, '(a)' ) ' CDFGAM computes one missing parameter' write ( *, '(a)' ) ' from the Gamma CDF:' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' Gamma_CDF ( (P,Q), X, SHAPE, SCALE )' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' P Q X SHAPE SCALE' write ( *, '(a)' ) ' ' do which = 1, 4 if ( which == 1 ) then p = huge ( p ) q = huge ( q ) x = 5.0D+00 shape = 8.0D+00 scale = 3.0D+00 else if ( which == 2 ) then p = 0.981998D+00 q = 1.0D+00 - p x = huge ( x ) shape = 8.0D+00 scale = 3.0D+00 else if ( which == 3 ) then p = 0.981998D+00 q = 1.0D+00 - p x = 5.0D+00 shape = huge ( shape ) scale = 3.0D+00 else if ( which == 4 ) then p = 0.981998D+00 q = 1.0D+00 - p x = 5.0D+00 shape = 8.0D+00 scale = huge ( scale ) end if call cdfgam ( which, p, q, x, shape, scale, status, bound ) if ( status /= 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a,i6)' ) ' CDFGAM returned STATUS = ', status cycle end if write ( *, '(5f10.6)' ) p, q, x, shape, scale end do return end subroutine test08 ( ) c*********************************************************************72 c cc test08() tests CDFNBN. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision bound double precision f double precision ompr double precision p double precision pr double precision q double precision s integer status integer which write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test08()' write ( *, '(a)' ) ' CDFNBN computes one missing parameter' write ( *, '(a)' ) ' from the Negative_Binomial CDF:' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' Negative_BINOMIAL_CDF ( (P,Q), F, S, (PR,OMPR) )' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' P Q F S PR OMPR' write ( *, '(a)' ) ' ' do which = 1, 4 if ( which == 1 ) then p = huge ( p ) q = huge ( q ) f = 3.0D+00 s = 5.0D+00 pr = 0.875D+00 ompr = 1.0D+00 - pr else if ( which == 2 ) then p = 0.988752D+00 q = 1.0D+00 - p f = huge ( f ) s = 5.0D+00 pr = 0.875D+00 ompr = 1.0D+00 - pr else if ( which == 3 ) then p = 0.988752D+00 q = 1.0D+00 - p f = 3.0D+00 s = huge ( s ) pr = 0.875D+00 ompr = 1.0D+00 - pr else if ( which == 4 ) then p = 0.988752D+00 q = 1.0D+00 - p f = 3.0D+00 s = 5.0D+00 pr = huge ( pr ) ompr = huge ( ompr ) end if call cdfnbn ( which, p, q, f, s, pr, ompr, status, bound ) if ( status /= 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a,i6)' ) ' CDFNBN returned STATUS = ', status cycle end if write ( *, '(6f10.6)' ) p, q, f, s, pr, ompr end do return end subroutine test09 ( ) c*********************************************************************72 c cc test09() tests CDFNOR. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision bound double precision mean double precision p double precision q double precision sd integer status integer which double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test09()' write ( *, '(a)' ) ' CDFNOR computes one missing parameter from' write ( *, '(a)' ) ' the Normal CDF:' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' Normal_CDF ( (P,Q), X, MEAN, SD )' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' P Q X MEAN SD' write ( *, '(a)' ) ' ' do which = 1, 4 if ( which == 1 ) then p = huge ( p ) q = huge ( q ) x = 3.0D+00 mean = 5.0D+00 sd = 0.875D+00 else if ( which == 2 ) then p = 0.011135D+00 q = 1.0D+00 - p x = huge ( x ) mean = 5.0D+00 sd = 0.875D+00 else if ( which == 3 ) then p = 0.011135D+00 q = 1.0D+00 - p x = 3.0D+00 mean = huge ( mean ) sd = 0.875D+00 else if ( which == 4 ) then p = 0.011135D+00 q = 1.0D+00 - p x = 3.0D+00 mean = 5.0D+00 sd = huge ( sd ) end if call cdfnor ( which, p, q, x, mean, sd, status, bound ) if ( status /= 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a,i6)' ) ' CDFNOR returned STATUS = ', status cycle end if write ( *, '(5f10.6)' ) p, q, x, mean, sd end do return end subroutine test10 ( ) c*********************************************************************72 c cc test10() tests CDFPOI. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision bound double precision p double precision q double precision s integer status integer which double precision xlam write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test10' write ( *, '(a)' ) ' CDFPOI computes one missing parameter from' write ( *, '(a)' ) ' the Poisson CDF:' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' POISSON_CDF ( (P,Q), S, XLAM )' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' P Q S XLAM' write ( *, '(a)' ) ' ' do which = 1, 3 if ( which == 1 ) then p = huge ( p ) q = huge ( q ) s = 3.0D+00 xlam = 5.0D+00 else if ( which == 2 ) then p = 0.265026D+00 q = 1.0D+00 - p s = huge ( s ) xlam = 5.0D+00 else if ( which == 3 ) then p = 0.265026D+00 q = 1.0D+00 - p s = 3.0D+00 xlam = huge ( xlam ) end if call cdfpoi ( which, p, q, s, xlam, status, bound ) if ( status /= 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a,i6)' ) ' CDFPOI returned STATUS = ', status cycle end if write ( *, '(4f10.6)' ) p, q, s, xlam end do return end subroutine test11 ( ) c*********************************************************************72 c cc test11() tests CDFT. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision bound double precision df double precision p double precision q integer status double precision t integer which write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test11' write ( *, '(a)' ) ' CDFT computes one missing parameter' write ( *, '(a)' ) ' from the T CDF:' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' T_CDF ( (P,Q), T, DF )' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' P Q T DF' write ( *, '(a)' ) ' ' do which = 1, 3 if ( which == 1 ) then p = huge ( p ) q = huge ( q ) t = 3.0D+00 df = 5.0D+00 else if ( which == 2 ) then p = 0.984950D+00 q = 1.0D+00 - p t = huge ( t ) df = 5.0D+00 else if ( which == 3 ) then p = 0.984950D+00 q = 1.0D+00 - p t = 3.0D+00 df = huge ( df ) end if call cdft ( which, p, q, t, df, status, bound ) if ( status /= 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a,i6)' ) ' CDFT returned STATUS = ', status cycle end if write ( *, '(4f10.6)' ) p, q, t, df end do return end subroutine test12 ( ) c*********************************************************************72 c cc test12() tests CUMBET and BETA_INC_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision a double precision b double precision ccdf_compute double precision ccdf_lookup double precision cdf_compute double precision cdf_lookup integer n_data double precision x double precision y write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test12()' write ( *, '(a)' ) ' CUMBET computes the Beta CDF' write ( *, '(a)' ) ' and the complementary CDF.' write ( *, '(a)' ) ' BETA_INC_CDF_VALUES looks up some values.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' X Y A B CDF CDF' write ( *, '(a)' ) & ' (Lookup) ' // & '(Computed)' write ( *, '(a)' ) '' n_data = 0 do call beta_inc_values ( n_data, a, b, x, cdf_lookup ) if ( n_data == 0 ) then exit end if y = 1.0D+00 - x call cumbet ( x, y, a, b, cdf_compute, ccdf_compute ) write ( *, '(4f10.6,2g14.6)' ) x, y, a, b, cdf_lookup, & cdf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' X Y A B 1-CDF' // & ' CCDF' write ( *, '(a)' ) & ' (Lookup) ' // & ' (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call beta_inc_values ( n_data, a, b, x, cdf_lookup ) if ( n_data == 0 ) then exit end if ccdf_lookup = 1.0D+00 - cdf_lookup y = 1.0D+00 - x call cumbet ( x, y, a, b, cdf_compute, ccdf_compute ) write ( *, '(4f10.6,2g14.6)' ) x, y, a, b, ccdf_lookup, & ccdf_compute end do return end subroutine test13 ( ) c*********************************************************************72 c cc test13() tests CUMBIN and BINOMIAL_CDF_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision ccdf_compute double precision ccdf_lookup double precision cdf_compute double precision cdf_lookup integer n_data double precision ompr integer s double precision s_double double precision pr integer x double precision x_double write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test13()' write ( *, '(a)' ) ' CUMBIN computes the Binomial CDF' write ( *, '(a)' ) ' and the complementary CDF.' write ( *, '(a)' ) ' BINOMIAL_CDF_VALUES looks up some values.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X S Pr CDF CDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call binomial_cdf_values ( n_data, x, pr, s, cdf_lookup ) if ( n_data == 0 ) then exit end if ompr = 1.0D+00 - pr s_double = dble ( s ) x_double = dble ( x ) call cumbin ( s_double, x_double, pr, ompr, cdf_compute, & ccdf_compute ) write ( *, '(i4,i4,f10.6,2g14.6)' ) s, x, pr, cdf_lookup, & cdf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X S Pr 1-CDF CCDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call binomial_cdf_values ( n_data, x, pr, s, cdf_lookup ) if ( n_data == 0 ) then exit end if ccdf_lookup = 1.0D+00 - cdf_lookup ompr = 1.0D+00 - pr s_double = dble ( s ) x_double = dble ( x ) call cumbin ( s_double, x_double, pr, ompr, cdf_compute, & ccdf_compute ) write ( *, '(i4,i4,f10.6,2g14.6)' ) s, x, pr, ccdf_lookup, & ccdf_compute end do return end subroutine test14 ( ) c*********************************************************************72 c cc test14() tests CUMCHI and CHI_SQUARE_CDF_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision ccdf_compute double precision ccdf_lookup double precision cdf_compute double precision cdf_lookup integer df double precision df_double integer n_data double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test14()' write ( *, '(a)' ) ' CUMCHI computes the chi square CDF' write ( *, '(a)' ) ' and the complementary CDF.' write ( *, '(a)' ) ' CHI_SQUARE_CDF_VALUES looks up some values.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X DF CDF CDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call chi_square_cdf_values ( n_data, df, x, cdf_lookup ) if ( n_data == 0 ) then exit end if df_double = dble ( df ) call cumchi ( x, df_double, cdf_compute, ccdf_compute ) write ( *, '(f10.6,i4,2g14.6)' ) x, df, cdf_lookup, cdf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X DF 1-CDF CCDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call chi_square_cdf_values ( n_data, df, x, cdf_lookup ) if ( n_data == 0 ) then exit end if ccdf_lookup = 1.0D+00 - cdf_lookup df_double = dble ( df ) call cumchi ( x, df_double, cdf_compute, ccdf_compute ) write ( *, '(f10.6,i4,2g14.6)' ) x, df, ccdf_lookup, & ccdf_compute end do return end subroutine test15 ( ) c*********************************************************************72 c cc test15() tests CUMCHN and CHI_SQUARE_NONCENTRAL_CDF_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision ccdf_compute double precision ccdf_lookup double precision cdf_compute double precision cdf_lookup integer df double precision df_double double precision lambda integer n_data double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test15()' write ( *, '(a)' ) ' CUMCHN computes the cumulative density' write ( *, '(a)' ) ' function for the noncentral chi-squared ' write ( *, '(a)' ) ' distribution.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' DF Lambda X CDF CDF' write ( *, '(a)' ) & ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call chi_square_noncentral_cdf_values ( n_data, x, lambda, df, & cdf_lookup ) if ( n_data == 0 ) then exit end if df_double = dble ( df ) call cumchn ( x, df_double, lambda, cdf_compute, ccdf_compute ) write ( *, '(2x,i4,2f10.6,2g14.6)' ) & df, lambda, x, cdf_lookup, cdf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' DF Lambda X 1-CDF ' // & ' CCDF' write ( *, '(a)' ) ' (Lookup) ' // & ' (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call chi_square_noncentral_cdf_values ( n_data, x, lambda, df, & cdf_lookup ) if ( n_data == 0 ) then exit end if ccdf_lookup = 1.0D+00 - cdf_lookup df_double = dble ( df ) call cumchn ( x, df_double, lambda, cdf_compute, ccdf_compute ) write ( *, '(2x,i4,2f10.6,2g14.6)' ) & df, lambda, x, ccdf_lookup, ccdf_compute end do return end subroutine test16 ( ) c*********************************************************************72 c cc test16() tests CUMF and F_CDF_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision ccdf_compute double precision ccdf_lookup double precision cdf_compute double precision cdf_lookup integer dfd double precision dfd_double integer dfn double precision dfn_double integer n_data double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test16()' write ( *, '(a)' ) ' CUMF computes the F CDF' write ( *, '(a)' ) ' and the complementary CDF.' write ( *, '(a)' ) ' F_CDF_VALUES looks up some values.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X DFN DFD CDF CDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call f_cdf_values ( n_data, dfn, dfd, x, cdf_lookup ) if ( n_data == 0 ) then exit end if dfn_double = dble ( dfn ) dfd_double = dble ( dfd ) call cumf ( x, dfn_double, dfd_double, cdf_compute, & ccdf_compute ) write ( *, '(f10.6,2i4,2g14.6)' ) x, dfn, dfd, cdf_lookup, & cdf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X DFN DFD 1-CDF CCDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call f_cdf_values ( n_data, dfn, dfd, x, cdf_lookup ) if ( n_data == 0 ) then exit end if ccdf_lookup = 1.0D+00 - cdf_lookup dfn_double = dble ( dfn ) dfd_double = dble ( dfd ) call cumf ( x, dfn_double, dfd_double, cdf_compute, & ccdf_compute ) write ( *, '(f10.6,2i4,2g14.6)' ) x, dfn, dfd, ccdf_lookup, & ccdf_compute end do return end subroutine test17 ( ) c*********************************************************************72 c cc test17() tests CUMFNC and F_NONCENTRAL_CDF_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision ccdf_compute double precision ccdf_lookup double precision cdf_compute double precision cdf_lookup integer dfd double precision dfd_double integer dfn double precision dfn_double double precision lambda integer n_data double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test17' write ( *, '(a)' ) ' CUMFNC computes the noncentral F CDF' write ( *, '(a)' ) ' and the complementary CDF.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' X DFN DFD LAMBDA CDF CDF' write ( *, '(a)' ) & ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call f_noncentral_cdf_values ( n_data, dfn, dfd, lambda, x, & cdf_lookup ) if ( n_data == 0 ) then exit end if dfn_double = dble ( dfn ) dfd_double = dble ( dfd ) call cumfnc ( x, dfn_double, dfd_double, lambda, cdf_compute, & ccdf_compute ) write ( *, '(f10.6,2i4,f10.6,2g14.6)' ) & x, dfn, dfd, lambda, cdf_lookup, cdf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X DFN DFD LAMBDA 1-CDF' // & ' CCDF' write ( *, '(a)' ) & ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call f_noncentral_cdf_values ( n_data, dfn, dfd, lambda, x, & cdf_lookup ) if ( n_data == 0 ) then exit end if ccdf_lookup = 1.0D+00 - cdf_lookup dfn_double = dble ( dfn ) dfd_double = dble ( dfd ) call cumfnc ( x, dfn_double, dfd_double, lambda, cdf_compute, & ccdf_compute ) write ( *, '(f10.6,2i4,f10.6,2g14.6)' ) & x, dfn, dfd, lambda, ccdf_lookup, ccdf_compute end do return end subroutine test18 ( ) c*********************************************************************72 c cc test18() tests CUMGAM and GAMMA_INC_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision a double precision ccdf_compute double precision ccdf_lookup double precision cdf_compute double precision cdf_lookup integer n_data double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test18' write ( *, '(a)' ) ' CUMGAM computes the Gamma CDF' write ( *, '(a)' ) ' and the complementary CDF.' write ( *, '(a)' ) ' GAMMA_INC_VALUES looks up some values.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' A X CDF CDF' write ( *, '(a)' ) ' (Lookup) ' // & '(Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call gamma_inc_values ( n_data, a, x, cdf_lookup ) if ( n_data == 0 ) then exit end if call cumgam ( x, a, cdf_compute, ccdf_compute ) write ( *, '(2f10.6,2g14.6)' ) a, x, cdf_lookup, cdf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' A X CDF CDF' write ( *, '(a)' ) ' (Lookup) ' // & '(Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call gamma_inc_values ( n_data, a, x, cdf_lookup ) if ( n_data == 0 ) then exit end if ccdf_lookup = 1.0D+00 - cdf_lookup call cumgam ( x, a, cdf_compute, ccdf_compute ) write ( *, '(2f10.6,2g14.6)' ) a, x, ccdf_lookup, ccdf_compute end do return end subroutine test19 ( ) c*********************************************************************72 c cc test19() tests CUMNBN and NEGATIVE_BINOMIAL_CDF_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision ccdf_compute double precision ccdf_lookup double precision cdf_compute double precision cdf_lookup integer f double precision f_double integer n_data double precision ompr integer s double precision s_double double precision pr write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test19()' write ( *, '(a)' ) ' CUMNBN computes the Negative Binomial CDF' write ( *, '(a)' ) ' and the complementary CDF.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' F S Pr CDF CDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call negative_binomial_cdf_values ( n_data, f, s, pr, & cdf_lookup ) if ( n_data == 0 ) then exit end if ompr = 1.0D+00 - pr f_double = dble ( f ) s_double = dble ( s ) call cumnbn ( f_double, s_double, pr, ompr, cdf_compute, & ccdf_compute ) write ( *, '(i4,i4,f10.6,2g14.6)' ) f, s, pr, cdf_lookup, & cdf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' F S Pr 1-CDF CCDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call negative_binomial_cdf_values ( n_data, f, s, pr, & cdf_lookup ) if ( n_data == 0 ) then exit end if ccdf_lookup = 1.0D+00 - cdf_lookup ompr = 1.0D+00 - pr f_double = dble ( f ) s_double = dble ( s ) call cumnbn ( f_double, s_double, pr, ompr, cdf_compute, & ccdf_compute ) write ( *, '(i4,i4,f10.6,2g14.6)' ) f, s, pr, ccdf_lookup, & ccdf_compute end do return end subroutine test20 ( ) c*********************************************************************72 c cc test20() tests CUMNOR and NORMAL_01_CDF_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision ccdf_compute double precision ccdf_lookup double precision cdf_compute double precision cdf_lookup integer n_data double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test20' write ( *, '(a)' ) ' CUMNOR computes the Normal CDF' write ( *, '(a)' ) ' and the complementary CDF.' write ( *, '(a)' ) ' NORMAL_01_CDF_VALUES looks up some values.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X CDF CDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call normal_01_cdf_values ( n_data, x, cdf_lookup ) if ( n_data == 0 ) then exit end if call cumnor ( x, cdf_compute, ccdf_compute ) write ( *, '(2x,f10.6,2g24.16)' ) x, cdf_lookup, cdf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X 1-CDF CCDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call normal_01_cdf_values ( n_data, x, cdf_lookup ) if ( n_data == 0 ) then exit end if ccdf_lookup = 1.0D+00 - cdf_lookup call cumnor ( x, cdf_compute, ccdf_compute ) write ( *, '(2x,f10.6,2g24.16)' ) x, ccdf_lookup, ccdf_compute end do return end subroutine test21 ( ) c*********************************************************************72 c cc test21 tests CUMPOI and POISSON_CDF_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision ccdf_compute double precision ccdf_lookup double precision cdf_compute double precision cdf_lookup double precision lambda integer n_data integer x double precision x_double write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test21' write ( *, '(a)' ) ' CUMPOI computes the Poisson CDF' write ( *, '(a)' ) ' and the complementary CDF.' write ( *, '(a)' ) ' POISSON_CDF_VALUES looks up some values.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X LAMBDA CDF CDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call poisson_cdf_values ( n_data, lambda, x, cdf_lookup ) if ( n_data == 0 ) then exit end if x_double = dble ( x ) call cumpoi ( x_double, lambda, cdf_compute, ccdf_compute ) write ( *, '(i6,f10.6,2g14.6)' ) x, lambda, cdf_lookup, & cdf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X LAMBDA 1-CDF CCDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call poisson_cdf_values ( n_data, lambda, x, cdf_lookup ) if ( n_data == 0 ) then exit end if x_double = dble ( x ) ccdf_lookup = 1.0D+00 - cdf_lookup call cumpoi ( x_double, lambda, cdf_compute, ccdf_compute ) write ( *, '(i6,f10.6,2g14.6)' ) x, lambda, ccdf_lookup, & ccdf_compute end do return end subroutine test22 ( ) c*********************************************************************72 c cc test22() tests CUMT and STUDENT_CDF_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision ccdf_compute double precision ccdf_lookup double precision cdf_compute double precision cdf_lookup integer df double precision df_double integer n_data double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test22()' write ( *, '(a)' ) ' CUMT computes the Student T CDF' write ( *, '(a)' ) ' and the complementary CDF.' write ( *, '(a)' ) ' STUDENT_CDF_VALUES looks up some values.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X DF CDF CDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call student_cdf_values ( n_data, df, x, cdf_lookup ) if ( n_data == 0 ) then exit end if df_double = dble ( df ) call cumt ( x, df_double, cdf_compute, ccdf_compute ) write ( *, '(f10.6,i4,2g14.6)' ) x, df, cdf_lookup, cdf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X DF 1-CDF CCDF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call student_cdf_values ( n_data, df, x, cdf_lookup ) if ( n_data == 0 ) then exit end if ccdf_lookup = 1.0D+00 - cdf_lookup df_double = dble ( df ) call cumt ( x, df_double, cdf_compute, ccdf_compute ) write ( *, '(f10.6,i4,2g14.6)' ) x, df, ccdf_lookup, & ccdf_compute end do return end subroutine test23 ( ) c*********************************************************************72 c cc test23() tests BETA and GAMMA. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision a double precision b double precision beta double precision beta1 double precision beta2 double precision gamma write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test23()' write ( *, '(a)' ) ' BETA evaluates the Beta function;' write ( *, '(a)' ) ' GAMMA evaluates the Gamma function.' a = 2.2D+00 b = 3.7D+00 beta1 = beta ( a, b ) beta2 = gamma ( a ) * gamma ( b ) / gamma ( a + b ) write ( *, '(a)' ) ' ' write ( *, '(a,g14.6)' ) ' Argument A = ', a write ( *, '(a,g14.6)' ) ' Argument B = ', b write ( *, '(a,g14.6)' ) ' Beta(A,B) = ', & beta1 write ( *, '(a)' ) ' (Expected value = 0.0454 )' write ( *, '(a)' ) ' ' write ( *, '(a,g14.6)' ) ' Gamma(A)*Gamma(B)/Gamma(A+B) = ', & beta2 return end subroutine test24 ( ) c*****************************************************************************80 c cc test24() tests ERROR_F, ERROR_FC and ERF_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 19 May 2026 c c Author: c c John Burkardt c implicit none double precision error_f double precision erf_compute double precision erf_lookup double precision erfc_compute double precision erfc_lookup double precision erfc1 integer ind integer n_data double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'TEST24' write ( *, '(a)' ) ' ERROR_F computes the error function ERF;' write ( *, '(a)' ) ' ERFC1: complementary function ERFC.' write ( *, '(a)' ) ' ERF_VALUES looks up some values.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X ERF ERF' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call erf_values ( n_data, x, erf_lookup ) if ( n_data == 0 ) then exit end if erf_compute = error_f ( x ) write ( *, '(f10.6,2g14.6)' ) x, erf_lookup, erf_compute end do write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X ERFC ERFC' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' ind = 0 n_data = 0 do call erf_values ( n_data, x, erf_lookup ) if ( n_data == 0 ) then exit end if erfc_lookup = 1.0D+00 - erf_lookup erfc_compute = erfc1 ( ind, x ) write ( *, '(f10.6,2g14.6)' ) x, erfc_lookup, erfc_compute end do return end subroutine test25 ( ) c*********************************************************************72 c cc test25() tests GAMMA and GAMMA_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision gamma double precision gamma_compute double precision gamma_lookup integer n_data double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test25' write ( *, '(a)' ) ' GAMMA computes the Gamma function;' write ( *, '(a)' ) ' GAMMA_VALUES looks up some values.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X GAMMA GAMMA' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call gamma_values ( n_data, x, gamma_lookup ) if ( n_data == 0 ) then exit end if gamma_compute = gamma ( x ) write ( *, '(f10.6,2g14.6)' ) x, gamma_lookup, gamma_compute end do return end subroutine test26 ( ) c*********************************************************************72 c cc test26() tests GAMMA_INC and GAMMA_INC_INV. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none integer, parameter :: test_num = 10 double precision a integer i integer ierror double precision p double precision q double precision x double precision x0 double precision x2 a = 3.0D+00 x0 = 0.0D+00 write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test26()' write ( *, '(a)' ) ' GAMMA_INC evaluates incomplete Gamma ratio;' write ( *, '(a)' ) ' GAMMA_INC_INV inverts it.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' Parameter values:' write ( *, '(a)' ) ' ' write ( *, '(a,g14.6)' ) ' A = ', a write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X P Q' // & ' Inverse' write ( *, '(a)' ) ' ' do i = 0, test_num x = dble ( i ) / dble ( test_num ) call cumgam ( a, x, p, q ) call gaminv ( a, x2, x0, p, q, ierror ) write ( *, '(4g14.6)' ) x, p, q, x2 end do return end subroutine test27 ( ) c*********************************************************************72 c cc test27() tests PSI and PSI_VALUES. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 18 May 2026 c c Author: c c John Burkardt c implicit none double precision psi double precision psi_compute double precision psi_lookup integer n_data double precision x write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test27()' write ( *, '(a)' ) ' PSI computes the Psi function;' write ( *, '(a)' ) ' PSI_VALUES looks up some values.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' X PSI PSI' write ( *, '(a)' ) ' (Lookup) (Computed)' write ( *, '(a)' ) ' ' n_data = 0 do call psi_values ( n_data, x, psi_lookup ) if ( n_data == 0 ) then exit end if psi_compute = psi ( x ) write ( *, '(f10.6,2g14.6)' ) x, psi_lookup, psi_compute end do return end subroutine timestamp ( ) c*********************************************************************72 c cc timestamp() prints the YMDHMS date as a timestamp. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 12 June 2014 c c Author: c c John Burkardt c implicit none character * ( 8 ) ampm integer d character * ( 8 ) date integer h integer m integer mm character * ( 9 ) month(12) integer n integer s character * ( 10 ) time integer y save month data month / & 'January ', 'February ', 'March ', 'April ', & 'May ', 'June ', 'July ', 'August ', & 'September', 'October ', 'November ', 'December ' / call date_and_time ( date, time ) read ( date, '(i4,i2,i2)' ) y, m, d read ( time, '(i2,i2,i2,1x,i3)' ) h, n, s, mm if ( h .lt. 12 ) then ampm = 'AM' else if ( h .eq. 12 ) then if ( n .eq. 0 .and. s .eq. 0 ) then ampm = 'Noon' else ampm = 'PM' end if else h = h - 12 if ( h .lt. 12 ) then ampm = 'PM' else if ( h .eq. 12 ) then if ( n .eq. 0 .and. s .eq. 0 ) then ampm = 'Midnight' else ampm = 'AM' end if end if end if write ( *, & '(i2,1x,a,1x,i4,2x,i2,a1,i2.2,a1,i2.2,a1,i3.3,1x,a)' ) & d, trim ( month(m) ), y, h, ':', n, ':', s, '.', mm, & trim ( ampm ) return end