#! /usr/bin/env python # def v_polynomial_ab ( a, b, m, n, xab ): #*****************************************************************************80 # ## V_POLYNOMIAL_AB: Chebyshev polynomials VAB(N,X) in [A,B]. # # Discussion: # # VAB(n,x) = V(n,(2*x-a-b)/(b-a)) # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 20 July 2015 # # Author: # # John Burkardt # # Parameters: # # Input, real A, B, the domain of definition. # # Input, integer M, the number of evaluation points. # # Input, integer N, the highest polynomial to compute. # # Input, real XAB(M,1), the evaluation points. # It must be the case that A <= XAB(*) <= B. # # Output, real V(M,N+1), the values of the Chebyshev polynomials. # from v_polynomial import v_polynomial x = ( 2.0 * xab - a - b ) / ( b - a ) v = v_polynomial ( m, n, x ); return v def v_polynomial_ab_test ( ): #*****************************************************************************80 # ## V_POLYNOMIAL_AB_TEST tests V_POLYNOMIAL_AB. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 20 July 2015 # # Author: # # John Burkardt # import numpy as np import platform from r8mat_print import r8mat_print print ( '' ) print ( 'V_POLYNOMIAL_AB_TEST:' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' V_POLYNOMIAL_AB evaluates Chebyshev polynomials VAB(n,x)' ) print ( ' shifted from [-1,+1] to the domain [A,B].' ) print ( '' ) print ( ' Here, we will use the new domain [0,1]' ) print ( ' and the desired maximum polynomial degree will be N = 5.' ) a = 0.0 b = 1.0 m = 11 n = 5 x = np.linspace ( a, b, m ) v = v_polynomial_ab ( a, b, m, n, x ) r8mat_print ( m, n + 1, v, ' Tables of V values:' ) # # Terminate. # print ( '' ) print ( 'V_POLYNOMIAL_AB_TEST:' ) print ( ' Normal end of execution.' ) return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) v_polynomial_ab_test ( ) timestamp ( )