コード例 #1
0
def uvwp_ethier_test():

    #*****************************************************************************80
    #
    ## UVWP_ETHIER_TEST samples the solution at the initial time.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    17 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    import numpy as np
    from r8vec_uniform_ab import r8vec_uniform_ab

    a = np.pi / 4.0
    d = np.pi / 2.0

    print ''
    print 'UVWP_ETHIER_TEST'
    print '  Estimate the range of velocity and pressure'
    print '  at the initial time T = 0, using a region that is'
    print '  the cube centered at (0,0,0) with "radius" 1.0,'
    print '  Parameter A = %g' % (a)
    print '  Parameter D = %g' % (d)

    n = 1000
    x_lo = -1.0
    x_hi = +1.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    y, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    z, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    t = 0.0

    u, v, w, p = uvwp_ethier(a, d, n, x, y, z, t)

    print ''
    print '           Minimum       Maximum'
    print ''
    print '  U:  %14.6g  %14.6g' % (np.min(u), np.max(u))
    print '  V:  %14.6g  %14.6g' % (np.min(v), np.max(v))
    print '  W:  %14.6g  %14.6g' % (np.min(w), np.max(w))
    print '  P:  %14.6g  %14.6g' % (np.min(p), np.max(p))

    print ''
    print 'UVWP_ETHIER_TEST:'
    print '  Normal end of execution.'

    return
コード例 #2
0
def resid_ethier_test():

    #*****************************************************************************80
    #
    ## RESID_ETHIER_TEST samples the residual at the initial time.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    17 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    import numpy as np
    from r8vec_uniform_ab import r8vec_uniform_ab

    a = np.pi / 4.0
    d = np.pi / 2.0

    print ''
    print 'RESID_ETHIER_TEST'
    print '  Sample the Navier-Stokes residuals'
    print '  at the initial time T = 0, using a region that is'
    print '  the cube centered at (0,0,0) with "radius" 1.0,'
    print '  Parameter A = %g' % (a)
    print '  Parameter D = %g' % (d)

    n = 1000
    x_lo = -1.0
    x_hi = +1.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    y, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    z, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    t = 0.0

    ur, vr, wr, pr = resid_ethier(a, d, n, x, y, z, t)

    print ''
    print '           Minimum       Maximum'
    print ''
    print '  Ur:  %14.6g  %14.6g' % (np.min(np.abs(ur)), np.max(np.abs(ur)))
    print '  Vr:  %14.6g  %14.6g' % (np.min(np.abs(vr)), np.max(np.abs(vr)))
    print '  Wr:  %14.6g  %14.6g' % (np.min(np.abs(wr)), np.max(np.abs(wr)))
    print '  Pr:  %14.6g  %14.6g' % (np.min(np.abs(pr)), np.max(np.abs(pr)))

    print ''
    print 'RESID_ETHIER_TEST:'
    print '  Normal end of execution.'

    return
コード例 #3
0
def uvwp_ethier_test ( ):

#*****************************************************************************80
#
## UVWP_ETHIER_TEST samples the solution at the initial time.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    17 January 2015
#
#  Author:
#
#    John Burkardt
#
  import numpy as np
  from r8vec_uniform_ab import r8vec_uniform_ab

  a = np.pi / 4.0
  d = np.pi / 2.0

  print ''
  print 'UVWP_ETHIER_TEST'
  print '  Estimate the range of velocity and pressure'
  print '  at the initial time T = 0, using a region that is'
  print '  the cube centered at (0,0,0) with "radius" 1.0,'
  print '  Parameter A = %g' % ( a )
  print '  Parameter D = %g' % ( d )

  n = 1000
  x_lo = -1.0
  x_hi = +1.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  y, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  z, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  t = 0.0

  u, v, w, p = uvwp_ethier ( a, d, n, x, y, z, t )

  print ''
  print '           Minimum       Maximum'
  print ''
  print '  U:  %14.6g  %14.6g' % ( np.min ( u ), np.max ( u ) )
  print '  V:  %14.6g  %14.6g' % ( np.min ( v ), np.max ( v ) )
  print '  W:  %14.6g  %14.6g' % ( np.min ( w ), np.max ( w ) )
  print '  P:  %14.6g  %14.6g' % ( np.min ( p ), np.max ( p ) )

  print ''
  print 'UVWP_ETHIER_TEST:'
  print '  Normal end of execution.'

  return
コード例 #4
0
def resid_ethier_test ( ):

#*****************************************************************************80
#
## RESID_ETHIER_TEST samples the residual at the initial time.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    17 January 2015
#
#  Author:
#
#    John Burkardt
#
  import numpy as np
  from r8vec_uniform_ab import r8vec_uniform_ab

  a = np.pi / 4.0;
  d = np.pi / 2.0;

  print ''
  print 'RESID_ETHIER_TEST'
  print '  Sample the Navier-Stokes residuals'
  print '  at the initial time T = 0, using a region that is'
  print '  the cube centered at (0,0,0) with "radius" 1.0,'
  print '  Parameter A = %g' % ( a )
  print '  Parameter D = %g' % ( d )

  n = 1000
  x_lo = -1.0
  x_hi = +1.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  y, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  z, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  t = 0.0

  ur, vr, wr, pr = resid_ethier ( a, d, n, x, y, z, t )

  print ''
  print '           Minimum       Maximum'
  print ''
  print '  Ur:  %14.6g  %14.6g' % ( np.min ( np.abs ( ur ) ), np.max ( np.abs ( ur ) ) )
  print '  Vr:  %14.6g  %14.6g' % ( np.min ( np.abs ( vr ) ), np.max ( np.abs ( vr ) ) )
  print '  Wr:  %14.6g  %14.6g' % ( np.min ( np.abs ( wr ) ), np.max ( np.abs ( wr ) ) )
  print '  Pr:  %14.6g  %14.6g' % ( np.min ( np.abs ( pr ) ), np.max ( np.abs ( pr ) ) )

  print ''
  print 'RESID_ETHIER_TEST:'
  print '  Normal end of execution.'

  return
コード例 #5
0
ファイル: rhs_taylor.py プロジェクト: wangwt9907/jburkardt-py
def rhs_taylor_test ( ):

#*****************************************************************************80
#
## RHS_TAYLOR_TEST samples the right hand sides at the initial time.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    30 January 2015
#
#  Author:
#
#    John Burkardt
#
  import numpy as np
  from r8vec_uniform_ab import r8vec_uniform_ab

  nu = 1.0
  rho = 1.0

  print ''
  print 'RHS_TAYLOR_TEST'
  print '  Taylor Vortex Flow:'
  print '  Sample the Navier-Stokes right hand sides'
  print '  at the initial time T = 0, using a region that is'
  print '  the square centered at (1.5,1.5) with "radius" 1.0,'
  print '  Kinematic viscosity NU = %g' % ( nu )
  print '  Fluid density RHO = %g' % ( rho )

  n = 1000
  x_lo = 0.5
  x_hi = +2.5
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  y, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  t = 0.0

  f, g, h = rhs_taylor ( nu, rho, n, x, y, t )

  print ''
  print '           Minimum       Maximum'
  print ''
  print '  Ur:  %14.6g  %14.6g' % ( np.min ( f ), np.max ( f ) )
  print '  Vr:  %14.6g  %14.6g' % ( np.min ( g ), np.max ( g ) )
  print '  Pr:  %14.6g  %14.6g' % ( np.min ( h ), np.max ( h ) )

  print ''
  print 'RHS_TAYLOR_TEST:'
  print '  Normal end of execution.'

  return
