Exemple #1
0
def r8_modp_test():

    #*****************************************************************************80
    #
    ## R8_MODP_TEST tests R8_MODP.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    01 June 2013
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8_uniform_ab import r8_uniform_ab

    test_num = 10

    print ''
    print 'R8_MODP_TEST'
    print '  R8_MODP returns the remainder after division.'
    print '  Unlike the MATLAB MOD, R8_MODP ( X, Y ) is positive.'
    print ''
    print '      X       Y      MOD(X,Y)  R8_MODP(X,Y)'
    print ''

    x_lo = -10.0
    x_hi = +10.0

    seed = 123456789

    for test in range(0, test_num):

        [x, seed] = r8_uniform_ab(x_lo, x_hi, seed)
        [y, seed] = r8_uniform_ab(x_lo, x_hi, seed)

        z1 = (x % y)
        z2 = r8_modp(x, y)

        print '  %12f  %12f  %12f  %12f' % (x, y, z1, z2)


#
#  Terminate.
#
    print ''
    print 'R8_MODP_TEST'
    print '  Normal end of execution.'

    return
def r8_modp_test ( ):

#*****************************************************************************80
#
## R8_MODP_TEST tests R8_MODP.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    01 June 2013
#
#  Author:
#
#    John Burkardt
#
  from r8_uniform_ab import r8_uniform_ab

  test_num = 10

  print ''
  print 'R8_MODP_TEST'
  print '  R8_MODP returns the remainder after division.'
  print '  Unlike the MATLAB MOD, R8_MODP ( X, Y ) is positive.'
  print ''
  print '      X       Y      MOD(X,Y)  R8_MODP(X,Y)'
  print ''

  x_lo = -10.0
  x_hi = +10.0

  seed = 123456789

  for test in range ( 0, test_num ):

    [ x, seed ] = r8_uniform_ab ( x_lo, x_hi, seed )
    [ y, seed ] = r8_uniform_ab ( x_lo, x_hi, seed )

    z1 = ( x % y )
    z2 = r8_modp ( x, y )

    print '  %12f  %12f  %12f  %12f' % ( x, y, z1, z2 )
#
#  Terminate.
#
  print ''
  print 'R8_MODP_TEST'
  print '  Normal end of execution.'

  return
Exemple #3
0
def r8_mod_test ( ):

#*****************************************************************************80
#
## R8_MOD_TEST tests R8_MOD.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    25 July 2014
#
#  Author:
#
#    John Burkardt
#
  from r8_uniform_ab import r8_uniform_ab

  test_num = 10

  print ''
  print 'R8_MOD_TEST'
  print '  R8_MOD returns the remainder after division.'
  print ''
  print '        X             Y             (X%Y)    R8_MOD(X,Y)'
  print ''

  x_lo = -10.0
  x_hi = +10.0

  seed = 123456789

  for test in range ( 0, test_num ):

    x, seed = r8_uniform_ab ( x_lo, x_hi, seed )
    y, seed = r8_uniform_ab ( x_lo, x_hi, seed )

    z1 = x % y
    z2 = r8_mod ( x, y )

    print '  %12f  %12f  %12f  %12f' % ( x, y, z1, z2 )
#
#  Terminate.
#
  print ''
  print 'R8_MOD_TEST'
  print '  Normal end of execution.'

  return
Exemple #4
0
def r8_add_test():

    #*****************************************************************************80
    #
    ## R8_ADD_TEST tests R8_ADD.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    14 May 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'R8_ADD_TEST'
    print '  R8_ADD adds two R8\'s.'
    print ''
    print '       R1             R2              R3              R4'
    print '                                      R1+R2     R8_ADD(R1,R2)'
    print ''

    r8_lo = -500.0
    r8_hi = +500.0
    seed = 123456789

    for test in range(0, 5):

        r1, seed = r8_uniform_ab(r8_lo, r8_hi, seed)
        r2, seed = r8_uniform_ab(r8_lo, r8_hi, seed)
        r3 = r1 + r2
        r4 = r8_add(r1, r2)

        print '  %14.6g  %14.6g  %14.6g  %14.6g' % (r1, r2, r3, r4)


#
#  Terminate.
#
    print ''
    print 'R8_ADD_TEST'
    print '  Normal end of execution.'

    return
def fibonacci1_determinant_test ( ):

#*****************************************************************************80
#
## FIBONACCI1_DETERMINANT_TEST tests FIBONACCI1_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    27 January 2015
#
#  Author:
#
#    John Burkardt
#
  from fibonacci1 import fibonacci1
  from r8_uniform_ab import r8_uniform_ab
  from r8mat_print import r8mat_print


  print ''
  print 'FIBONACCI1_DETERMINANT_TEST'
  print '  FIBONACCI1_DETERMINANT computes the determinant of the FIBONACCI1 matrix.'
  print ''

  m = 5
  n = m

  f_lo = 1.0
  f_hi = 10.0
  seed = 123456789
  f1, seed = r8_uniform_ab ( f_lo, f_hi, seed )
  f2, seed = r8_uniform_ab ( f_lo, f_hi, seed )

  a = fibonacci1 ( n, f1, f2 )
  r8mat_print ( m, n, a, '  FIBONACCI1 matrix:' )

  value = fibonacci1_determinant ( n, f1, f2 )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'FIBONACCI1_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
