本文整理汇总了Python中r8vec_uniform_ab.r8vec_uniform_ab函数的典型用法代码示例。如果您正苦于以下问题:Python r8vec_uniform_ab函数的具体用法?Python r8vec_uniform_ab怎么用?Python r8vec_uniform_ab使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了r8vec_uniform_ab函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: uvwp_ethier_test
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: resid_ethier_test
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: rhs_taylor_test
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
示例4: uvp_spiral_test
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
示例5: uvp_taylor_test
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
示例6: resid_spiral_test
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: rhs_lucas_test
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
示例8: ortega_determinant_test
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
示例9: uv_spiral_test
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
示例10: rhs_stokes2_test
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
示例11: uvp_stokes1_test
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
示例12: triv_determinant_test
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
示例13: resid_stokes3_test
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
示例14: schur_block_test
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
示例15: clement2_determinant_test
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