#! /usr/bin/env python # def v_polynomial_ab_value ( a, b, n, xab ): #*****************************************************************************80 # ## V_POLYNOMIAL_AB: Chebyshev polynomial 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 N, the degree of the polynomial. # # Input, real XAB, the evaluation points. # A <= XAB <= B. # # Output, real V, the value. # from v_polynomial_value import v_polynomial_value x = ( 2.0 * xab - a - b ) / ( b - a ) v = v_polynomial_value ( n, x ); return v def v_polynomial_ab_value_test ( ): #*****************************************************************************80 # ## V_POLYNOMIAL_AB_VALUE_TEST tests V_POLYNOMIAL_AB_VALUE. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 20 July 2015 # # Author: # # John Burkardt # import numpy as np import platform from v_polynomial_01_values import v_polynomial_01_values print ( '' ) print ( 'V_POLYNOMIAL_AB_VALUE_TEST:' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' V_POLYNOMIAL_AB_VALUE evaluates a Chebyshev polynomial 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 ( '' ) print ( ' Tabulated Computed' ) print ( ' N X V01(n,x) V01(n,x)' ) print ( '' ) a = 0.0 b = 1.0 n_data = 0 while ( True ): n_data, n, x01, fx = v_polynomial_01_values ( n_data ) if ( n_data == 0 ): break fx2 = v_polynomial_ab_value ( a, b, n, x01 ) print ( ' %8d %8.4f %14.6g %14.6g' % ( n, x01, fx, fx2 ) ) # # Terminate. # print ( '' ) print ( 'V_POLYNOMIAL_AB_VALUE_TEST:' ) print ( ' Normal end of execution.' ) return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) v_polynomial_ab_value_test ( ) timestamp ( )