Exemple #6
0
def tris_determinant_test():

    #*****************************************************************************80
    #
    ## TRIS_DETERMINANT_TEST tests TRIS_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    26 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from tris import tris
    from r8_uniform_ab import r8_uniform_ab
    from r8mat_print import r8mat_print

    print ''
    print 'TRIS_DETERMINANT_TEST'
    print '  TRIS_DETERMINANT computes the TRIS determinant.'

    m = 5
    n = m

    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    x, seed = r8_uniform_ab(r8_lo, r8_hi, seed)
    y, seed = r8_uniform_ab(r8_lo, r8_hi, seed)
    z, seed = r8_uniform_ab(r8_lo, r8_hi, seed)

    a = tris(m, n, x, y, z)

    r8mat_print(m, n, a, '  TRIS matrix:')

    value = tris_determinant(n, x, y, z)

    print ''
    print '  Value =  %g' % (value)

    print ''
    print 'TRIS_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
Exemple #7
0
def r8_add_test ( ):

#*****************************************************************************80
#
## R8_ADD_TEST tests R8_ADD.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    14 May 2015
#
#  Author:
#
#    John Burkardt
#
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'R8_ADD_TEST'
  print '  R8_ADD adds two R8\'s.' 
  print ''
  print '       R1             R2              R3              R4'
  print '                                      R1+R2     R8_ADD(R1,R2)'
  print ''

  r8_lo = - 500.0
  r8_hi = + 500.0
  seed = 123456789

  for test in range ( 0, 5 ):

    r1, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )
    r2, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )
    r3 = r1 + r2
    r4 = r8_add ( r1, r2 )

    print '  %14.6g  %14.6g  %14.6g  %14.6g' % ( r1, r2, r3, r4 )
#
#  Terminate.
#
  print ''
  print 'R8_ADD_TEST'
  print '  Normal end of execution.'

  return
Exemple #8
0
def r8_min_test():

    #*****************************************************************************80
    #
    ## R8_MIN_TEST tests R8_MIN.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    09 March 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'R8_MIN_TEST'
    print '  R8_MIN computes the minimum of two R8\'s.'

    r8_lo = -10.0
    r8_hi = +10.0
    seed = 123456789

    print ''
    print '     A         B         C=R8_MIN(A,B)'
    print ''
    for i in range(0, 10):
        a, seed = r8_uniform_ab(r8_lo, r8_hi, seed)
        b, seed = r8_uniform_ab(r8_lo, r8_hi, seed)
        c = r8_min(a, b)
        print '  %8g  %8g  %8g' % (a, b, c)


#
#  Terminate.
#
    print ''
    print 'R8_MIN_TEST:'
    print '  Normal end of execution.'

    return
def forsythe_determinant_test ( ):

#*****************************************************************************80
#
## FORSYTHE_DETERMINANT_TEST tests FORSYTHE_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    04 February 2015
#
#  Author:
#
#    John Burkardt
#
  from forsythe import forsythe
  from r8_uniform_ab import r8_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'FORSYTHE_DETERMINANT_TEST'
  print '  FORSYTHE_DETERMINANT computes the FORSYTHE determinant.'

  seed = 123456789

  n = 5
  r8_lo = -5.0
  r8_hi = +5.0
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )
  beta, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )
  a = forsythe ( alpha, beta,  n )
  r8mat_print ( n, n, a, '  FORSYTHE matrix:' )

  value = forsythe_determinant ( alpha, beta, n )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'FORSYTHE_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
Exemple #10
0
def forsythe_determinant_test():

    #*****************************************************************************80
    #
    ## FORSYTHE_DETERMINANT_TEST tests FORSYTHE_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    04 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from forsythe import forsythe
    from r8_uniform_ab import r8_uniform_ab
    from r8mat_print import r8mat_print

    print ''
    print 'FORSYTHE_DETERMINANT_TEST'
    print '  FORSYTHE_DETERMINANT computes the FORSYTHE determinant.'

    seed = 123456789

    n = 5
    r8_lo = -5.0
    r8_hi = +5.0
    alpha, seed = r8_uniform_ab(r8_lo, r8_hi, seed)
    beta, seed = r8_uniform_ab(r8_lo, r8_hi, seed)
    a = forsythe(alpha, beta, n)
    r8mat_print(n, n, a, '  FORSYTHE matrix:')

    value = forsythe_determinant(alpha, beta, n)

    print ''
    print '  Value =  %g' % (value)

    print ''
    print 'FORSYTHE_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
Exemple #11
0
def r8_min_test ( ):

#*****************************************************************************80
#
## R8_MIN_TEST tests R8_MIN.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    09 March 2015
#
#  Author:
#
#    John Burkardt
#
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'R8_MIN_TEST'
  print '  R8_MIN computes the minimum of two R8\'s.'

  r8_lo = - 10.0
  r8_hi = + 10.0
  seed = 123456789

  print ''
  print '     A         B         C=R8_MIN(A,B)'
  print ''
  for i in range ( 0, 10 ):
    a, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )
    b, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )
    c = r8_min ( a, b )
    print '  %8g  %8g  %8g' % ( a, b, c )
#
#  Terminate.
#
  print ''
  print 'R8_MIN_TEST:'
  print '  Normal end of execution.'

  return