コード例 #6
0
def resid_spiral_test():

    #*****************************************************************************80
    #
    ## RESID_SPIRAL_TEST samples the residuals at the initial time.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    30 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    import numpy as np
    from r8vec_uniform_ab import r8vec_uniform_ab

    nu = 1.0
    rho = 1.0

    print ''
    print 'RESID_SPIRAL_TEST'
    print '  Spiral Flow:'
    print '  Sample the Navier-Stokes residuals'
    print '  at the initial time T = 0, over the unit square.'
    print '  Kinematic viscosity NU = %g' % (nu)
    print '  Fluid density RHO = %g' % (rho)

    n = 1000
    x_lo = 0.0
    x_hi = 1.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    y, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    t = 0.0

    ur, vr, pr = resid_spiral(nu, rho, n, x, y, t)

    print ''
    print '           Minimum       Maximum'
    print ''
    print '  Ur:  %14.6g  %14.6g' % (np.min(np.abs(ur)), np.max(np.abs(ur)))
    print '  Vr:  %14.6g  %14.6g' % (np.min(np.abs(vr)), np.max(np.abs(vr)))
    print '  Pr:  %14.6g  %14.6g' % (np.min(np.abs(pr)), np.max(np.abs(pr)))

    print ''
    print 'RESID_SPIRAL_TEST:'
    print '  Normal end of execution.'

    return
コード例 #7
0
def uvp_taylor_test ( ):

#*****************************************************************************80
#
## UVP_TAYLOR_TEST samples the solution at the initial time.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    22 January 2015
#
#  Author:
#
#    John Burkardt
#
  import numpy as np
  from r8vec_uniform_ab import r8vec_uniform_ab

  nu = 1.0
  rho = 1.0

  print ''
  print 'UVP_TAYLOR_TEST'
  print '  Estimate the range of velocity and pressure'
  print '  at the initial time T = 0, using a region that is'
  print '  the square centered at (1.5,1.5) with "radius" 1.0,'
  print '  Kinematic viscosity NU = %g' % ( nu )
  print '  Fluid density RHO = %g' % ( rho )

  n = 1000
  x_lo = 0.5
  x_hi = +2.5
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  y, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  t = 0.0

  u, v, p = uvp_taylor ( nu, rho, n, x, y, t )

  print ''
  print '           Minimum       Maximum'
  print ''
  print '  U:  %14.6g  %14.6g' % ( np.min ( u ), np.max ( u ) )
  print '  V:  %14.6g  %14.6g' % ( np.min ( v ), np.max ( v ) )
  print '  P:  %14.6g  %14.6g' % ( np.min ( p ), np.max ( p ) )

  print ''
  print 'UVP_TAYLOR_TEST:'
  print '  Normal end of execution.'

  return
コード例 #8
0
def rhs_lucas_test ( ):

#*****************************************************************************80
#
## RHS_LUCAS_TEST samples the right hand sides at the initial time.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    07 March 2015
#
#  Author:
#
#    John Burkardt
#
  import numpy as np
  from r8vec_uniform_ab import r8vec_uniform_ab

  nu = 1.0
  rho = 1.0

  print ''
  print 'RHS_LUCAS_TEST'
  print '  Lucas Bystricky Flow'
  print '  Sample the Navier-Stokes right hand sides'
  print '  at the initial time T = 0, over the unit square.'
  print '  Kinematic viscosity NU = %g' % ( nu )
  print '  Fluid density RHO = %g' % ( rho )

  n = 1000
  r8_lo = 0.0
  r8_hi = 1.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, r8_lo, r8_hi, seed )
  y, seed = r8vec_uniform_ab ( n, r8_lo, r8_hi, seed )
  t = 0.0

  f, g, h = rhs_lucas ( nu, rho, n, x, y, t )

  print ''
  print '           Minimum       Maximum'
  print ''
  print '  Ur:  %14.6g  %14.6g' % ( np.min ( f ), np.max ( f ) )
  print '  Vr:  %14.6g  %14.6g' % ( np.min ( g ), np.max ( g ) )
  print '  Pr:  %14.6g  %14.6g' % ( np.min ( h ), np.max ( h ) )

  print ''
  print 'RHS_LUCAS_TEST:'
  print '  Normal end of execution.'

  return
コード例 #9
0
def uvp_spiral_test ( ):

#*****************************************************************************80
#
## UVP_SPIRAL_TEST samples the Spiral Flow solution at the initial time.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    29 January 2015
#
#  Author:
#
#    John Burkardt
#
  import numpy as np
  from r8vec_uniform_ab import r8vec_uniform_ab

  nu = 1.0
  rho = 1.0

  print ''
  print 'UVP_SPIRAL_TEST'
  print '  Spiral Flow:'
  print '  Estimate the range of velocity and pressure'
  print '  at the initial time T = 0, over the unit square.'
  print '  Kinematic viscosity NU = %g' % ( nu )
  print '  Fluid density RHO = %g' % ( rho )

  n = 1000
  x_lo = 0.0
  x_hi = +1.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  y, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  t = 0.0

  u, v, p = uvp_spiral ( nu, rho, n, x, y, t )

  print ''
  print '           Minimum       Maximum'
  print ''
  print '  U:  %14.6g  %14.6g' % ( np.min ( u ), np.max ( u ) )
  print '  V:  %14.6g  %14.6g' % ( np.min ( v ), np.max ( v ) )
  print '  P:  %14.6g  %14.6g' % ( np.min ( p ), np.max ( p ) )

  print ''
  print 'UVP_SPIRAL_TEST:'
  print '  Normal end of execution.'

  return
コード例 #10
0
def resid_spiral_test ( ):

#*****************************************************************************80
#
## RESID_SPIRAL_TEST samples the residuals at the initial time.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    30 January 2015
#
#  Author:
#
#    John Burkardt
#
  import numpy as np
  from r8vec_uniform_ab import r8vec_uniform_ab

  nu = 1.0
  rho = 1.0

  print ''
  print 'RESID_SPIRAL_TEST'
  print '  Spiral Flow:'
  print '  Sample the Navier-Stokes residuals'
  print '  at the initial time T = 0, over the unit square.'
  print '  Kinematic viscosity NU = %g' % ( nu )
  print '  Fluid density RHO = %g' % ( rho )

  n = 1000
  x_lo = 0.0
  x_hi = 1.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  y, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  t = 0.0

  ur, vr, pr = resid_spiral ( nu, rho, n, x, y, t )

  print ''
  print '           Minimum       Maximum'
  print ''
  print '  Ur:  %14.6g  %14.6g' % ( np.min ( np.abs ( ur ) ), np.max ( np.abs ( ur ) ) )
  print '  Vr:  %14.6g  %14.6g' % ( np.min ( np.abs ( vr ) ), np.max ( np.abs ( vr ) ) )
  print '  Pr:  %14.6g  %14.6g' % ( np.min ( np.abs ( pr ) ), np.max ( np.abs ( pr ) ) )

  print ''
  print 'RESID_SPIRAL_TEST:'
  print '  Normal end of execution.'

  return
