# include # include # include # include # include "alpert_rule.h" /******************************************************************************/ void rule_power ( int rule, int j, double x[], double w[] ) /******************************************************************************/ /* Purpose: RULE_POWER returns an Alpert rule for power singular functions. Licensing: This code is distributed under the MIT license. Modified: 04 December 2015 Author: John Burkardt Reference: Bradley Alpert, Hybrid Gauss-Trapezoidal Quadrature Rules, SIAM Journal on Scientific Computing, Volume 20, Number 5, pages 1551-1584, 1999. Parameters: Input, int RULE, the index of the rule, between 1 and 12. Input, int J, the number of points in the rule. Output, double X[J], W[J], the points and weights for the rule. */ { double x01[1] = { 1.172258571393266E-01 }; double w01[1] = { 5.000000000000000E-01 }; double x02[2] = { 9.252112715421378E-02, 1.000000000000000E-00 }; double w02[2] = { 4.198079625266162E-01, 1.080192037473384E+00 }; double x03[2] = { 6.023873796408450E-02, 8.780704050676215E-01 }; double w03[2] = { 2.858439990420468E-01, 1.214156000957953E+00 }; double x04[3] = { 7.262978413470474E-03, 2.246325512521893E-01, 1.000000000000000E+00 }; double w04[3] = { 3.907638767531813E-02, 4.873484056646474E-01, 9.735752066600344E-01 }; double x05[3] = { 1.282368909458828E-02, 2.694286346792474E-01, 1.018414523786358E+00 }; double w05[3] = { 6.363996663105925E-02, 5.077434578043636E-01, 9.286165755645772E-01 }; double x06[4] = { 1.189242434021285E-02, 2.578220434738662E-01, 1.007750064585281E+00, 2.000000000000000E+00 }; double w06[4] = { 5.927215035616424E-02, 4.955981740306228E-01, 9.427131290628058E-01, 1.002416546550407E+00 }; double x07[6] = { 3.317925942699451E-03, 8.283019705296352E-02, 4.136094925726231E-01, 1.088744373688402E+00, 2.006482101852379E+00, 3.000000000000000E+00 }; double w07[6] = { 1.681780929883469E-02, 1.755244404544475E-01, 5.039350503858001E-01, 8.266241339680867E-01, 9.773065848981277E-01, 9.997919809947032E-01 }; double x08[8] = { 1.214130606523435E-03, 3.223952700027058E-02, 1.790935383649920E-01, 5.437663805244631E-01, 1.176116628396759E+00, 2.031848210716014E+00, 3.001961225690812E+00, 4.000000000000000E+00 }; double w08[8] = { 6.199844884297793E-03, 7.106286791720044E-02, 2.408930104410471E-01, 4.975929263668960E-01, 7.592446540441226E-01, 9.322446399614420E-01, 9.928171438160095E-01, 9.999449125689846E-01 }; double x09[10] = { 1.745862989163252E-04, 8.613670540457314E-03, 6.733385088703690E-02, 2.514488774733840E-01, 6.341845573737690E-01, 1.248404055083152E+00, 2.065688031953401E+00, 3.009199358662542E+00, 4.000416269690208E+00, 5.000000000000000E+00 }; double w09[10] = { 1.016950985948944E-03, 2.294670686517670E-02, 1.076657968022888E-01, 2.734577662465576E-01, 4.978815591924992E-01, 7.256208919565360E-01, 8.952638690320078E-01, 9.778157465381624E-01, 9.983390781399277E-01, 9.999916342408948E-01 }; double x10[12] = { 5.710218427206990E-04, 1.540424351115548E-02, 8.834248407196555E-02, 2.824462054509770E-01, 6.574869892305580E-01, 1.246541060977993E+00, 2.039218495130811E+00, 2.979333487049800E+00, 3.985772595393049E+00, 4.997240804311428E+00, 5.999868793951190E+00, 7.000000000000000E+00 }; double w10[12] = { 2.921018926912141E-03, 3.431130611256885E-02, 1.224669495638615E-01, 2.761108242022520E-01, 4.797809643010337E-01, 6.966555677271379E-01, 8.790077941972658E-01, 9.868622449294327E-01, 1.015142389688201E+00, 1.006209712632210E+00, 1.000528829922287E+00, 1.000002397796838E+00 }; double x11[14] = { 3.419821460249725E-04, 9.296593430187960E-03, 5.406214771755252E-02, 1.763945096508648E-01, 4.218486605653738E-01, 8.274022895884040E-01, 1.410287585637014E+00, 2.160997505238153E+00, 3.043504749358223E+00, 4.005692579069439E+00, 4.999732707905968E+00, 5.999875191971098E+00, 6.999994560568667E+00, 8.000000000000000E+00 }; double w11[14] = { 1.750957243202047E-03, 2.080726584287380E-02, 7.586830616433430E-02, 1.766020526671851E-01, 3.206624362072232E-01, 4.934405290553812E-01, 6.707497030698472E-01, 8.244959025366557E-01, 9.314646742162802E-01, 9.845768443163154E-01, 9.992852769154770E-01, 1.000273112957723E+00, 1.000022857402321E+00, 1.000000081405180E+00 }; double x12[16] = { 2.158438988280793E-04, 5.898432743709196E-03, 3.462795956896131E-02, 1.145586495070213E-01, 2.790344218856415E-01, 5.600113798653321E-01, 9.814091242883119E-01, 1.553594853974655E+00, 2.270179114036658E+00, 3.108234601715371E+00, 4.032930893996553E+00, 5.006803270228157E+00, 6.000815466735179E+00, 7.000045035079542E+00, 8.000000738923901E+00, 9.000000000000000E+00 }; double w12[16] = { 1.105804873501181E-03, 1.324499944707956E-02, 4.899842307592144E-02, 1.165326192868815E-01, 2.178586693194957E-01, 3.481766016945031E-01, 4.964027915911545E-01, 6.469026189623831E-01, 7.823688971783889E-01, 8.877772445893361E-01, 9.551665077035583E-01, 9.876285579741800E-01, 9.979929183863017E-01, 9.998470620634641E-01, 9.999962891645340E-01, 9.999999946893169E-01 }; if ( rule < 1 || 12 < rule ) { fprintf ( stderr, "\n" ); fprintf ( stderr, "RULE_POWER - Fatal error!\n" ); fprintf ( stderr, " Input value of RULE is not between 1 and 12.\n" ); exit ( 1 ); } if ( rule == 1 ) { r8vec_copy ( j, x01, x ); r8vec_copy ( j, w01, w ); } else if ( rule == 2 ) { r8vec_copy ( j, x02, x ); r8vec_copy ( j, w02, w ); } else if ( rule == 3 ) { r8vec_copy ( j, x03, x ); r8vec_copy ( j, w03, w ); } else if ( rule == 4 ) { r8vec_copy ( j, x04, x ); r8vec_copy ( j, w04, w ); } else if ( rule == 5 ) { r8vec_copy ( j, x05, x ); r8vec_copy ( j, w05, w ); } else if ( rule == 6 ) { r8vec_copy ( j, x06, x ); r8vec_copy ( j, w06, w ); } else if ( rule == 7 ) { r8vec_copy ( j, x07, x ); r8vec_copy ( j, w07, w ); } else if ( rule == 8 ) { r8vec_copy ( j, x08, x ); r8vec_copy ( j, w08, w ); } else if ( rule == 9 ) { r8vec_copy ( j, x09, x ); r8vec_copy ( j, w09, w ); } else if ( rule == 10 ) { r8vec_copy ( j, x10, x ); r8vec_copy ( j, w10, w ); } else if ( rule == 11 ) { r8vec_copy ( j, x11, x ); r8vec_copy ( j, w11, w ); } else if ( rule == 12 ) { r8vec_copy ( j, x12, x ); r8vec_copy ( j, w12, w ); } return; }