Exemple #12
0
def r8_to_r8_discrete_test():

    #*****************************************************************************80
    #
    ## R8_TO_R8_DISCRETE_TEST tests R8_TO_R8_DISCRETE.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    26 July 2014
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8_uniform_ab import r8_uniform_ab

    ndx = 19
    rhi = 10.0
    rlo = 1.0
    test_num = 15

    print ''
    print 'R8_TO_R8_DISCRETE'
    print '  R8_TO_R8_DISCRETE maps numbers to a discrete set'
    print '  of equally spaced numbers in an interval.'
    print ''
    print '  Number of discrete values = %d' % (ndx)
    print '  Real interval: [%f, %f]' % (rlo, rhi)
    print ''
    print '       R        RD'
    print ''

    seed = 123456789

    rlo2 = rlo - 2.0
    rhi2 = rhi + 2.0

    for test in range(0, test_num):
        r, seed = r8_uniform_ab(rlo2, rhi2, seed)
        rd = r8_to_r8_discrete(r, rlo, rhi, ndx)
        print '  %14f  %14f' % (r, rd)


#
#  Terminate.
#
    print ''
    print 'R8_TO_R8_DISCRETE'
    print '  Normal end of execution.'

    return
Exemple #13
0
def eberlein_null_left_test ( ):

#*****************************************************************************80
#
## EBERLEIN_NULL_LEFT_TEST tests EBERLEIN_NULL_LEFT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    07 March 2015
#
#  Author:
#
#    John Burkardt
#
  from r8_uniform_ab import r8_uniform_ab
  from r8mat_is_null_left import r8mat_is_null_left
  from r8mat_print import r8mat_print
  from r8vec_print import r8vec_print

  print ''
  print 'EBERLEIN_NULL_LEFT_TEST'
  print '  EBERLEIN_NULL_LEFT returns a left null vector of the EBERLEIN matrix.'
  print ''

  m = 5
  n = 5

  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )

  a = eberlein ( alpha, n )
  r8mat_print ( m, n, a, '  EBERLEIN matrix A:' )

  x = eberlein_null_left ( m, n )
  r8vec_print ( m, x, '  Left null vector X:' )

  value = r8mat_is_null_left ( m, n, a, x )

  print ''
  print '  ||x\'*A||/||x|| =  %g' % ( value )

  print ''
  print 'EBERLEIN_NULL_LEFT_TEST'
  print '  Normal end of execution.'

  return
Exemple #14
0
def r8_wrap_test():

    #*****************************************************************************80
    #
    ## R8_WRAP_TEST tests R8_WRAP
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    26 July 2014
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8_uniform_ab import r8_uniform_ab

    a = -2.0
    b = 12.0
    rhi = 6.5
    rlo = 3.0
    seed = 123456789
    test_num = 20

    print ''
    print 'R8_WRAP_TEST'
    print '  R8_WRAP "wraps" an R8 to lie within an interval:'
    print ''
    print '  Wrapping interval is %f, %f' % (rlo, rhi)
    print ''
    print '      R      R8_WRAP ( R )'
    print ''

    for test in range(0, test_num):

        r, seed = r8_uniform_ab(a, b, seed)
        r2 = r8_wrap(r, rlo, rhi)
        print '  %14g  %14g' % (r, r2)


#
#  Terminate.
#
    print ''
    print 'R8_WRAP_TEST'
    print '  Normal end of execution.'

    return
Exemple #15
0
def r8_wrap_test ( ):

#*****************************************************************************80
#
## R8_WRAP_TEST tests R8_WRAP
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    26 July 2014
#
#  Author:
#
#    John Burkardt
#
  from r8_uniform_ab import r8_uniform_ab

  a = - 2.0
  b = 12.0
  rhi = 6.5
  rlo = 3.0
  seed = 123456789
  test_num = 20

  print ''
  print 'R8_WRAP_TEST'
  print '  R8_WRAP "wraps" an R8 to lie within an interval:'
  print ''
  print '  Wrapping interval is %f, %f' % ( rlo, rhi )
  print ''
  print '      R      R8_WRAP ( R )'
  print ''

  for test in range ( 0, test_num ):

    r, seed = r8_uniform_ab ( a, b, seed )
    r2 = r8_wrap ( r, rlo, rhi )
    print '  %14g  %14g' % ( r, r2 )
#
#  Terminate.
#
  print ''
  print 'R8_WRAP_TEST'
  print '  Normal end of execution.'

  return
def integration_determinant_test ( ):

#*****************************************************************************80
#
## INTEGRATION_DETERMINANT_TEST tests INTEGRATION_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    16 February 2015
#
#  Author:
#
#    John Burkardt
#
  from integration import integration
  from r8mat_print import r8mat_print
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'INTEGRATION_DETERMINANT_TEST'
  print '  INTEGRATION_DETERMINANT computes the determinant of the INTEGRATION matrix.'
  print ''

  m = 4
  n = m

  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )

  a = integration ( alpha, n )
  r8mat_print ( m, n, a, '  INTEGRATION matrix:' )

  value = integration_determinant ( alpha, n )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'INTEGRATION_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
Exemple #17
0
def jordan_determinant_test():

    #*****************************************************************************80
    #
    ## JORDAN_DETERMINANT_TEST tests JORDAN_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    16 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from jordan import jordan
    from r8mat_print import r8mat_print
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'JORDAN_DETERMINANT_TEST'
    print '  JORDAN_DETERMINANT computes the determinant of the JORDAN matrix.'
    print ''

    m = 4
    n = m

    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(r8_lo, r8_hi, seed)

    a = jordan(m, n, alpha)
    r8mat_print(m, n, a, '  JORDAN matrix:')

    value = jordan_determinant(n, alpha)

    print ''
    print '  Value =  %g' % (value)

    print ''
    print 'JORDAN_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
Exemple #18
0
def hanowa_determinant_test ( ):