コード例 #11
0
ファイル: rhs_lucas.py プロジェクト: wangwt9907/jburkardt-py
def rhs_lucas_test():

    #*****************************************************************************80
    #
    ## RHS_LUCAS_TEST samples the right hand sides at the initial time.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    07 March 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    import numpy as np
    from r8vec_uniform_ab import r8vec_uniform_ab

    nu = 1.0
    rho = 1.0

    print ''
    print 'RHS_LUCAS_TEST'
    print '  Lucas Bystricky Flow'
    print '  Sample the Navier-Stokes right hand sides'
    print '  at the initial time T = 0, over the unit square.'
    print '  Kinematic viscosity NU = %g' % (nu)
    print '  Fluid density RHO = %g' % (rho)

    n = 1000
    r8_lo = 0.0
    r8_hi = 1.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, r8_lo, r8_hi, seed)
    y, seed = r8vec_uniform_ab(n, r8_lo, r8_hi, seed)
    t = 0.0

    f, g, h = rhs_lucas(nu, rho, n, x, y, t)

    print ''
    print '           Minimum       Maximum'
    print ''
    print '  Ur:  %14.6g  %14.6g' % (np.min(f), np.max(f))
    print '  Vr:  %14.6g  %14.6g' % (np.min(g), np.max(g))
    print '  Pr:  %14.6g  %14.6g' % (np.min(h), np.max(h))

    print ''
    print 'RHS_LUCAS_TEST:'
    print '  Normal end of execution.'

    return
コード例 #12
0
ファイル: uvp_taylor.py プロジェクト: wangwt9907/jburkardt-py
def uvp_taylor_test():

    #*****************************************************************************80
    #
    ## UVP_TAYLOR_TEST samples the solution at the initial time.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    22 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    import numpy as np
    from r8vec_uniform_ab import r8vec_uniform_ab

    nu = 1.0
    rho = 1.0

    print ''
    print 'UVP_TAYLOR_TEST'
    print '  Estimate the range of velocity and pressure'
    print '  at the initial time T = 0, using a region that is'
    print '  the square centered at (1.5,1.5) with "radius" 1.0,'
    print '  Kinematic viscosity NU = %g' % (nu)
    print '  Fluid density RHO = %g' % (rho)

    n = 1000
    x_lo = 0.5
    x_hi = +2.5
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    y, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    t = 0.0

    u, v, p = uvp_taylor(nu, rho, n, x, y, t)

    print ''
    print '           Minimum       Maximum'
    print ''
    print '  U:  %14.6g  %14.6g' % (np.min(u), np.max(u))
    print '  V:  %14.6g  %14.6g' % (np.min(v), np.max(v))
    print '  P:  %14.6g  %14.6g' % (np.min(p), np.max(p))

    print ''
    print 'UVP_TAYLOR_TEST:'
    print '  Normal end of execution.'

    return
コード例 #13
0
ファイル: uvp_spiral.py プロジェクト: wangwt9907/jburkardt-py
def uvp_spiral_test():

    #*****************************************************************************80
    #
    ## UVP_SPIRAL_TEST samples the Spiral Flow solution at the initial time.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    29 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    import numpy as np
    from r8vec_uniform_ab import r8vec_uniform_ab

    nu = 1.0
    rho = 1.0

    print ''
    print 'UVP_SPIRAL_TEST'
    print '  Spiral Flow:'
    print '  Estimate the range of velocity and pressure'
    print '  at the initial time T = 0, over the unit square.'
    print '  Kinematic viscosity NU = %g' % (nu)
    print '  Fluid density RHO = %g' % (rho)

    n = 1000
    x_lo = 0.0
    x_hi = +1.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    y, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    t = 0.0

    u, v, p = uvp_spiral(nu, rho, n, x, y, t)

    print ''
    print '           Minimum       Maximum'
    print ''
    print '  U:  %14.6g  %14.6g' % (np.min(u), np.max(u))
    print '  V:  %14.6g  %14.6g' % (np.min(v), np.max(v))
    print '  P:  %14.6g  %14.6g' % (np.min(p), np.max(p))

    print ''
    print 'UVP_SPIRAL_TEST:'
    print '  Normal end of execution.'

    return
コード例 #14
0
def uv_spiral_test ( ):

#*****************************************************************************80
#
## UV_SPIRAL_TEST generates a field and estimates its range.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    20 January 2015
#
#  Author:
#
#    John Burkardt
#
  import numpy as np
  from r8vec_uniform_ab import r8vec_uniform_ab

  nu = 1.0
  rho = 1.0

  print ''
  print 'UV_SPIRAL_TEST'
  print '  Sample a spiral velocity field and estimate'
  print '  the range of the solution values.'

  n = 1000
  x_lo = 0.0
  x_hi = +1.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  y, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )

  c = 1.0
  u, v = uv_spiral ( n, x, y, c )

  print ''
  print '           Minimum       Maximum'
  print ''
  print '  U:  %14.6g  %14.6g' % ( np.min ( u ), np.max ( u ) )
  print '  V:  %14.6g  %14.6g' % ( np.min ( v ), np.max ( v ) )

  print ''
  print 'UV_SPIRAL_TEST:'
  print '  Normal end of execution.'

  return
コード例 #15
0
ファイル: ortega.py プロジェクト: johannesgerer/jburkardt-py
def ortega_determinant_test ( ):

#*****************************************************************************80
#
## ORTEGA_DETERMINANT_TEST tests ORTEGA_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    20 February 2015
#
#  Author:
#
#    John Burkardt
#
  from ortega import ortega
  from r8mat_print import r8mat_print
  from r8vec_uniform_ab import r8vec_uniform_ab
 
  print ''
  print 'ORTEGA_DETERMINANT_TEST'
  print '  ORTEGA_DETERMINANT computes the determinant of the ORTEGA matrix.'
  print ''

  m = 5
  n = m
  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  v1, seed = r8vec_uniform_ab ( n, r8_lo, r8_hi, seed )
  v2, seed = r8vec_uniform_ab ( n, r8_lo, r8_hi, seed )
  v3, seed = r8vec_uniform_ab ( n, r8_lo, r8_hi, seed )

  a = ortega ( n, v1, v2, v3 )

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

  value = ortega_determinant ( n )

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

  print ''
  print 'ORTEGA_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
コード例 #16
0
ファイル: ortega.py プロジェクト: wangwt9907/jburkardt-py
def ortega_determinant_test():

    #*****************************************************************************80
    #
    ## ORTEGA_DETERMINANT_TEST tests ORTEGA_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    20 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from ortega import ortega
    from r8mat_print import r8mat_print
    from r8vec_uniform_ab import r8vec_uniform_ab

    print ''
    print 'ORTEGA_DETERMINANT_TEST'
    print '  ORTEGA_DETERMINANT computes the determinant of the ORTEGA matrix.'
    print ''

    m = 5
    n = m
    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    v1, seed = r8vec_uniform_ab(n, r8_lo, r8_hi, seed)
    v2, seed = r8vec_uniform_ab(n, r8_lo, r8_hi, seed)
    v3, seed = r8vec_uniform_ab(n, r8_lo, r8_hi, seed)

    a = ortega(n, v1, v2, v3)

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

    value = ortega_determinant(n)

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

    print ''
    print 'ORTEGA_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
コード例 #17
0
ファイル: triv.py プロジェクト: johannesgerer/jburkardt-py
def triv_determinant_test ( ):

