#! /usr/bin/env python # def r8vec2_print ( n, a1, a2, title ): #*****************************************************************************80 # ## R8VEC2_PRINT prints an R8VEC2. # # Discussion: # # An R8VEC2 is a dataset consisting of N pairs of real values, stored # as two separate vectors A1 and A2. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 27 June 2015 # # Author: # # John Burkardt # # Parameters: # # Input, integer N, the number of components of the vector. # # Input, real A1(N), A2(N), the vectors to be printed. # # Input, string TITLE, a title. # print ( '' ) print ( title ) print ( '' ) for i in range ( 0, n ): print ( ' %6d: %12g %12g' % ( i, a1[i], a2[i] ) ) return def r8vec2_print_test ( ): #*****************************************************************************80 # ## R8VEC2_PRINT_TEST tests R8VEC2_PRINT. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 27 June 2015 # # Author: # # John Burkardt # import numpy as np import platform print ( '' ) print ( 'R8VEC2_PRINT_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' R8VEC2_PRINT prints a pair of R8VEC\'s.' ) n = 6 v = np.array ( [ 0.0, 0.20, 0.40, 0.60, 0.80, 1.0 ], dtype = np.float64 ) w = np.array ( [ 0.0, 0.04, 0.16, 0.36, 0.64, 1.0 ], dtype = np.float64 ) r8vec2_print ( n, v, w, ' Print a pair of R8VEC\'s:' ) # # Terminate. # print ( '' ) print ( 'R8VEC2_PRINT_TEST:' ) print ( ' Normal end of execution.' ) return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) r8vec2_print_test ( ) timestamp ( )