#*****************************************************************************80
#
## HANOWA_DETERMINANT_TEST tests HANOWA_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    10 February 2015
#
#  Author:
#
#    John Burkardt
#
  from hanowa import hanowa
  from r8mat_print import r8mat_print
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'HANOWA_DETERMINANT_TEST'
  print '  HANOWA_DETERMINANT computes the determinant of the HANOWA matrix.'
  print ''

  m = 4
  n = m

  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )

  a = hanowa ( alpha, n )
  r8mat_print ( m, n, a, '  HANOWA matrix:' )

  value = hanowa_determinant ( alpha, n )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'HANOWA_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
Exemple #19
0
def pascal3_determinant_test():

    #*****************************************************************************80
    #
    ## PASCAL3_DETERMINANT_TEST tests PASCAL3_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    22 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from pascal3 import pascal3
    from r8mat_print import r8mat_print
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'PASCAL3_DETERMINANT_TEST'
    print '  PASCAL3_DETERMINANT computes the determinant of the PASCAL3 matrix.'
    print ''

    m = 4
    n = m

    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(r8_lo, r8_hi, seed)

    a = pascal3(n, alpha)
    r8mat_print(m, n, a, '  PASCAL3 matrix:')

    value = pascal3_determinant(n, alpha)

    print ''
    print '  Value =  %g' % (value)

    print ''
    print 'PASCAL3_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
Exemple #20
0
def pei_determinant_test():

    #*****************************************************************************80
    #
    ## PEI_DETERMINANT_TEST tests PEI_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    22 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from pei import pei
    from r8mat_print import r8mat_print
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'PEI_DETERMINANT_TEST'
    print '  PEI_DETERMINANT computes the determinant of the PEI matrix.'
    print ''

    m = 5
    n = m

    alpha_lo = 1.0
    alpha_hi = 100.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(alpha_lo, alpha_hi, seed)

    a = pei(alpha, n)
    r8mat_print(m, n, a, '  PEI matrix:')

    value = pei_determinant(alpha, n)

    print ''
    print '  Value =  %g' % (value)

    print ''
    print 'PEI_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
Exemple #21
0
def conex1_determinant_test ( ):

#*****************************************************************************80
#
## CONEX1_DETERMINANT_TEST tests CONEX1_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    09 January 2015
#
#  Author:
#
#    John Burkardt
#
  from conex1 import conex1
  from r8mat_print import r8mat_print
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'CONEX1_DETERMINANT_TEST'
  print '  CONEX1_DETERMINANT computes the determinant of the CONEX1 matrix.'
  print ''

  m = 4
  n = m

  alpha_lo = 1.0
  alpha_hi = 100.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( alpha_lo, alpha_hi, seed )

  a = conex1 ( alpha )
  r8mat_print ( m, n, a, '  CONEX1 matrix:' )

  value = conex1_determinant ( alpha )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'CONEX1_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
def tri_upper_determinant_test ( ):

#*****************************************************************************80
#
## TRI_UPPER_DETERMINANT_TEST tests TRI_UPPER_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    25 February 2015
#
#  Author:
#
#    John Burkardt
#
  from tri_upper import tri_upper
  from r8_uniform_ab import r8_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'TRI_UPPER_DETERMINANT_TEST'
  print '  TRI_UPPER_DETERMINANT computes the determinant of the TRI_UPPER matrix.'
  print ''

  m = 5
  n = m

  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )

  a = tri_upper ( alpha, n )
  r8mat_print ( n, n, a, '  TRI_UPPER matrix:' )

  value = tri_upper_determinant ( alpha, n )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'TRI_UPPER_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
Exemple #23
0
def conex1_condition_test():

    #*****************************************************************************80
    #
    ## CONEX1_CONDITION_TEST tests CONEX1_CONDITION.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    06 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from conex1 import conex1
    from r8mat_print import r8mat_print
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'CONEX1_CONDITION_TEST'
    print '  CONEX1_CONDITION computes the condition of the CONEX1 matrix.'
    print ''

    m = 4
    n = m

    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(r8_lo, r8_hi, seed)

    a = conex1(alpha)
    r8mat_print(m, n, a, '  CONEX1 matrix:')

    value = conex1_condition(alpha)

    print ''
    print '  Value =  %g' % (value)

    print ''
    print 'CONEX1_CONDITION_TEST'
    print '  Normal end of execution.'

    return
Exemple #24
0
def pei_condition_test ( ):

#*****************************************************************************80
#
## PEI_CONDITION_TEST tests PEI_CONDITION.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    22 February 2015
#
#  Author:
#
#    John Burkardt
#
  from pei import pei
  from r8mat_print import r8mat_print
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'PEI_CONDITION_TEST'
  print '  PEI_CONDITION computes the condition of the PEI matrix.'
  print ''

  m = 5
  n = m

  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )

  a = pei ( alpha, n )
  r8mat_print ( m, n, a, '  PEI matrix:' )

  value = pei_condition ( alpha )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'PEI_CONDITION_TEST'
  print '  Normal end of execution.'

  return
Exemple #25
0
def pascal3_determinant_test ( ):

#*****************************************************************************80
#
## PASCAL3_DETERMINANT_TEST tests PASCAL3_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    22 February 2015
#
#  Author:
#
#    John Burkardt
#
  from pascal3 import pascal3
  from r8mat_print import r8mat_print
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'PASCAL3_DETERMINANT_TEST'
  print '  PASCAL3_DETERMINANT computes the determinant of the PASCAL3 matrix.'
  print ''

  m = 4
  n = m

  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )

  a = pascal3 ( n, alpha )
  r8mat_print ( m, n, a, '  PASCAL3 matrix:' )

  value = pascal3_determinant ( n, alpha )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'PASCAL3_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