#*****************************************************************************80
#
## TRIV_DETERMINANT_TEST tests TRIV_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    26 February 2015
#
#  Author:
#
#    John Burkardt
#
  from triv import triv
  from r8vec_uniform_ab import r8vec_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'TRIV_DETERMINANT_TEST'
  print '  TRIV_DETERMINANT computes the TRIV determinant.'

  m = 5
  n = m
  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n - 1, r8_lo, r8_hi, seed )
  y, seed = r8vec_uniform_ab ( n, r8_lo, r8_hi, seed )
  z, seed = r8vec_uniform_ab ( n - 1, r8_lo, r8_hi, seed )
  a = triv ( n, x, y, z )

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

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

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

  print ''
  print 'TRIV_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
コード例 #18
0
def uvp_stokes2_test():

    #*****************************************************************************80
    #
    ## UVP_STOKES2_TEST samples the solution.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    25 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    import numpy as np
    from r8vec_uniform_ab import r8vec_uniform_ab

    print ''
    print 'UVP_STOKES2_TEST'
    print '  Exact Stokes solution #2.'
    print '  Estimate the range of velocity and pressure'
    print '  using a region that is the unit square.'

    n = 1000
    x_lo = 0.0
    x_hi = +1.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    y, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)

    u, v, p = uvp_stokes2(n, x, y)

    print ''
    print '           Minimum       Maximum'
    print ''
    print '  U:  %14.6g  %14.6g' % (np.min(u), np.max(u))
    print '  V:  %14.6g  %14.6g' % (np.min(v), np.max(v))
    print '  P:  %14.6g  %14.6g' % (np.min(p), np.max(p))

    print ''
    print 'UVP_STOKES2_TEST:'
    print '  Normal end of execution.'

    return
コード例 #19
0
ファイル: triv.py プロジェクト: wangwt9907/jburkardt-py
def triv_determinant_test():

    #*****************************************************************************80
    #
    ## TRIV_DETERMINANT_TEST tests TRIV_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    26 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from triv import triv
    from r8vec_uniform_ab import r8vec_uniform_ab
    from r8mat_print import r8mat_print

    print ''
    print 'TRIV_DETERMINANT_TEST'
    print '  TRIV_DETERMINANT computes the TRIV determinant.'

    m = 5
    n = m
    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n - 1, r8_lo, r8_hi, seed)
    y, seed = r8vec_uniform_ab(n, r8_lo, r8_hi, seed)
    z, seed = r8vec_uniform_ab(n - 1, r8_lo, r8_hi, seed)
    a = triv(n, x, y, z)

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

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

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

    print ''
    print 'TRIV_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
コード例 #20
0
def resid_spiral_test():

    #*****************************************************************************80
    #
    ## RESID_SPIRAL_TEST generates a field and samples its residuals.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    20 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    import numpy as np
    from r8vec_uniform_ab import r8vec_uniform_ab

    print ''
    print 'RESID_SPIRAL_TEST'
    print '  Sample a spiral velocity field and estimate the'
    print '  range of residuals in the continuity equation.'

    n = 1000
    x_lo = 0.0
    x_hi = +1.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    y, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    t = 0.0

    c = 1.00

    pr = resid_spiral(n, x, y, c)

    print ''
    print '           Minimum       Maximum'
    print ''
    print '  Pr:  %14.6g  %14.6g' % (np.min(np.abs(pr)), np.max(np.abs(pr)))

    print ''
    print 'RESID_SPIRAL_TEST:'
    print '  Normal end of execution.'

    return
コード例 #21
0
def rhs_stokes2_test ( ):

#*****************************************************************************80
#
## RHS_STOKES2_TEST samples the right hand sides.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    25 January 2015
#
#  Author:
#
#    John Burkardt
#
  import numpy as np
  from r8vec_uniform_ab import r8vec_uniform_ab

  print ''
  print 'RHS_STOKES2_TEST'
  print '  Exact Stokes solution #2.'
  print '  Estimate the range of the right hand side functions'
  print '  using a region that is the unit square.'

  n = 1000
  x_lo = 0.0
  x_hi = +1.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  y, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )

  f, g, h = rhs_stokes2 ( n, x, y )

  print ''
  print '           Minimum       Maximum'
  print ''
  print '  U:  %14.6g  %14.6g' % ( np.min ( f ), np.max ( f ) )
  print '  V:  %14.6g  %14.6g' % ( np.min ( g ), np.max ( g ) )
  print '  P:  %14.6g  %14.6g' % ( np.min ( h ), np.max ( h ) )

  print ''
  print 'RHS_STOKES2_TEST:'
  print '  Normal end of execution.'

  return
コード例 #22
0
def uvp_stokes1_test ( ):

#*****************************************************************************80
#
## UVP_STOKES1_TEST samples the solution.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    25 January 2015
#
#  Author:
#
#    John Burkardt
#
  import numpy as np
  from r8vec_uniform_ab import r8vec_uniform_ab

  print ''
  print 'UVP_STOKES1_TEST'
  print '  Exact Stokes solution #1.'
  print '  Estimate the range of velocity and pressure'
  print '  using a region that is the unit square.'

  n = 1000
  x_lo = 0.0
  x_hi = +1.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  y, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )

  u, v, p = uvp_stokes1 ( n, x, y )

  print ''
  print '           Minimum       Maximum'
  print ''
  print '  U:  %14.6g  %14.6g' % ( np.min ( u ), np.max ( u ) )
  print '  V:  %14.6g  %14.6g' % ( np.min ( v ), np.max ( v ) )
  print '  P:  %14.6g  %14.6g' % ( np.min ( p ), np.max ( p ) )

  print ''
  print 'UVP_STOKES1_TEST:'
  print '  Normal end of execution.'

  return
コード例 #23
0
def resid_stokes3_test ( ):

#*****************************************************************************80
#
## RESID_STOKES3_TEST samples the residuals.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    12 February 2015
#
#  Author:
#
#    John Burkardt
#
  import numpy as np
  from r8vec_uniform_ab import r8vec_uniform_ab

  print ''
  print 'RESID_STOKES3_TEST'
  print '  Exact Stokes solution #3.'
  print '  Sample the Stokes residuals.'

  n = 1000
  x_lo = -1.0
  x_hi = +1.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )
  y, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )

  ur, vr, pr = resid_stokes3 ( n, x, y )

  print ''
  print '           Minimum       Maximum'
  print ''
  print '  Ur:  %14.6g  %14.6g' % ( np.min ( np.abs ( ur ) ), np.max ( np.abs ( ur ) ) )
  print '  Vr:  %14.6g  %14.6g' % ( np.min ( np.abs ( vr ) ), np.max ( np.abs ( vr ) ) )
  print '  Pr:  %14.6g  %14.6g' % ( np.min ( np.abs ( pr ) ), np.max ( np.abs ( pr ) ) )

  print ''
  print 'RESID_STOKES3_TEST:'
  print '  Normal end of execution.'

  return
