program main !*****************************************************************************80 ! !! sncndn_test() tests sncndn(). ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 25 August 2020 ! ! Author: ! ! John Burkardt ! call timestamp ( ) write ( *, '(a)' ) '' write ( *, '(a)' ) 'sncndn_test():' write ( *, '(a)' ) ' Fortran90 version' write ( *, '(a)' ) ' Test sncndn(), to evaluate Jacobi elliptic functions.' call jacobi_cn_test ( ) call jacobi_dn_test ( ) call jacobi_sn_test ( ) ! ! Terminate. ! write ( *, '(a)' ) '' write ( *, '(a)' ) 'sncndn_test():' write ( *, '(a)' ) ' Normal end of execution.' call timestamp ( ) stop 0 end subroutine jacobi_cn_test ( ) !*****************************************************************************80 ! !! jacobi_cn_test() tests jacobi_cn(). ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 25 June 2018 ! ! Author: ! ! John Burkardt ! implicit none integer, parameter :: rk8 = kind ( 1.0D+00 ) real ( kind = rk8 ) cn1 real ( kind = rk8 ) cn2 real ( kind = rk8 ) jacobi_cn real ( kind = rk8 ) m integer n_data real ( kind = rk8 ) u write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'jacobi_cn_test():' write ( *, '(a)' ) ' jacobi_cn() evaluates the Jacobi elliptic function CN.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' U M Exact CN CN(U,M)' write ( *, '(a)' ) ' ' n_data = 0 do call jacobi_cn_values ( n_data, u, m, cn1 ) if ( n_data == 0 ) then exit end if cn2 = jacobi_cn ( u, m ) write ( *, '(2f8.4,2g24.16)' ) u, m, cn1, cn2 end do return end subroutine jacobi_dn_test ( ) !*****************************************************************************80 ! !! jacobi_dn_test() tests jacobi_dn(). ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 25 June 2018 ! ! Author: ! ! John Burkardt ! implicit none integer, parameter :: rk8 = kind ( 1.0D+00 ) real ( kind = rk8 ) dn1 real ( kind = rk8 ) dn2 real ( kind = rk8 ) jacobi_dn real ( kind = rk8 ) m integer n_data real ( kind = rk8 ) u write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'jacobi_dn_test():' write ( *, '(a)' ) ' jacobi_dn() evaluates the Jacobi elliptic function DN.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' U M Exact DN DN(U,M)' write ( *, '(a)' ) ' ' n_data = 0 do call jacobi_dn_values ( n_data, u, m, dn1 ) if ( n_data == 0 ) then exit end if dn2 = jacobi_dn ( u, m ) write ( *, '(2f8.4,2g24.16)' ) u, m, dn1, dn2 end do return end subroutine jacobi_sn_test ( ) !*****************************************************************************80 ! !! jacobi_sn_test() tests jacobi_sn(). ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 25 June 2018 ! ! Author: ! ! John Burkardt ! implicit none integer, parameter :: rk8 = kind ( 1.0D+00 ) real ( kind = rk8 ) m real ( kind = rk8 ) jacobi_sn integer n_data real ( kind = rk8 ) sn1 real ( kind = rk8 ) sn2 real ( kind = rk8 ) u write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'jacobi_sn_test():' write ( *, '(a)' ) ' jacobi_sn() evaluates the Jacobi elliptic function SN.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' U M Exact SN SN(U,M)' write ( *, '(a)' ) ' ' n_data = 0 do call jacobi_sn_values ( n_data, u, m, sn1 ) if ( n_data == 0 ) then exit end if sn2 = jacobi_sn ( u, m ) write ( *, '(2f8.4,2g24.16)' ) u, m, sn1, sn2 end do return end subroutine timestamp ( ) !*****************************************************************************80 ! !! timestamp prints the current YMDHMS date as a time stamp. ! ! Example: ! ! 31 May 2001 9:45:54.872 AM ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 18 May 2013 ! ! Author: ! ! John Burkardt ! implicit none character ( len = 8 ) ampm integer d integer h integer m integer mm character ( len = 9 ), parameter, dimension(12) :: month = (/ & 'January ', 'February ', 'March ', 'April ', & 'May ', 'June ', 'July ', 'August ', & 'September', 'October ', 'November ', 'December ' /) integer n integer s integer values(8) integer y call date_and_time ( values = values ) y = values(1) m = values(2) d = values(3) h = values(5) n = values(6) s = values(7) mm = values(8) if ( h < 12 ) then ampm = 'AM' else if ( h == 12 ) then if ( n == 0 .and. s == 0 ) then ampm = 'Noon' else ampm = 'PM' end if else h = h - 12 if ( h < 12 ) then ampm = 'PM' else if ( h == 12 ) then if ( n == 0 .and. s == 0 ) then ampm = 'Midnight' else ampm = 'AM' end if end if end if write ( *, '(i2.2,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