Exemple #26
0
def conex1_determinant_test():

    #*****************************************************************************80
    #
    ## CONEX1_DETERMINANT_TEST tests CONEX1_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    09 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from conex1 import conex1
    from r8mat_print import r8mat_print
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'CONEX1_DETERMINANT_TEST'
    print '  CONEX1_DETERMINANT computes the determinant of the CONEX1 matrix.'
    print ''

    m = 4
    n = m

    alpha_lo = 1.0
    alpha_hi = 100.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(alpha_lo, alpha_hi, seed)

    a = conex1(alpha)
    r8mat_print(m, n, a, '  CONEX1 matrix:')

    value = conex1_determinant(alpha)

    print ''
    print '  Value =  %g' % (value)

    print ''
    print 'CONEX1_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
Exemple #27
0
def moler1_determinant_test():

    #*****************************************************************************80
    #
    ## MOLER1_DETERMINANT_TEST tests MOLER1_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    19 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from moler1 import moler1
    from r8mat_print import r8mat_print
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'MOLER1_DETERMINANT_TEST'
    print '  MOLER1_DETERMINANT computes the determinant of the MOLER1 matrix.'
    print ''

    m = 4
    n = m

    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(r8_lo, r8_hi, seed)

    a = moler1(alpha, n)
    r8mat_print(m, n, a, '  MOLER1 matrix:')

    value = moler1_determinant(alpha, n)

    print ''
    print '  Value =  %g' % (value)

    print ''
    print 'MOLER1_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
Exemple #28
0
def pei_condition_test():

    #*****************************************************************************80
    #
    ## PEI_CONDITION_TEST tests PEI_CONDITION.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    22 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from pei import pei
    from r8mat_print import r8mat_print
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'PEI_CONDITION_TEST'
    print '  PEI_CONDITION computes the condition of the PEI matrix.'
    print ''

    m = 5
    n = m

    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(r8_lo, r8_hi, seed)

    a = pei(alpha, n)
    r8mat_print(m, n, a, '  PEI matrix:')

    value = pei_condition(alpha)

    print ''
    print '  Value =  %g' % (value)

    print ''
    print 'PEI_CONDITION_TEST'
    print '  Normal end of execution.'

    return
Exemple #29
0
def eberlein_determinant_test ( ):

#*****************************************************************************80
#
## EBERLEIN_DETERMINANT_TEST tests EBERLEIN_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    24 January 2015
#
#  Author:
#
#    John Burkardt
#
  from eberlein import eberlein
  from r8mat_print import r8mat_print
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'EBERLEIN_DETERMINANT_TEST'
  print '  EBERLEIN_DETERMINANT computes the determinant of the EBERLEIN matrix.'
  print ''

  m = 4
  n = m

  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )

  a = eberlein ( alpha, n )
  r8mat_print ( m, n, a, '  EBERLEIN matrix:' )

  value = eberlein_determinant ( alpha, n )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'EBERLEIN_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
Exemple #30
0
def jordan_determinant_test():

    # *****************************************************************************80
    #
    ## JORDAN_DETERMINANT_TEST tests JORDAN_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    16 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from jordan import jordan
    from r8mat_print import r8mat_print
    from r8_uniform_ab import r8_uniform_ab

    print ""
    print "JORDAN_DETERMINANT_TEST"
    print "  JORDAN_DETERMINANT computes the determinant of the JORDAN matrix."
    print ""

    m = 4
    n = m

    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(r8_lo, r8_hi, seed)

    a = jordan(m, n, alpha)
    r8mat_print(m, n, a, "  JORDAN matrix:")

    value = jordan_determinant(n, alpha)

    print ""
    print "  Value =  %g" % (value)

    print ""
    print "JORDAN_DETERMINANT_TEST"
    print "  Normal end of execution."

    return
Exemple #31
0
def pei_determinant_test ( ):

#*****************************************************************************80
#
## PEI_DETERMINANT_TEST tests PEI_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    22 February 2015
#
#  Author:
#
#    John Burkardt
#
  from pei import pei
  from r8mat_print import r8mat_print
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'PEI_DETERMINANT_TEST'
  print '  PEI_DETERMINANT computes the determinant of the PEI matrix.'
  print ''

  m = 5
  n = m

  alpha_lo = 1.0
  alpha_hi = 100.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( alpha_lo, alpha_hi, seed )

  a = pei ( alpha, n )
  r8mat_print ( m, n, a, '  PEI matrix:' )

  value = pei_determinant ( alpha, n )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'PEI_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
Exemple #32
0
def conex1_condition_test ( ):

#*****************************************************************************80
#
## CONEX1_CONDITION_TEST tests CONEX1_CONDITION.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    06 February 2015
#
#  Author:
#
#    John Burkardt
#
  from conex1 import conex1
  from r8mat_print import r8mat_print
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'CONEX1_CONDITION_TEST'
  print '  CONEX1_CONDITION computes the condition of the CONEX1 matrix.'
  print ''

  m = 4
  n = m

  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )

  a = conex1 ( alpha )
  r8mat_print ( m, n, a, '  CONEX1 matrix:' )

  value = conex1_condition ( alpha )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'CONEX1_CONDITION_TEST'
  print '  Normal end of execution.'

  return