コード例 #24
0
def resid_stokes3_test():

    #*****************************************************************************80
    #
    ## RESID_STOKES3_TEST samples the residuals.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    12 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    import numpy as np
    from r8vec_uniform_ab import r8vec_uniform_ab

    print ''
    print 'RESID_STOKES3_TEST'
    print '  Exact Stokes solution #3.'
    print '  Sample the Stokes residuals.'

    n = 1000
    x_lo = -1.0
    x_hi = +1.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)
    y, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)

    ur, vr, pr = resid_stokes3(n, x, y)

    print ''
    print '           Minimum       Maximum'
    print ''
    print '  Ur:  %14.6g  %14.6g' % (np.min(np.abs(ur)), np.max(np.abs(ur)))
    print '  Vr:  %14.6g  %14.6g' % (np.min(np.abs(vr)), np.max(np.abs(vr)))
    print '  Pr:  %14.6g  %14.6g' % (np.min(np.abs(pr)), np.max(np.abs(pr)))

    print ''
    print 'RESID_STOKES3_TEST:'
    print '  Normal end of execution.'

    return
コード例 #25
0
ファイル: clement2.py プロジェクト: wangwt9907/jburkardt-py
def clement2_determinant_test():

    #*****************************************************************************80
    #
    ## CLEMENT2_DETERMINANT_TEST tests CLEMENT2_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    27 December 2014
    #
    #  Author:
    #
    #    John Burkardt
    #
    from clement2 import clement2
    from r8mat_print import r8mat_print
    from r8vec_uniform_ab import r8vec_uniform_ab

    print ''
    print 'CLEMENT2_DETERMINANT_TEST'
    print '  CLEMENT2_DETERMINANT computes the CLEMENT2 determinant.'

    m = 4
    n = m
    seed = 123456789
    x, seed = r8vec_uniform_ab(n - 1, -5.0, +5.0, seed)
    y, seed = r8vec_uniform_ab(n - 1, -5.0, +5.0, seed)

    a = clement2(n, x, y)
    r8mat_print(m, n, a, '  CLEMENT2 matrix:')

    value = clement2_determinant(n, x, y)
    print '  Value =  %g' % (value)

    print ''
    print 'CLEMENT2_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
コード例 #26
0
def clement2_determinant_test ( ):

#*****************************************************************************80
#
## CLEMENT2_DETERMINANT_TEST tests CLEMENT2_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    27 December 2014
#
#  Author:
#
#    John Burkardt
#
  from clement2 import clement2
  from r8mat_print import r8mat_print
  from r8vec_uniform_ab import r8vec_uniform_ab

  print ''
  print 'CLEMENT2_DETERMINANT_TEST'
  print '  CLEMENT2_DETERMINANT computes the CLEMENT2 determinant.'

  m = 4
  n = m
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n-1, -5.0, +5.0, seed )
  y, seed = r8vec_uniform_ab ( n-1, -5.0, +5.0, seed )

  a = clement2 ( n, x, y )
  r8mat_print ( m, n, a, '  CLEMENT2 matrix:' )

  value = clement2_determinant ( n, x, y )
  print '  Value =  %g' % ( value )

  print ''
  print 'CLEMENT2_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
コード例 #27
0
def schur_block_test ( ):

