#! /usr/bin/env python # def clenshaw_curtis_set ( n ): #*****************************************************************************80 # ## CLENSHAW_CURTIS_SET sets a Clenshaw-Curtis quadrature rule. # # Discussion: # # The integral: # # Integral ( -1 <= X <= 1 ) F(X) dX # # The quadrature rule: # # Sum ( 1 <= I <= N ) W(I) * F ( X(I) ) # # The abscissas for the rule of order N can be regarded # as the cosines of equally spaced angles between 180 and 0 degrees: # # X(I) = cos ( ( I - 1 ) * PI / ( N - 1 ) ) # # except for the basic case N = 1, when # # X(1) = 0. # # A Clenshaw-Curtis rule that uses N points will integrate # exactly all polynomials of degrees 0 through N-1. If N # is odd, then by symmetry the polynomial of degree N will # also be integrated exactly. # # If the value of N is increased in a sensible way, then # the new set of abscissas will include the old ones. One such # sequence would be N(K) = 2*K+1 for K = 0, 1, 2, ... # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 12 June 2015 # # Author: # # John Burkardt # # Reference: # # Charles Clenshaw, Alan Curtis, # A Method for Numerical Integration on an Automatic Computer, # Numerische Mathematik, # Volume 2, Number 1, December 1960, pages 197-205. # # Parameters: # # Input, integer N, the order. # N must be between 1 and 17, 33, 65 or 129. # # Output, real X(N), the abscissas. # # Output, real W(N), the weights. # import numpy as np from sys import exit if ( n == 1 ): x = np.array ( [ \ 0.00000000000000000000 \ ] ) w = np.array ( [ \ 2.00000000000000000000 \ ] ) elif ( n == 2 ): x = np.array ( [ \ -1.00000000000000000000, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 1.00000000000000000000, \ 1.00000000000000000000 \ ] ) elif ( n == 3 ): x = np.array ( [ \ -1.00000000000000000000, \ 0.00000000000000000000, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.33333333333333333333, \ 1.33333333333333333333, \ 0.33333333333333333333 \ ] ) elif ( n == 4 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.50000000000000000000, \ 0.50000000000000000000, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.11111111111111111111, \ 0.88888888888888888889, \ 0.88888888888888888889, \ 0.11111111111111111111 \ ] ) elif ( n == 5 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.70710678118654752440, \ 0.00000000000000000000, \ 0.70710678118654752440, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.06666666666666666667, \ 0.53333333333333333333, \ 0.80000000000000000000, \ 0.53333333333333333333, \ 0.06666666666666666667 \ ] ) elif ( n == 6 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.80901699437494742410, \ -0.30901699437494742410, \ 0.30901699437494742410, \ 0.80901699437493732410, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.04000000000000000000, \ 0.36074304120001121619, \ 0.59925695879998878381, \ 0.59925695879998878381, \ 0.36074304120001121619, \ 0.04000000000000000000 \ ] ) elif ( n == 7 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.86602540378443864676, \ -0.50000000000000000000, \ 0.00000000000000000000, \ 0.50000000000000000000, \ 0.86602540378443864676, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.02857142857142857143, \ 0.25396825396825396825, \ 0.45714285714285714286, \ 0.52063492063492063492, \ 0.45714285714285714286, \ 0.25396825396825396825, \ 0.02857142857142857143 \ ] ) elif ( n == 8 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.90096886790241912624, \ -0.62348980185873353053, \ -0.22252093395631440429, \ 0.22252093395631440429, \ 0.62348980185873353053, \ 0.90096886790241910624, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.02040816326530612245, \ 0.19014100721820835178, \ 0.35224242371815911533, \ 0.43720840579832641044, \ 0.43720840579832641044, \ 0.35224242371815911533, \ 0.19014100721820835178, \ 0.02040816326530612245 \ ] ) elif ( n == 9 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.92387953251128675613, \ -0.70710678118654752440, \ -0.38268343236508977173, \ 0.00000000000000000000, \ 0.38268343236508977173, \ 0.70710678118654752440, \ 0.92387953251128675613, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.01587301587301587302, \ 0.14621864921601815501, \ 0.27936507936507936508, \ 0.36171785872048978150, \ 0.39365079365079365079, \ 0.36171785872048978150, \ 0.27936507936507936508, \ 0.14621864921601815501, \ 0.01587301587301587302 \ ] ) elif ( n == 10 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.93969262078590838405, \ -0.76604444311897903520, \ -0.50000000000000000000, \ -0.17364817766693034885, \ 0.17364817766693034885, \ 0.50000000000000000000, \ 0.76604444311897903520, \ 0.93969262078590838405, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.01234567901234567901, \ 0.11656745657203712296, \ 0.22528432333810440813, \ 0.30194003527336860670, \ 0.34386250580414418320, \ 0.34386250580414418320, \ 0.30194003527336860670, \ 0.22528432333810440813, \ 0.11656745657203712296, \ 0.01234567901234567901 \ ] ) elif ( n == 11 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.95105651629515357212, \ -0.80901699437494742410, \ -0.58778525229247312917, \ -0.30901699437494742410, \ 0.00000000000000000000, \ 0.30901699437494742410, \ 0.58778525229247312917, \ 0.80901699437494742410, \ 0.95105651629515357212, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.01010101010101010101, \ 0.09457905488370156116, \ 0.18563521442424776529, \ 0.25358833328368660623, \ 0.29921327042423708320, \ 0.31376623376623376623, \ 0.29921327042423708320, \ 0.25358833328368660623, \ 0.18563521442424776529, \ 0.09457905488370156116, \ 0.01010101010101010101 \ ] ) elif ( n == 12 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.95949297361449738989, \ -0.84125353283118116886, \ -0.65486073394528506406, \ -0.41541501300188642553, \ -0.14231483827328514044, \ 0.14231483827328514044, \ 0.41541501300188642553, \ 0.65486073394528506406, \ 0.84125353283118116886, \ 0.95949297361449738989, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.00826446280991735537, \ 0.07856015374620000543, \ 0.15504045508256136552, \ 0.21556254600086858099, \ 0.25991734106691617602, \ 0.28265504129353651666, \ 0.28265504129353651666, \ 0.25991734106691617602, \ 0.21556254600086858099, \ 0.15504045508256136552, \ 0.07856015374620000543, \ 0.00826446280991735537 \ ] ) elif ( n == 13 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.96592582628906828675, \ -0.86602540378443864676, \ -0.70710678118654752440, \ -0.50000000000000000000, \ -0.25881904510252076235, \ 0.00000000000000000000, \ 0.25881904510252076235, \ 0.50000000000000000000, \ 0.70710678118654752440, \ 0.86602540378443864676, \ 0.96592582628906828675, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.00699300699300699301, \ 0.06605742495207439452, \ 0.13154253154253154253, \ 0.18476338476338476338, \ 0.22697302697302697303, \ 0.25267569378104433860, \ 0.26198986198986198986, \ 0.25267569378104433860, \ 0.22697302697302697303, \ 0.18476338476338476338, \ 0.13154253154253154253, \ 0.06605742495207439452, \ 0.00699300699300699301 \ ] ) elif ( n == 14 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.97094181742605202716, \ -0.88545602565320989590, \ -0.74851074817110109863, \ -0.56806474673115580251, \ -0.35460488704253562597, \ -0.12053668025532305335, \ 0.12053668025532305335, \ 0.35460488704253562597, \ 0.56806474673115580251, \ 0.74851074817110109863, \ 0.88545602565320989590, \ 0.97094181742605202716, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.00591715976331360947, \ 0.05646531376341444627, \ 0.11276867248985655881, \ 0.16003802611671868523, \ 0.19899241036578321848, \ 0.22590304977856444935, \ 0.23991536772234903239, \ 0.23991536772234903239, \ 0.22590304977856444935, \ 0.19899241036578321848, \ 0.16003802611671868523, \ 0.11276867248985655881, \ 0.05646531376341444627, \ 0.00591715976331360947 \ ] ) elif ( n == 15 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.97492791218182360702, \ -0.90096886790241912624, \ -0.78183148246802980871, \ -0.62348980185873353053, \ -0.43388373911755812048, \ -0.22252093395631440429, \ 0.00000000000000000000, \ 0.22252093395631440429, \ 0.43388373911755812048, \ 0.62348980185873353053, \ 0.78183148246802980871, \ 0.90096886790241912624, \ 0.97492791218182360702, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.00512820512820512821, \ 0.04869938729508823855, \ 0.09782039167605215913, \ 0.13966507849560431803, \ 0.17560578900106674677, \ 0.20205146748238357364, \ 0.21888151163057340180, \ 0.22429633858205286777, \ 0.21888151163057340180, \ 0.20205146748238357364, \ 0.17560578900106674677, \ 0.13966507849560431803, \ 0.09782039167605215913, \ 0.04869938729508823855, \ 0.00512820512820512821 \ ] ) elif ( n == 16 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.97814760073380563793, \ -0.91354545764260089550, \ -0.80901699437494742410, \ -0.66913060635885821383, \ -0.50000000000000000000, \ -0.30901699437494742410, \ -0.10452846326765347140, \ 0.10452846326765347140, \ 0.30901699437494742410, \ 0.50000000000000000000, \ 0.66913060635885821383, \ 0.80901699437494742410, \ 0.91354545764260089550, \ 0.97814760073380563793, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.00444444444444444444, \ 0.04251476624752508988, \ 0.08553884025933288291, \ 0.12294010082849361533, \ 0.15573317603967369176, \ 0.18132978132978132978, \ 0.19921478132638853955, \ 0.20828410952436040635, \ 0.20828410952436040635, \ 0.19921478132638853955, \ 0.18132978132978132978, \ 0.15573317603967369176, \ 0.12294010082849361533, \ 0.08553884025933288291, \ 0.04251476624752508988, \ 0.00444444444444444444 \ ] ) elif ( n == 17 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.98078528040323044913, \ -0.92387953251128675613, \ -0.83146961230254523708, \ -0.70710678118654752440, \ -0.55557023301960222474, \ -0.38268343236508977173, \ -0.19509032201612826785, \ 0.00000000000000000000, \ 0.19509032201612826785, \ 0.38268343236508977173, \ 0.55557023301960222474, \ 0.70710678118654752440, \ 0.83146961230254523708, \ 0.92387953251128675613, \ 0.98078528040323044913, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.00392156862745098039, \ 0.03736870283720561032, \ 0.07548233154315183441, \ 0.10890555258189093044, \ 0.13895646836823307412, \ 0.16317266428170330256, \ 0.18147378423649335700, \ 0.19251386461292564687, \ 0.19641012582189052777, \ 0.19251386461292564687, \ 0.18147378423649335700, \ 0.16317266428170330256, \ 0.13895646836823307412, \ 0.10890555258189093044, \ 0.07548233154315183441, \ 0.03736870283720561032, \ 0.00392156862745098039 \ ] ) elif ( n == 33 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.99518472667219688624, \ -0.98078528040323044913, \ -0.95694033573220886494, \ -0.92387953251128675613, \ -0.88192126434835502971, \ -0.83146961230254523708, \ -0.77301045336273696081, \ -0.70710678118654752440, \ -0.63439328416364549822, \ -0.55557023301960222474, \ -0.47139673682599764856, \ -0.38268343236508977173, \ -0.29028467725446236764, \ -0.19509032201612826785, \ -0.098017140329560601994, \ 0.000000000000000000000, \ 0.098017140329560601994, \ 0.19509032201612826785, \ 0.29028467725446236764, \ 0.38268343236508977173, \ 0.47139673682599764856, \ 0.55557023301960222474, \ 0.63439328416364549822, \ 0.70710678118654752440, \ 0.77301045336273696081, \ 0.83146961230254523708, \ 0.88192126434835502971, \ 0.92387953251128675613, \ 0.95694033573220886494, \ 0.98078528040323044913, \ 0.99518472667219688624, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.00097751710654936461, \ 0.00939319796295501470, \ 0.01923424513268114918, \ 0.02845791667723369009, \ 0.03759434191404720602, \ 0.04626276283775174949, \ 0.05455501630398031044, \ 0.06227210954529400455, \ 0.06942757563043545090, \ 0.07588380044138847048, \ 0.08163481765493851023, \ 0.08657753844182743544, \ 0.09070611286772099874, \ 0.09394324443876873573, \ 0.09629232594548817919, \ 0.09769818820805558182, \ 0.09817857778176829677, \ 0.09769818820805558182, \ 0.09629232594548817919, \ 0.09394324443876873573, \ 0.09070611286772099874, \ 0.08657753844182743544, \ 0.08163481765493851023, \ 0.07588380044138847048, \ 0.06942757563043545090, \ 0.06227210954529400455, \ 0.05455501630398031044, \ 0.04626276283775174949, \ 0.03759434191404720602, \ 0.02845791667723369009, \ 0.01923424513268114918, \ 0.00939319796295501470, \ 0.00097751710654936461 \ ] ) elif ( n == 65 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.99879545620517239271, \ -0.99518472667219688624, \ -0.98917650996478097345, \ -0.98078528040323044913, \ -0.97003125319454399260, \ -0.95694033573220886494, \ -0.94154406518302077841, \ -0.92387953251128675613, \ -0.90398929312344333159, \ -0.88192126434835502971, \ -0.85772861000027206990, \ -0.83146961230254523708, \ -0.80320753148064490981, \ -0.77301045336273696081, \ -0.74095112535495909118, \ -0.70710678118654752440, \ -0.67155895484701840063, \ -0.63439328416364549822, \ -0.59569930449243334347, \ -0.55557023301960222474, \ -0.51410274419322172659, \ -0.47139673682599764856, \ -0.42755509343028209432, \ -0.38268343236508977173, \ -0.33688985339222005069, \ -0.29028467725446236764, \ -0.24298017990326388995, \ -0.19509032201612826785, \ -0.14673047445536175166, \ -0.098017140329560601994, \ -0.049067674327418014255, \ 0.000000000000000000000, \ 0.049067674327418014255, \ 0.098017140329560601994, \ 0.14673047445536175166, \ 0.19509032201612826785, \ 0.24298017990326388995, \ 0.29028467725446236764, \ 0.33688985339222005069, \ 0.38268343236508977173, \ 0.42755509343028209432, \ 0.47139673682599764856, \ 0.51410274419322172659, \ 0.55557023301960222474, \ 0.59569930449243334347, \ 0.63439328416364549822, \ 0.67155895484701840063, \ 0.70710678118654752440, \ 0.74095112535495909118, \ 0.77301045336273696081, \ 0.80320753148064490981, \ 0.83146961230254523708, \ 0.85772861000027206990, \ 0.88192126434835502971, \ 0.90398929312344333159, \ 0.92387953251128675613, \ 0.94154406518302077841, \ 0.95694033573220886494, \ 0.97003125319454399260, \ 0.98078528040323044913, \ 0.98917650996478097345, \ 0.99518472667219688624, \ 0.99879545620517239271, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.00024420024420024420, \ 0.00235149067531170332, \ 0.00483146544879091264, \ 0.00719269316173611402, \ 0.00958233879528379039, \ 0.01192339471421277160, \ 0.01425206043235199679, \ 0.01653498765728958965, \ 0.01878652974179578354, \ 0.02098627442973743378, \ 0.02314069493435819848, \ 0.02523506498175476590, \ 0.02727225714146838686, \ 0.02924065319746833770, \ 0.03114129710406762447, \ 0.03296454656997632997, \ 0.03471049818092511427, \ 0.03637092028663918309, \ 0.03794545992128481711, \ 0.03942698871295609976, \ 0.04081501340035783384, \ 0.04210333111141810203, \ 0.04329151496169082935, \ 0.04437417923925731580, \ 0.04535110955166067221, \ 0.04621766751092557684, \ 0.04697395904661414870, \ 0.04761604458525019296, \ 0.04814443257251220341, \ 0.04855584485714105274, \ 0.04885125664306609371, \ 0.04902801843102555294, \ 0.04908762351494245585, \ 0.04902801843102555294, \ 0.04885125664306609371, \ 0.04855584485714105274, \ 0.04814443257251220341, \ 0.04761604458525019296, \ 0.04697395904661414870, \ 0.04621766751092557684, \ 0.04535110955166067221, \ 0.04437417923925731580, \ 0.04329151496169082935, \ 0.04210333111141810203, \ 0.04081501340035783384, \ 0.03942698871295609976, \ 0.03794545992128481711, \ 0.03637092028663918309, \ 0.03471049818092511427, \ 0.03296454656997632997, \ 0.03114129710406762447, \ 0.02924065319746833770, \ 0.02727225714146838686, \ 0.02523506498175476590, \ 0.02314069493435819848, \ 0.02098627442973743378, \ 0.01878652974179578354, \ 0.01653498765728958965, \ 0.01425206043235199679, \ 0.01192339471421277160, \ 0.00958233879528379039, \ 0.00719269316173611402, \ 0.00483146544879091264, \ 0.00235149067531170332, \ 0.00024420024420024420 \ ] ) elif ( n == 129 ): x = np.array ( [ \ -1.00000000000000000000, \ -0.99969881869620422012, \ -0.99879545620517239271, \ -0.99729045667869021614, \ -0.99518472667219688624, \ -0.99247953459870999816, \ -0.98917650996478097345, \ -0.98527764238894124477, \ -0.98078528040323044913, \ -0.97570213003852854446, \ -0.97003125319454399260, \ -0.96377606579543986669, \ -0.95694033573220886494, \ -0.94952818059303666720, \ -0.94154406518302077841, \ -0.93299279883473888771, \ -0.92387953251128675613, \ -0.91420975570353065464, \ -0.90398929312344333159, \ -0.89322430119551532034, \ -0.88192126434835502971, \ -0.87008699110871141865, \ -0.85772861000027206990, \ -0.84485356524970707326, \ -0.83146961230254523708, \ -0.81758481315158369650, \ -0.80320753148064490981, \ -0.78834642762660626201, \ -0.77301045336273696081, \ -0.75720884650648454758, \ -0.74095112535495909118, \ -0.72424708295146692094, \ -0.70710678118654752440, \ -0.68954054473706692462, \ -0.67155895484701840063, \ -0.65317284295377676408, \ -0.63439328416364549822, \ -0.61523159058062684548, \ -0.59569930449243334347, \ -0.57580819141784530075, \ -0.55557023301960222474, \ -0.53499761988709721066, \ -0.51410274419322172659, \ -0.49289819222978403687, \ -0.47139673682599764856, \ -0.44961132965460660005, \ -0.42755509343028209432, \ -0.40524131400498987091, \ -0.38268343236508977173, \ -0.35989503653498814878, \ -0.33688985339222005069, \ -0.31368174039889147666, \ -0.29028467725446236764, \ -0.26671275747489838633, \ -0.24298017990326388995, \ -0.21910124015686979723, \ -0.19509032201612826785, \ -0.17096188876030122636, \ -0.14673047445536175166, \ -0.12241067519921619850, \ -0.098017140329560601994, \ -0.073564563599667423529, \ -0.049067674327418014255, \ -0.024541228522912288032, \ 0.00000000000000000000, \ 0.024541228522912288032, \ 0.049067674327418014255, \ 0.073564563599667423529, \ 0.098017140329560601994, \ 0.12241067519921619850, \ 0.14673047445536175166, \ 0.17096188876030122636, \ 0.19509032201612826785, \ 0.21910124015686979723, \ 0.24298017990326388995, \ 0.26671275747489838633, \ 0.29028467725446236764, \ 0.31368174039889147666, \ 0.33688985339222005069, \ 0.35989503653498814878, \ 0.38268343236508977173, \ 0.40524131400498987091, \ 0.42755509343028209432, \ 0.44961132965460660005, \ 0.47139673682599764856, \ 0.49289819222978403687, \ 0.51410274419322172659, \ 0.53499761988709721066, \ 0.55557023301960222474, \ 0.57580819141784530075, \ 0.59569930449243334347, \ 0.61523159058062684548, \ 0.63439328416364549822, \ 0.65317284295377676408, \ 0.67155895484701840063, \ 0.68954054473706692462, \ 0.70710678118654752440, \ 0.72424708295146692094, \ 0.74095112535495909118, \ 0.75720884650648454758, \ 0.77301045336273696081, \ 0.78834642762660626201, \ 0.80320753148064490981, \ 0.81758481315158369650, \ 0.83146961230254523708, \ 0.84485356524970707326, \ 0.85772861000027206990, \ 0.87008699110871141865, \ 0.88192126434835502971, \ 0.89322430119551532034, \ 0.90398929312344333159, \ 0.91420975570353065464, \ 0.92387953251128675613, \ 0.93299279883473888771, \ 0.94154406518302077841, \ 0.94952818059303666720, \ 0.95694033573220886494, \ 0.96377606579543986669, \ 0.97003125319454399260, \ 0.97570213003852854446, \ 0.98078528040323044913, \ 0.98527764238894124477, \ 0.98917650996478097345, \ 0.99247953459870999816, \ 0.99518472667219688624, \ 0.99729045667869021614, \ 0.99879545620517239271, \ 0.99969881869620422012, \ 1.00000000000000000000 \ ] ) w = np.array ( [ \ 0.00006103888176768602, \ 0.00058807215382869754, \ 0.00120930061875273991, \ 0.00180308126695362360, \ 0.00240715327877140915, \ 0.00300345869904497128, \ 0.00360197835812614147, \ 0.00419553798718534675, \ 0.00478862143341336763, \ 0.00537724746840184621, \ 0.00596388034730799521, \ 0.00654590843862298928, \ 0.00712483332325489785, \ 0.00769875778896082811, \ 0.00826865154203087108, \ 0.00883303867470133581, \ 0.00939256583934814871, \ 0.00994602784923457905, \ 0.01049386202576892125, \ 0.01103504877427254184, \ 0.01156988348290849967, \ 0.01209748052807164113, \ 0.01261803597977743271, \ 0.01313076516693974630, \ 0.01363579321293772047, \ 0.01413241437853094133, \ 0.01462070254634350205, \ 0.01510001572479266783, \ 0.01557039073899425960, \ 0.01603123858745057916, \ 0.01648256956220377909, \ 0.01692383985846499368, \ 0.01735504125411394958, \ 0.01777566938875279997, \ 0.01818570377926339481, \ 0.01858467519566908661, \ 0.01897255587067948426, \ 0.01934890842392451844, \ 0.01971370183700155725, \ 0.02006652805198357604, \ 0.02040735612003867863, \ 0.02073580533490147816, \ 0.02105184759002011131, \ 0.02135512797425970725, \ 0.02164562356712882440, \ 0.02192300400598756892, \ 0.02218725355897195088, \ 0.02243806539722630184, \ 0.02267543270456671718, \ 0.02289907134390605882, \ 0.02310898491627407168, \ 0.02330491126131143273, \ 0.02348686571193163505, \ 0.02365460746057766523, \ 0.02380816473024258975, \ 0.02394731750476901502, \ 0.02407210792327850000, \ 0.02418233623893147567, \ 0.02427805942075745923, \ 0.02435909748927643184, \ 0.02442552306156708690, \ 0.02447717542743444284, \ 0.02451414358881568292, \ 0.02453628559651495473, \ 0.02454370750551418263, \ 0.02453628559651495473, \ 0.02451414358881568292, \ 0.02447717542743444284, \ 0.02442552306156708690, \ 0.02435909748927643184, \ 0.02427805942075745923, \ 0.02418233623893147567, \ 0.02407210792327850000, \ 0.02394731750476901502, \ 0.02380816473024258975, \ 0.02365460746057766523, \ 0.02348686571193163505, \ 0.02330491126131143273, \ 0.02310898491627407168, \ 0.02289907134390605882, \ 0.02267543270456671718, \ 0.02243806539722630184, \ 0.02218725355897195088, \ 0.02192300400598756892, \ 0.02164562356712882440, \ 0.02135512797425970725, \ 0.02105184759002011131, \ 0.02073580533490147816, \ 0.02040735612003867863, \ 0.02006652805198357604, \ 0.01971370183700155725, \ 0.01934890842392451844, \ 0.01897255587067948426, \ 0.01858467519566908661, \ 0.01818570377926339481, \ 0.01777566938875279997, \ 0.01735504125411394958, \ 0.01692383985846499368, \ 0.01648256956220377909, \ 0.01603123858745057916, \ 0.01557039073899425960, \ 0.01510001572479266783, \ 0.01462070254634350205, \ 0.01413241437853094133, \ 0.01363579321293772047, \ 0.01313076516693974630, \ 0.01261803597977743271, \ 0.01209748052807164113, \ 0.01156988348290849967, \ 0.01103504877427254184, \ 0.01049386202576892125, \ 0.00994602784923457905, \ 0.00939256583934814871, \ 0.00883303867470133581, \ 0.00826865154203087108, \ 0.00769875778896082811, \ 0.00712483332325489785, \ 0.00654590843862298928, \ 0.00596388034730799521, \ 0.00537724746840184621, \ 0.00478862143341336763, \ 0.00419553798718534675, \ 0.00360197835812614147, \ 0.00300345869904497128, \ 0.00240715327877140915, \ 0.00180308126695362360, \ 0.00120930061875273991, \ 0.00058807215382869754, \ 0.00006103888176768602 \ ] ) else: print ( '' ) print ( 'CLENSHAW_CURTIS_SET - Fatal error!' ) print ( ' Illegal value of N = %d' % ( n ) ) print ( ' Legal values are 1 to 17, 33, 65 or 129.' ) exit ( 'CLENSHAW_CURTIS_SET - Fatal error!' ) return x, w def clenshaw_curtis_set_test ( ): #*****************************************************************************80 # ## CLENSHAW_CURTIS_SET_TEST tests CLENSHAW_CURTIS_SET. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 03 April 2015 # # Author: # # John Burkardt # import platform print ( '' ) print ( 'CLENSHAW_CURTIS_SET_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' CLENSHAW_CURTIS_SET sets up a Clenshaw Curtis' ) print ( ' quadrature rule over [-1,1].' ) print ( '' ) print ( ' Index X W' ) for n in range ( 1, 11 ): x, w = clenshaw_curtis_set ( n ) print ( '' ) for i in range ( 0, n ): print ( ' %2d %24.16g %24.16g' % ( i, x[i], w[i] ) ) # # Terminate. # print ( '' ) print ( 'CLENSHAW_CURTIS_SET_TEST:' ) print ( ' Normal end of execution.' ) return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) clenshaw_curtis_set_test ( ) timestamp ( )