Exemple #33
0
def tri_upper_determinant_test():

    #*****************************************************************************80
    #
    ## TRI_UPPER_DETERMINANT_TEST tests TRI_UPPER_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    25 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from tri_upper import tri_upper
    from r8_uniform_ab import r8_uniform_ab
    from r8mat_print import r8mat_print

    print ''
    print 'TRI_UPPER_DETERMINANT_TEST'
    print '  TRI_UPPER_DETERMINANT computes the determinant of the TRI_UPPER matrix.'
    print ''

    m = 5
    n = m

    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(r8_lo, r8_hi, seed)

    a = tri_upper(alpha, n)
    r8mat_print(n, n, a, '  TRI_UPPER matrix:')

    value = tri_upper_determinant(alpha, n)

    print ''
    print '  Value =  %g' % (value)

    print ''
    print 'TRI_UPPER_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
Exemple #34
0
def rodman_determinant_test ( ):

#*****************************************************************************80
#
## RODMAN_DETERMINANT_TEST tests RODMAN_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    23 February 2015
#
#  Author:
#
#    John Burkardt
#
  from rodman import rodman
  from r8_uniform_ab import r8_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'RODMAN_DETERMINANT_TEST'
  print '  RODMAN_DETERMINANT computes the RODMAN determinant.'

  m = 5
  n = m
 
  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )

  a = rodman ( m, n, alpha )

  r8mat_print ( m, n, a, '  RODMAN matrix:' )

  value = rodman_determinant ( n, alpha )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'RODMAN_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
Exemple #35
0
def r8_fractional_test():

    #*****************************************************************************80
    #
    ## R8_FRACTIONAL_TEST tests R8_FRACTIONAL.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    25 July 2014
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8_uniform_ab import r8_uniform_ab

    r8_hi = 5.0
    r8_lo = -3.0
    test_num = 10

    seed = 123456789

    print ''
    print 'R8_FRACTIONAL_TEST'
    print '  R8_FRACTIONAL returns the fractional part of an R8.'
    print ''
    print '       X       R8_FRACTIONAL(X)'
    print ''

    for test in range(0, test_num):
        r8, seed = r8_uniform_ab(r8_lo, r8_hi, seed)
        fractional = r8_fractional(r8)
        print '  %10f  %10f' % (r8, fractional)


#
#  Terminate.
#
    print ''
    print 'R8_FRACTIONAL_TEST'
    print '  Normal end of execution.'

    return
def r8_cube_root_test():

    #*****************************************************************************80
    #
    ## R8_CUBE_ROOT_TEST tests R8_CUBE_ROOT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    26 July 2014
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'R8_CUBE_ROOT_TEST'
    print '  R8_CUBE_ROOT computes the cube root of an R8.'
    print ''
    print '       X               Y               Y^3'
    print ''

    a = -10.0
    b = +10.0
    seed = 123456789

    for i in range(0, 10):
        x1, seed = r8_uniform_ab(a, b, seed)
        y = r8_cube_root(x1)
        x2 = y**3
        print '  %14.6g  %14.6g  %14.6g' % (x1, y, x2)


#
#  Terminate.
#
    print ''
    print 'R8_CUBE_ROOT_TEST'
    print '  Normal end of execution.'

    return
Exemple #37
0
def r8_abs_test():

    #*****************************************************************************80
    #
    ## R8_ABS_TEST tests R8_ABS.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    30 May 2013
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8_uniform_ab import r8_uniform_ab

    r8_lo = -5.0
    r8_hi = +5.0
    test_num = 10
    seed = 123456789

    print ''
    print 'R8_ABS_TEST'
    print '  R8_ABS returns the absolute value of an R8.'
    print ' '
    print '      X         R8_ABS(X)'
    print ' '

    for test in range(0, test_num):
        [r8, seed] = r8_uniform_ab(r8_lo, r8_hi, seed)
        r8_absolute = r8_abs(r8)
        print "  %10.6f  %10.6f" % (r8, r8_absolute)


#
#  Terminate.
#
    print ''
    print 'R8_ABS_TEST'
    print '  Normal end of execution.'

    return
Exemple #38
0
def kms_determinant_test():

    #*****************************************************************************80
    #
    ## KMS_DETERMINANT_TEST tests KMS_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    17 December 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from kms import kms
    from r8_uniform_ab import r8_uniform_ab
    from r8mat_print import r8mat_print

    print ''
    print 'KMS_DETERMINANT_TEST'
    print '  KMS_DETERMINANT computes the KMS determinant.'

    seed = 123456789

    m = 5
    n = m
    r8_lo = 0.0
    r8_hi = 1.0
    alpha, seed = r8_uniform_ab(r8_lo, r8_hi, seed)
    a = kms(alpha, m, n)
    r8mat_print(m, n, a, '  KMS matrix:')

    value = kms_determinant(alpha, n)

    print ''
    print '  Value =  %g' % (value)

    print ''
    print 'KMS_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
Exemple #39
0
def dorr_determinant_test ( ):

#*****************************************************************************80
#
## DORR_DETERMINANT_TEST tests DORR_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    03 March 2015
#
#  Author:
#
#    John Burkardt
#
  from r8_uniform_ab import r8_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'DORR_DETERMINANT_TEST'
  print '  DORR_DETERMINANT computes the determinant of the DORR matrix.'
  print ''

  m = 5
  n = m

  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )

  a = dorr ( alpha, n )
  r8mat_print ( n, n, a, '  DORR matrix:' )

  value = dorr_determinant ( alpha, n )
  print ''
  print '  Value =  %8' % ( value )

  print ''
  print 'DORR_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