#*****************************************************************************80
#
## SCHUR_BLOCK_TEST tests SCHUR_BLOCK.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    28 March 2015
#
#  Author:
#
#    John Burkardt
#
  from r8mat_print import r8mat_print
  from r8vec_uniform_ab import r8vec_uniform_ab

  print ''
  print 'SCHUR_BLOCK_TEST'
  print '  SCHUR_BLOCK computes the SCHUR_BLOCK matrix.'

  m = 5
  n = m
  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  x_n = ( ( n + 1 ) // 2 )
  x, seed = r8vec_uniform_ab ( x_n, r8_lo, r8_hi, seed )
  y_n = ( n // 2 )
  y, seed = r8vec_uniform_ab ( y_n, r8_lo, r8_hi, seed )
  a = schur_block ( n, x, y )

  r8mat_print ( n, n, a, '  SCHUR_BLOCK matrix:' )

  print ''
  print 'SCHUR_BLOCK_TEST'
  print '  Normal end of execution.'

  return
コード例 #28
0
ファイル: gk324.py プロジェクト: wangwt9907/jburkardt-py
def gk324_determinant_test():

    #*****************************************************************************80
    #
    ## GK324_DETERMINANT_TEST tests GK324_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    09 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from gk324 import gk324
    from r8mat_print import r8mat_print
    from r8vec_uniform_ab import r8vec_uniform_ab

    print ''
    print 'GK324_DETERMINANT_TEST'
    print '  GK324_DETERMINANT computes the GK324 determinant.'

    m = 5
    n = m

    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    if (n < m):
        x_n = n
    else:
        x_n = n - 1

    x, seed = r8vec_uniform_ab(x_n, r8_lo, r8_hi, seed)

    a = gk324(m, n, x)

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

    value = gk324_determinant(n, x)

    print '  Value =  %g' % (value)

    print ''
    print 'GK324_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
コード例 #29
0
ファイル: gk324.py プロジェクト: johannesgerer/jburkardt-py
def gk324_determinant_test ( ):

#*****************************************************************************80
#
## GK324_DETERMINANT_TEST tests GK324_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    09 February 2015
#
#  Author:
#
#    John Burkardt
#
  from gk324 import gk324
  from r8mat_print import r8mat_print
  from r8vec_uniform_ab import r8vec_uniform_ab

  print ''
  print 'GK324_DETERMINANT_TEST'
  print '  GK324_DETERMINANT computes the GK324 determinant.'

  m = 5
  n = m
 
  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  if ( n < m ):
    x_n = n
  else:
    x_n = n - 1

  x, seed = r8vec_uniform_ab ( x_n, r8_lo, r8_hi, seed )

  a = gk324 ( m, n, x )

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

  value = gk324_determinant ( n, x )

  print '  Value =  %g' % ( value )

  print ''
  print 'GK324_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
コード例 #30
0
ファイル: r8vec_frac.py プロジェクト: wangwt9907/jburkardt-py
def r8vec_frac_test ( ):

#*****************************************************************************80
#
## R8VEC_FRAC_TEST tests R8VEC_FRAC.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    30 May 2015
#
#  Author:
#
#    John Burkardt
#
  from r8vec_print import r8vec_print
  from r8vec_uniform_ab import r8vec_uniform_ab

  n = 10
  ahi = 10.0
  alo = 0.0

  print ''
  print 'R8VEC_FRAC_TEST'
  print '  R8VEC_FRAC: K-th smallest real vector entry;'

  seed = 123456789

  a, seed = r8vec_uniform_ab ( n, alo, ahi, seed )

  r8vec_print ( n, a, '  The real array to search: ' )

  print ''
  print 'Frac   R8VEC_FRAC'
  print ''

  for k in range ( 1, n + 1 ):

    afrac = r8vec_frac ( n, a, k )
    print '  %2d  %6f' % ( k, afrac )
#
#  Terminate.
#
  print ''
  print 'R8VEC_FRAC_TEST'
  print '  Normal end of execution.'

  return
コード例 #31
0
ファイル: kershawtri.py プロジェクト: wangwt9907/jburkardt-py
def kershawtri_determinant_test():

    #*****************************************************************************80
    #
    ## KERSHAWTRI_DETERMINANT_TEST tests KERSHAWTRI_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    17 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from kershawtri import kershawtri
    from r8vec_uniform_ab import r8vec_uniform_ab
    from r8mat_print import r8mat_print

    print ''
    print 'KERSHAWTRI_DETERMINANT_TEST'
    print '  KERSHAWTRI_DETERMINANT computes the KERSHAWTRI determinant.'

    n = 5

    x_n = ((n + 1) // 2)
    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(x_n, r8_lo, r8_hi, seed)

    a = kershawtri(n, x)
    m = n
    r8mat_print(m, n, a, '  KERSHAWTRI matrix:')

    value = kershawtri_determinant(n, x)

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

    print ''
    print 'KERSHAWTRI_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
コード例 #32
0
def kershawtri_determinant_test ( ):

#*****************************************************************************80
#
## KERSHAWTRI_DETERMINANT_TEST tests KERSHAWTRI_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    17 February 2015
#
#  Author:
#
#    John Burkardt
#
  from kershawtri import kershawtri
  from r8vec_uniform_ab import r8vec_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'KERSHAWTRI_DETERMINANT_TEST'
  print '  KERSHAWTRI_DETERMINANT computes the KERSHAWTRI determinant.'

  n = 5

  x_n = ( ( n + 1 ) // 2 )
  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( x_n, r8_lo, r8_hi, seed )

  a = kershawtri ( n, x )
  m = n
  r8mat_print ( m, n, a, '  KERSHAWTRI matrix:' )

  value = kershawtri_determinant ( n, x )

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

  print ''
  print 'KERSHAWTRI_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
コード例 #33
0
ファイル: fiedler.py プロジェクト: johannesgerer/jburkardt-py
def fiedler_determinant_test ( ):

#*****************************************************************************80
#
## FIEDLER_DETERMINANT_TEST tests FIEDLER_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    31 January 2015
#
#  Author:
#
#    John Burkardt
#
  from fiedler import fiedler
  from r8vec_uniform_ab import r8vec_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'FIEDLER_DETERMINANT_TEST'
  print '  FIEDLER_DETERMINANT computes the FIEDLER determinant.'

  m = 5
  n = m
  x_lo = -5.0
  x_hi = +5.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )

  a = fiedler ( m, n, x )

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

  value = fiedler_determinant ( n, x )

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

  print ''
  print 'FIEDLER_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
コード例 #34
0
def r8vec_norm_l0_test ( ):

#*****************************************************************************80
#
## R8VEC_NORM_L0_TEST tests R8VEC_NORM_L0.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    03 January 2015
#
#  Author:
#
#    John Burkardt
#
  from r8vec_nint import r8vec_nint
  from r8vec_print import r8vec_print
  from r8vec_uniform_ab import r8vec_uniform_ab

  print ''
  print 'R8VEC_NORM_L0_TEST'
  print '  R8VEC_NORM_L0 computes the L0 "norm" of an R8VEC.'

  n = 10
  a_lo = - 2.0
  a_hi = + 2.0
  seed = 123456789

  a, seed = r8vec_uniform_ab ( n, a_lo, a_hi, seed )
  a = r8vec_nint ( n, a )

  r8vec_print ( n, a, '  Input vector:' )

  value = r8vec_norm_l0 ( n, a )
  print ''
  print '  L0 norm = %g' % ( value )
#
#  Terminate.
#
  print ''
  print 'R8VEC_NORM_L0_TEST:'
  print '  Normal end of execution.'

  return
コード例 #35
0
ファイル: milnes.py プロジェクト: johannesgerer/jburkardt-py
def milnes_determinant_test ( ):

#*****************************************************************************80
#
## MILNES_DETERMINANT_TEST tests MILNES_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    19 February 2015
#
#  Author:
#
#    John Burkardt
#
  from milnes import milnes
  from r8vec_uniform_ab import r8vec_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'MILNES_DETERMINANT_TEST'
  print '  MILNES_DETERMINANT computes the MILNES determinant.'

  m = 5
  n = m
  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, r8_lo, r8_hi, seed )

  a = milnes ( m, n, x )

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

  value = milnes_determinant ( n, x )

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

  print ''
  print 'MILNES_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
コード例 #36
0
ファイル: vand1.py プロジェクト: wangwt9907/jburkardt-py
def vand1_determinant_test():

    #*****************************************************************************80
    #
    ## VAND1_DETERMINANT_TEST tests VAND1_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    27 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from vand1 import vand1
    from r8vec_uniform_ab import r8vec_uniform_ab
    from r8mat_print import r8mat_print

    print ''
    print 'VAND1_DETERMINANT_TEST'
    print '  VAND1_DETERMINANT computes the VAND1 determinant.'

    m = 5
    n = m
    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, r8_lo, r8_hi, seed)

    a = vand1(n, x)

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

    value = vand1_determinant(n, x)

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

    print ''
    print 'VAND1_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
コード例 #37
0
def spline_determinant_test():

    #*****************************************************************************80
    #
    ## SPLINE_DETERMINANT_TEST tests SPLINE_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    24 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from spline import spline
    from r8vec_uniform_ab import r8vec_uniform_ab
    from r8mat_print import r8mat_print

    print ''
    print 'SPLINE_DETERMINANT_TEST'
    print '  SPLINE_DETERMINANT computes the SPLINE determinant.'

    m = 5
    n = m
    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n - 1, r8_lo, r8_hi, seed)

    a = spline(n, x)

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

    value = spline_determinant(n, x)

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

    print ''
    print 'SPLINE_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
コード例 #38
0
ファイル: spline.py プロジェクト: johannesgerer/jburkardt-py
def spline_determinant_test ( ):

#*****************************************************************************80
#
## SPLINE_DETERMINANT_TEST tests SPLINE_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    24 February 2015
#
#  Author:
#
#    John Burkardt
#
  from spline import spline
  from r8vec_uniform_ab import r8vec_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'SPLINE_DETERMINANT_TEST'
  print '  SPLINE_DETERMINANT computes the SPLINE determinant.'

  m = 5
  n = m
  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n - 1, r8_lo, r8_hi, seed )

  a = spline ( n, x )

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

  value = spline_determinant ( n, x )

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

  print ''
  print 'SPLINE_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
コード例 #39
0
ファイル: milnes.py プロジェクト: wangwt9907/jburkardt-py
def milnes_determinant_test():

    #*****************************************************************************80
    #
    ## MILNES_DETERMINANT_TEST tests MILNES_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    19 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from milnes import milnes
    from r8vec_uniform_ab import r8vec_uniform_ab
    from r8mat_print import r8mat_print

    print ''
    print 'MILNES_DETERMINANT_TEST'
    print '  MILNES_DETERMINANT computes the MILNES determinant.'

    m = 5
    n = m
    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, r8_lo, r8_hi, seed)

    a = milnes(m, n, x)

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

    value = milnes_determinant(n, x)

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

    print ''
    print 'MILNES_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
コード例 #40
0
ファイル: fiedler.py プロジェクト: wangwt9907/jburkardt-py
def fiedler_determinant_test():

    #*****************************************************************************80
    #
    ## FIEDLER_DETERMINANT_TEST tests FIEDLER_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    31 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from fiedler import fiedler
    from r8vec_uniform_ab import r8vec_uniform_ab
    from r8mat_print import r8mat_print

    print ''
    print 'FIEDLER_DETERMINANT_TEST'
    print '  FIEDLER_DETERMINANT computes the FIEDLER determinant.'

    m = 5
    n = m
    x_lo = -5.0
    x_hi = +5.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)

    a = fiedler(m, n, x)

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

    value = fiedler_determinant(n, x)

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

    print ''
    print 'FIEDLER_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
