#! /usr/bin/env python3 # def wathen_order ( nx, ny ): #*****************************************************************************80 # ## WATHEN_ORDER returns the order of the WATHEN matrix. # # Discussion: # # N = 3 * 3 * 2 + 2 * 2 + 2 * 3 + 1 = 29 # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 31 August 2014 # # Author: # # John Burkardt # # Reference: # # Nicholas Higham, # Algorithm 694: A Collection of Test Matrices in MATLAB, # ACM Transactions on Mathematical Software, # Volume 17, Number 3, September 1991, pages 289-305. # # Andrew Wathen, # Realistic eigenvalue bounds for the Galerkin mass matrix, # IMA Journal of Numerical Analysis, # Volume 7, 1987, pages 449-457. # # Parameters: # # Input, integer NX, NY, values which determine the size of A. # # Output, integer N, the order of the matrix, # as determined by NX and NY. # n = 3 * nx * ny + 2 * nx + 2 * ny + 1 return n def wathen_order_test ( ): #*****************************************************************************80 # ## WATHEN_ORDER_TEST tests WATHEN_ORDER. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 30 November 2016 # # Author: # # John Burkardt # # Reference: # # Nicholas Higham, # Algorithm 694: A Collection of Test Matrices in MATLAB, # ACM Transactions on Mathematical Software, # Volume 17, Number 3, September 1991, pages 289-305. # # Andrew Wathen, # Realistic eigenvalue bounds for the Galerkin mass matrix, # IMA Journal of Numerical Analysis, # Volume 7, 1987, pages 449-457. # import platform print ( '' ) print ( 'WATHEN_ORDER_TEST:' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' WATHEN_ORDER returns N, the order of a Wathen finite element' ) print ( ' matrix given NX and NY, the number of rows and columns of' ) print ( ' nodes in the underlying grid.' ) print ( '' ) print ( ' NX / NY: 1 2 3 4 5 6' ) print ( '' ) for ny in range ( 1, 11 ): print ( ' %2d' % ( ny ), end = '' ) for nx in range ( 1, 7 ): n = wathen_order ( nx, ny ) print ( ' %5d' % ( n ), end = '' ) print ( '' ) # # Terminate. # print ( '' ) print ( 'WATHEN_ORDER_TEST:' ) print ( ' Normal end of execution.' ) return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) wathen_order_test ( ) timestamp ( )