Exemple #40
0
def kms_determinant_test ( ):

#*****************************************************************************80
#
## KMS_DETERMINANT_TEST tests KMS_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    17 December 2015
#
#  Author:
#
#    John Burkardt
#
  from kms import kms
  from r8_uniform_ab import r8_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'KMS_DETERMINANT_TEST'
  print '  KMS_DETERMINANT computes the KMS determinant.'

  seed = 123456789

  m = 5
  n = m
  r8_lo = 0.0
  r8_hi = 1.0
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )
  a = kms ( alpha, m, n )
  r8mat_print ( m, n, a, '  KMS matrix:' )

  value = kms_determinant ( alpha, n )

  print ''
  print '  Value =  %g' % ( value )

  print ''
  print 'KMS_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
def r8_fractional_test ( ):

#*****************************************************************************80
#
## R8_FRACTIONAL_TEST tests R8_FRACTIONAL.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    25 July 2014
#
#  Author:
#
#    John Burkardt
#
  from r8_uniform_ab import r8_uniform_ab

  r8_hi = 5.0
  r8_lo = -3.0
  test_num = 10

  seed = 123456789

  print ''
  print 'R8_FRACTIONAL_TEST'
  print '  R8_FRACTIONAL returns the fractional part of an R8.'
  print ''
  print '       X       R8_FRACTIONAL(X)'
  print ''

  for test in range ( 0, test_num ):
    r8, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )
    fractional = r8_fractional ( r8 )
    print '  %10f  %10f' % ( r8, fractional )
#
#  Terminate.
#
  print ''
  print 'R8_FRACTIONAL_TEST'
  print '  Normal end of execution.'

  return
Exemple #42
0
def r8_abs_test ( ):

#*****************************************************************************80
#
## R8_ABS_TEST tests R8_ABS.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    30 May 2013
#
#  Author:
#
#    John Burkardt
#
  from r8_uniform_ab import r8_uniform_ab

  r8_lo = -5.0
  r8_hi = +5.0
  test_num = 10
  seed = 123456789

  print ''
  print 'R8_ABS_TEST'
  print '  R8_ABS returns the absolute value of an R8.'
  print ' '
  print '      X         R8_ABS(X)'
  print ' '

  for test in range ( 0, test_num ):
    [ r8, seed ] = r8_uniform_ab ( r8_lo, r8_hi, seed )
    r8_absolute = r8_abs ( r8 )
    print "  %10.6f  %10.6f" % ( r8, r8_absolute )
#
#  Terminate.
#
  print ''
  print 'R8_ABS_TEST'
  print '  Normal end of execution.'

  return
def r8_cube_root_test ( ):

#*****************************************************************************80
#
## R8_CUBE_ROOT_TEST tests R8_CUBE_ROOT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    26 July 2014
#
#  Author:
#
#    John Burkardt
#
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'R8_CUBE_ROOT_TEST'
  print '  R8_CUBE_ROOT computes the cube root of an R8.'
  print ''
  print '       X               Y               Y^3'
  print ''

  a = -10.0
  b = +10.0
  seed = 123456789

  for i in range ( 0, 10 ):
    x1, seed = r8_uniform_ab ( a, b, seed )
    y = r8_cube_root ( x1 )
    x2 = y ** 3
    print '  %14.6g  %14.6g  %14.6g' % ( x1, y, x2 )
#
#  Terminate.
#
  print ''
  print 'R8_CUBE_ROOT_TEST'
  print '  Normal end of execution.'

  return
def i4_floor_test():

    #*****************************************************************************80
    #
    ## I4_FLOOR_TEST tests I4_FLOOR.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    27 September 2014
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8_uniform_ab import r8_uniform_ab

    r8_lo = -100.0
    r8_hi = 100.0
    seed = 123456789

    print ''
    print 'I4_FLOOR_TEST'
    print '  I4_FLOOR evaluates the "floor" of a real number.'
    print ' '
    print '      R8       I4_FLOOR(R8)'
    print ''

    for i in range(0, 10):
        r8, seed = r8_uniform_ab(r8_lo, r8_hi, seed)
        i4 = i4_floor(r8)
        print '  %8.4f            %4d' % (r8, i4)


#
#  Terminate.
#
    print ''
    print 'I4_FLOOR_TEST'
    print '  Normal end of execution.'
Exemple #45
0
def r8_nint_test ( ):

#*****************************************************************************80
#
## R8_NINT_TEST tests R8_NINT
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    26 July 2014
#
#  Author:
#
#    John Burkardt
#
  from r8_uniform_ab import r8_uniform_ab

  seed = 123456789
  test_num = 10

  print ''
  print 'R8_NINT_TEST'
  print '  R8_NINT produces the nearest integer.'
  print ''
  print '      X      R8_NINT(X)'
  print ''

  b = -10.0
  c = +10.0

  for test  in range ( 0, test_num ):
    x, seed = r8_uniform_ab ( b, c, seed )
    print '  %10f  %6d' % ( x, r8_nint ( x ) )

  print ''
  print 'R8_NINT_TEST'
  print '  Normal end of execution.'

  return
Exemple #46
0
def r8_nint_test():

    #*****************************************************************************80
    #
    ## R8_NINT_TEST tests R8_NINT
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    26 July 2014
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8_uniform_ab import r8_uniform_ab

    seed = 123456789
    test_num = 10

    print ''
    print 'R8_NINT_TEST'
    print '  R8_NINT produces the nearest integer.'
    print ''
    print '      X      R8_NINT(X)'
    print ''

    b = -10.0
    c = +10.0

    for test in range(0, test_num):
        x, seed = r8_uniform_ab(b, c, seed)
        print '  %10f  %6d' % (x, r8_nint(x))

    print ''
    print 'R8_NINT_TEST'
    print '  Normal end of execution.'

    return