コード例 #41
0
def r8vec_norm_l0_test():

    #*****************************************************************************80
    #
    ## R8VEC_NORM_L0_TEST tests R8VEC_NORM_L0.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    03 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8vec_nint import r8vec_nint
    from r8vec_print import r8vec_print
    from r8vec_uniform_ab import r8vec_uniform_ab

    print ''
    print 'R8VEC_NORM_L0_TEST'
    print '  R8VEC_NORM_L0 computes the L0 "norm" of an R8VEC.'

    n = 10
    a_lo = -2.0
    a_hi = +2.0
    seed = 123456789

    a, seed = r8vec_uniform_ab(n, a_lo, a_hi, seed)
    a = r8vec_nint(n, a)

    r8vec_print(n, a, '  Input vector:')

    value = r8vec_norm_l0(n, a)
    print ''
    print '  L0 norm = %g' % (value)
    #
    #  Terminate.
    #
    print ''
    print 'R8VEC_NORM_L0_TEST:'
    print '  Normal end of execution.'

    return
コード例 #42
0
ファイル: vand2.py プロジェクト: johannesgerer/jburkardt-py
def vand2_determinant_test ( ):

#*****************************************************************************80
#
## VAND2_DETERMINANT_TEST tests VAND2_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    27 February 2015
#
#  Author:
#
#    John Burkardt
#
  from vand2 import vand2
  from r8vec_uniform_ab import r8vec_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'VAND2_DETERMINANT_TEST'
  print '  VAND2_DETERMINANT computes the VAND2 determinant.'

  m = 5
  n = m
  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, r8_lo, r8_hi, seed )

  a = vand2 ( n, x )

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

  value = vand2_determinant ( n, x )

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

  print ''
  print 'VAND2_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
コード例 #43
0
def r8vec_max_test ( ):

#*****************************************************************************80
#
## R8VEC_MAX_TEST tests R8VEC_MAX.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    15 January 2015
#
#  Author:
#
#    John Burkardt
#
  import platform
  from r8vec_print import r8vec_print
  from r8vec_uniform_ab import r8vec_uniform_ab

  print ( '' )
  print ( 'R8VEC_MAX_TEST' )
  print ( '  Python version: %s' % ( platform.python_version ( ) ) )
  print ( '  R8VEC_MAX computes the maximum entry in an R8VEC.' )

  n = 10
  a_lo = - 10.0
  a_hi = + 10.0
  seed = 123456789

  a, seed = r8vec_uniform_ab ( n, a_lo, a_hi, seed )

  r8vec_print ( n, a, '  Input vector:' )

  value = r8vec_max ( n, a )
  print ( '' )
  print ( '  Max = %g' % ( value ) )
#
#  Terminate.
#
  print ( '' )
  print ( 'R8VEC_MAX_TEST:' )
  print ( '  Normal end of execution.' )
  return
コード例 #44
0
ファイル: diagonal.py プロジェクト: wangwt9907/jburkardt-py
def diagonal_determinant_test():

    #*****************************************************************************80
    #
    ## DIAGONAL_DETERMINANT_TEST tests DIAGONAL_DETERMINANT.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    17 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from diagonal import diagonal
    from r8vec_uniform_ab import r8vec_uniform_ab
    from r8mat_print import r8mat_print

    print ''
    print 'DIAGONAL_DETERMINANT_TEST'
    print '  DIAGONAL_DETERMINANT computes the DIAGONAL determinant.'

    m = 5
    n = m
    r8_lo = -5.0
    r8_hi = +5.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, r8_lo, r8_hi, seed)

    a = diagonal(m, n, x)

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

    value = diagonal_determinant(n, x)

    print '  Value =  %g' % (value)

    print ''
    print 'DIAGONAL_DETERMINANT_TEST'
    print '  Normal end of execution.'

    return
コード例 #45
0
ファイル: diagonal.py プロジェクト: wangwt9907/jburkardt-py
def diagonal_condition_test():

    #*****************************************************************************80
    #
    ## DIAGONAL_CONDITION_TEST tests DIAGONAL_CONDITION.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    18 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from diagonal import diagonal
    from r8vec_uniform_ab import r8vec_uniform_ab
    from r8mat_print import r8mat_print

    print ''
    print 'DIAGONAL_CONDITION_TEST'
    print '  DIAGONAL_CONDITION computes the DIAGONAL condition.'

    m = 5
    n = m
    x_lo = -5.0
    x_hi = +10.0
    seed = 123456789
    x, seed = r8vec_uniform_ab(n, x_lo, x_hi, seed)

    a = diagonal(m, n, x)

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

    value = diagonal_condition(n, x)

    print '  Value =  %g' % (value)

    print ''
    print 'DIAGONAL_CONDITION_TEST'
    print '  Normal end of execution.'

    return
コード例 #46
0
def r8vec_variance_test():

    #*****************************************************************************80
    #
    ## R8VEC_VARIANCE_TEST tests R8VEC_VARIANCE.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    02 March 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    import platform
    from r8vec_print import r8vec_print
    from r8vec_uniform_ab import r8vec_uniform_ab

    print('')
    print('R8VEC_VARIANCE_TEST')
    print('  Python version: %s' % (platform.python_version()))
    print('  R8VEC_VARIANCE computes the variance of an R8VEC.')

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

    a, seed = r8vec_uniform_ab(n, r8_lo, r8_hi, seed)

    r8vec_print(n, a, '  Input vector:')

    value = r8vec_variance(n, a)
    print('')
    print('  Value = %g' % (value))
    #
    #  Terminate.
    #
    print('')
    print('R8VEC_VARIANCE_TEST:')
    print('  Normal end of execution.')
    return
コード例 #47
0
def r8vec_norm_li_test():

    #*****************************************************************************80
    #
    ## R8VEC_NORM_LI_TEST tests R8VEC_NORM_LI.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    19 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8vec_nint import r8vec_nint
    from r8vec_print import r8vec_print
    from r8vec_uniform_ab import r8vec_uniform_ab

    print ''
    print 'R8VEC_NORM_LI_TEST'
    print '  R8VEC_NORM_LI computes the Loo norm of an R8VEC.'

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

    a, seed = r8vec_uniform_ab(n, r8_lo, r8_hi, seed)

    r8vec_print(n, a, '  Input vector:')

    value = r8vec_norm_li(n, a)
    print ''
    print '  Loo norm = %g' % (value)
    #
    #  Terminate.
    #
    print ''
    print 'R8VEC_NORM_LI_TEST:'
    print '  Normal end of execution.'

    return
コード例 #48
0
def diagonal_condition_test ( ):

#*****************************************************************************80
#
## DIAGONAL_CONDITION_TEST tests DIAGONAL_CONDITION.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    18 January 2015
#
#  Author:
#
#    John Burkardt
#
  from diagonal import diagonal
  from r8vec_uniform_ab import r8vec_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'DIAGONAL_CONDITION_TEST'
  print '  DIAGONAL_CONDITION computes the DIAGONAL condition.'

  m = 5
  n = m
  x_lo = -5.0
  x_hi = +10.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, x_lo, x_hi, seed )

  a = diagonal ( m, n, x )

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

  value = diagonal_condition ( n, x )

  print '  Value =  %g' % ( value )

  print ''
  print 'DIAGONAL_CONDITION_TEST'
  print '  Normal end of execution.'

  return
コード例 #49
0
def diagonal_determinant_test ( ):