Exemple #47
0
def hanowa_test ( ):

#*****************************************************************************80
#
## HANOWA_TEST tests HANOWA.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    10 February 2015
#
#  Author:
#
#    John Burkardt
#
  from r8mat_print import r8mat_print
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'HANOWA_TEST'
  print '  HANOWA computes the HANOWA matrix.'

  m = 6
  n = m

  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )

  a = hanowa ( alpha, n )
  r8mat_print ( m, n, a, '  HANOWA matrix:' )

  print ''
  print 'HANOWA_TEST'
  print '  Normal end of execution.'

  return
Exemple #48
0
def gfpp_test ( ):

#*****************************************************************************80
#
## GFPP_TEST tests GFPP.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    07 February 2015
#
#  Author:
#
#    John Burkardt
#
  from r8mat_print import r8mat_print
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'GFPP_TEST'
  print '  GFPP computes the GFPP matrix.'

  m = 4
  n = m

  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( r8_lo, r8_hi, seed )

  a = gfpp ( n, alpha )
  r8mat_print ( m, n, a, '  GFPP matrix:' )

  print ''
  print 'GFPP_TEST'
  print '  Normal end of execution.'

  return
Exemple #49
0
def conex2_test ( ):

#*****************************************************************************80
#
## CONEX2_TEST tests CONEX2.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    09 January 2015
#
#  Author:
#
#    John Burkardt
#
  from r8mat_print import r8mat_print
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'CONEX2_TEST'
  print '  CONEX2 computes the CONEX2 matrix.'

  m = 3
  n = m

  alpha_lo = 1.0
  alpha_hi = 100.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( alpha_lo, alpha_hi, seed )

  a = conex2 ( alpha )
  r8mat_print ( m, n, a, '  CONEX2 matrix:' )

  print ''
  print 'CONEX2_TEST'
  print '  Normal end of execution.'

  return
Exemple #50
0
def moler1_test():

    #*****************************************************************************80
    #
    ## MOLER1_TEST tests MOLER1.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    19 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8mat_print import r8mat_print
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'MOLER1_TEST'
    print '  MOLER1 computes the MOLER1 matrix.'

    m = 5
    n = m

    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(r8_lo, r8_hi, seed)

    a = moler1(alpha, m, n)
    r8mat_print(m, n, a, '  MOLER1 matrix:')

    print ''
    print 'MOLER1_TEST'
    print '  Normal end of execution.'

    return
Exemple #51
0
def eberlein_test ( ):

#*****************************************************************************80
#
## EBERLEIN_TEST tests EBERLEIN.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    24 January 2015
#
#  Author:
#
#    John Burkardt
#
  from r8mat_print import r8mat_print
  from r8_uniform_ab import r8_uniform_ab

  print ''
  print 'EBERLEIN_TEST'
  print '  EBERLEIN computes the EBERLEIN matrix.'

  m = 4
  n = m

  alpha_lo = 1.0
  alpha_hi = 100.0
  seed = 123456789
  alpha, seed = r8_uniform_ab ( alpha_lo, alpha_hi, seed )

  a = eberlein ( alpha, n )
  r8mat_print ( m, n, a, '  EBERLEIN matrix:' )

  print ''
  print 'EBERLEIN_TEST'
  print '  Normal end of execution.'

  return
Exemple #52
0
def jordan_test():

    # *****************************************************************************80
    #
    ## JORDAN_TEST tests JORDAN.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    10 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8mat_print import r8mat_print
    from r8_uniform_ab import r8_uniform_ab

    print ""
    print "JORDAN_TEST"
    print "  JORDAN computes the JORDAN matrix."

    m = 6
    n = m

    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(r8_lo, r8_hi, seed)

    a = jordan(m, n, alpha)
    r8mat_print(m, n, a, "  JORDAN matrix:")

    print ""
    print "JORDAN_TEST"
    print "  Normal end of execution."

    return
Exemple #53
0
def jordan_test():

    #*****************************************************************************80
    #
    ## JORDAN_TEST tests JORDAN.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    10 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8mat_print import r8mat_print
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'JORDAN_TEST'
    print '  JORDAN computes the JORDAN matrix.'

    m = 6
    n = m

    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(r8_lo, r8_hi, seed)

    a = jordan(m, n, alpha)
    r8mat_print(m, n, a, '  JORDAN matrix:')

    print ''
    print 'JORDAN_TEST'
    print '  Normal end of execution.'

    return
Exemple #54
0
def conex2_test():

    #*****************************************************************************80
    #
    ## CONEX2_TEST tests CONEX2.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    09 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8mat_print import r8mat_print
    from r8_uniform_ab import r8_uniform_ab

    print ''
    print 'CONEX2_TEST'
    print '  CONEX2 computes the CONEX2 matrix.'

    m = 3
    n = m

    alpha_lo = 1.0
    alpha_hi = 100.0
    seed = 123456789
    alpha, seed = r8_uniform_ab(alpha_lo, alpha_hi, seed)

    a = conex2(alpha)
    r8mat_print(m, n, a, '  CONEX2 matrix:')

    print ''
    print 'CONEX2_TEST'
    print '  Normal end of execution.'

    return