#*****************************************************************************80
#
## DIAGONAL_DETERMINANT_TEST tests DIAGONAL_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    17 January 2015
#
#  Author:
#
#    John Burkardt
#
  from diagonal import diagonal
  from r8vec_uniform_ab import r8vec_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'DIAGONAL_DETERMINANT_TEST'
  print '  DIAGONAL_DETERMINANT computes the DIAGONAL determinant.'

  m = 5
  n = m
  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, r8_lo, r8_hi, seed )

  a = diagonal ( m, n, x )

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

  value = diagonal_determinant ( n, x )

  print '  Value =  %g' % ( value )

  print ''
  print 'DIAGONAL_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
コード例 #50
0
def r8vec_norm_li_test():

    # *****************************************************************************80
    #
    ## R8VEC_NORM_LI_TEST tests R8VEC_NORM_LI.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    19 February 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8vec_nint import r8vec_nint
    from r8vec_print import r8vec_print
    from r8vec_uniform_ab import r8vec_uniform_ab

    print ""
    print "R8VEC_NORM_LI_TEST"
    print "  R8VEC_NORM_LI computes the Loo norm of an R8VEC."

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

    a, seed = r8vec_uniform_ab(n, r8_lo, r8_hi, seed)

    r8vec_print(n, a, "  Input vector:")

    value = r8vec_norm_li(n, a)
    print ""
    print "  Loo norm = %g" % (value)
    #
    #  Terminate.
    #
    print ""
    print "R8VEC_NORM_LI_TEST:"
    print "  Normal end of execution."

    return
コード例 #51
0
def householder_determinant_test ( ):

#*****************************************************************************80
#
## HOUSEHOLDER_DETERMINANT_TEST tests HOUSEHOLDER_DETERMINANT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    13 February 2015
#
#  Author:
#
#    John Burkardt
#
  from householder import householder
  from r8vec_uniform_ab import r8vec_uniform_ab
  from r8mat_print import r8mat_print

  print ''
  print 'HOUSEHOLDER_DETERMINANT_TEST'
  print '  HOUSEHOLDER_DETERMINANT computes the HOUSEHOLDER determinant.'

  n = 5
  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, r8_lo, r8_hi, seed )

  a = householder ( n, x )
  m = n
  r8mat_print ( m, n, a, '  HOUSEHOLDER matrix:' )

  value = householder_determinant ( n, x )

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

  print ''
  print 'HOUSEHOLDER_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return
コード例 #52
0
def r8vec_product_test ( ):

#*****************************************************************************80
#
## R8VEC_PRODUCT_TEST tests R8VEC_PRODUCT.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    20 March 2015
#
#  Author:
#
#    John Burkardt
#
  from r8vec_print import r8vec_print
  from r8vec_uniform_ab import r8vec_uniform_ab

  print ''
  print 'R8VEC_PRODUCT_TEST'
  print '  R8VEC_PRODUCT computes the product of the entries in an R8VEC.'

  n = 10
  a_lo = - 10.0
  a_hi = + 10.0
  seed = 123456789

  a, seed = r8vec_uniform_ab ( n, a_lo, a_hi, seed )

  r8vec_print ( n, a, '  Input vector:' )

  value = r8vec_product ( n, a )
  print ''
  print '  Product of entries = %g' % ( value )
#
#  Terminate.
#
  print ''
  print 'R8VEC_PRODUCT_TEST:'
  print '  Normal end of execution.'

  return
コード例 #53
0
ファイル: r8vec_asum.py プロジェクト: wangwt9907/jburkardt-py
def r8vec_asum_test():

    #*****************************************************************************80
    #
    ## R8VEC_ASUM_TEST tests R8VEC_ASUM.
    #
    #  Licensing:
    #
    #    This code is distributed under the GNU LGPL license.
    #
    #  Modified:
    #
    #    24 January 2015
    #
    #  Author:
    #
    #    John Burkardt
    #
    from r8vec_print import r8vec_print
    from r8vec_uniform_ab import r8vec_uniform_ab

    print ''
    print 'R8VEC_ASUM_TEST'
    print '  R8VEC_ASUM sums the absolute values of the entries in an R8VEC.'

    n = 10
    a_lo = -10.0
    a_hi = +10.0
    seed = 123456789

    a, seed = r8vec_uniform_ab(n, a_lo, a_hi, seed)

    r8vec_print(n, a, '  Input vector:')

    value = r8vec_asum(n, a)
    print ''
    print '  Sum of absolute values of entries = %g' % (value)
    #
    #  Terminate.
    #
    print ''
    print 'R8VEC_ASUM_TEST:'
    print '  Normal end of execution.'

    return
コード例 #54
0
def r8vec_asum_test ( ):

#*****************************************************************************80
#
## R8VEC_ASUM_TEST tests R8VEC_ASUM.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    24 January 2015
#
#  Author:
#
#    John Burkardt
#
  from r8vec_print import r8vec_print
  from r8vec_uniform_ab import r8vec_uniform_ab

  print ''
  print 'R8VEC_ASUM_TEST'
  print '  R8VEC_ASUM sums the absolute values of the entries in an R8VEC.'

  n = 10
  a_lo = - 10.0
  a_hi = + 10.0
  seed = 123456789

  a, seed = r8vec_uniform_ab ( n, a_lo, a_hi, seed )

  r8vec_print ( n, a, '  Input vector:' )

  value = r8vec_asum ( n, a )
  print ''
  print '  Sum of absolute values of entries = %g' % ( value )
#
#  Terminate.
#
  print ''
  print 'R8VEC_ASUM_TEST:'
  print '  Normal end of execution.'

  return
コード例 #55
0
def r8vec_amin_test ( ):

#*****************************************************************************80
#
## R8VEC_AMIN_TEST tests R8VEC_AMIN.
#
#  Licensing:
#
#    This code is distributed under the GNU LGPL license.
#
#  Modified:
#
#    16 January 2015
#
#  Author:
#
#    John Burkardt
#
  from r8vec_print import r8vec_print
  from r8vec_uniform_ab import r8vec_uniform_ab

  print ''
  print 'R8VEC_AMIN_TEST'
  print '  R8VEC_AMIN computes the minimum absolute entry in an R8VEC.'

  n = 10
  a_lo = - 10.0
  a_hi = + 10.0
  seed = 123456789

  a, seed = r8vec_uniform_ab ( n, a_lo, a_hi, seed )

  r8vec_print ( n, a, '  Input vector:' )

  value = r8vec_amin ( n, a )
  print ''
  print '  Min Abs = %g' % ( value )
#
#  Terminate.
#
  print ''
  print 'R8VEC_AMIN_TEST:'
  print '  Normal end of execution.'

  return
コード例 #56
0
def companion_determinant_test ( ):

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

  print ''
  print 'COMPANION_DETERMINANT_TEST'
  print '  COMPANION_DETERMINANT computes the COMPANION determinant.'

  n = 5
  r8_lo = -5.0
  r8_hi = +5.0
  seed = 123456789
  x, seed = r8vec_uniform_ab ( n, r8_lo, r8_hi, seed )

  a = companion ( n, x )
  m = n
  r8mat_print ( m, n, a, '  COMPANION matrix:' )

  value = companion_determinant ( n, x )

  print '  Value =  %g' % ( value )

  print ''
  print 'COMPANION_DETERMINANT_TEST'
  print '  Normal end of execution.'

  return