Intrepid
http://trilinos.sandia.gov/packages/docs/r10.12/packages/intrepid/src/Shared/Intrepid_BurkardtRulesDef.hpp
Go to the documentation of this file.
00001 // @HEADER
00002 // ************************************************************************
00003 //
00004 //                           Intrepid Package
00005 //                 Copyright (2007) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Pavel Bochev  (pbboche@sandia.gov)
00038 //                    Denis Ridzal  (dridzal@sandia.gov), or
00039 //                    Kara Peterson (kjpeter@sandia.gov)
00040 //
00041 // ************************************************************************
00042 // @HEADER
00043 
00051 #ifdef _MSC_VER
00052 #include "winmath.h"
00053 #endif
00054 
00055 //# include <cstdlib>
00056 //# include <iomanip>
00057 //# include <iostream>
00058 //# include <cmath>
00059 //# include <ctime>
00060 //# include <Teuchos_ScalarTraitsDecl.hpp>
00061 
00062 namespace Intrepid {
00063 
00064 //****************************************************************************
00065 template<class Scalar> 
00066 void IntrepidBurkardtRules::chebyshev1_compute ( int n, Scalar x[], Scalar w[] )
00067 //****************************************************************************
00068 //
00069 //  Purpose:
00070 //
00071 //    CHEBYSHEV1_COMPUTE computes a Chebyshev type 1 quadrature rule.
00072 //
00073 //  Discussion:
00074 //
00075 //    The integral:
00076 //
00077 //      Integral ( -1 <= X <= 1 ) F(X) / sqrt ( 1 - x^2 ) dX
00078 //
00079 //    The quadrature rule:
00080 //
00081 //      Sum ( 1 <= I <= N ) W(I) * F ( X(I) )
00082 //
00083 //  Licensing:
00084 //
00085 //    This code is distributed under the GNU LGPL license.
00086 //
00087 //  Modified:
00088 //
00089 //    13 June 2009
00090 //
00091 //  Author:
00092 //
00093 //    John Burkardt
00094 //
00095 //  Reference:
00096 //
00097 //    Philip Davis, Philip Rabinowitz,
00098 //    Methods of Numerical Integration,
00099 //    Second Edition,
00100 //    Dover, 2007,
00101 //    ISBN: 0486453391,
00102 //    LC: QA299.3.D28.
00103 //
00104 //  Parameters:
00105 //
00106 //    Input, int N, the order.
00107 //    1 <= N.
00108 //
00109 //    Output, Scalar X[N], the abscissas.
00110 //
00111 //    Output, Scalar W[N], the weights.
00112 //
00113 {
00114   if (n<1) {
00115     std::cerr << "\n";
00116     std::cerr << "CHEBYSHEV1_COMPUTE - Fatal error!\n";
00117     std::cerr << "  Illegal value of N = " << n << "\n";
00118     std::exit (1);
00119   }
00120 
00121   for (int i=0;i<n;i++) {
00122     w[i] = M_PI/(Scalar)(n);
00123   }
00124   for (int i=0;i<n;i++) {
00125     x[i] = std::cos(M_PI*(Scalar)(2*n-1-2*i)/(Scalar)(2*n));
00126   }
00127   if ((n%2)==1) {
00128     x[(n-1)/2] = 0.0;
00129   }
00130 
00131   return;
00132 }
00133 
00134 //****************************************************************************
00135 template<class Scalar> 
00136 void IntrepidBurkardtRules::chebyshev1_compute_points ( int n, Scalar x[] )
00137 //****************************************************************************
00138 //
00139 //  Purpose:
00140 //
00141 //    CHEBYSHEV1_COMPUTE_POINTS computes Chebyshev type 1 quadrature points.
00142 //
00143 //  Licensing:
00144 //
00145 //    This code is distributed under the GNU LGPL license.
00146 //
00147 //  Modified:
00148 //
00149 //    13 June 2009
00150 //
00151 //  Author:
00152 //
00153 //    John Burkardt
00154 //
00155 //  Reference:
00156 //
00157 //    Philip Davis, Philip Rabinowitz,
00158 //    Methods of Numerical Integration,
00159 //    Second Edition,
00160 //    Dover, 2007,
00161 //    ISBN: 0486453391,
00162 //    LC: QA299.3.D28.
00163 //
00164 //  Parameters:
00165 //
00166 //    Input, int N, the order.
00167 //    1 <= N.
00168 //
00169 //    Output, Scalar X[N], the abscissas.
00170 //
00171 {
00172   if (n<1) {
00173     std::cerr << "\n";
00174     std::cerr << "CHEBYSHEV1_COMPUTE_POINTS - Fatal error!\n";
00175     std::cerr << "  Illegal value of N = " << n << "\n";
00176     std::exit(1);
00177   }
00178 
00179   for (int i=0;i<n;i++) {
00180     x[i] = std::cos(M_PI*(Scalar)(2*n-1-2*i)/(Scalar)(2*n));
00181   }
00182   if ((n%2)==1) {
00183     x[(n-1)/2] = 0.0;
00184   }
00185 
00186   return;
00187 }
00188 
00189 //****************************************************************************
00190 template<class Scalar> 
00191 void IntrepidBurkardtRules::chebyshev1_compute_weights ( int n, Scalar w[] )
00192 //****************************************************************************
00193 //
00194 //  Purpose:
00195 //
00196 //    CHEBYSHEV1_COMPUTE_WEIGHTS computes Chebyshev type 1 quadrature weights.
00197 //
00198 //  Licensing:
00199 //
00200 //    This code is distributed under the GNU LGPL license.
00201 //
00202 //  Modified:
00203 //
00204 //    13 June 2009
00205 //
00206 //  Author:
00207 //
00208 //    John Burkardt
00209 //
00210 //  Reference:
00211 //
00212 //    Philip Davis, Philip Rabinowitz,
00213 //    Methods of Numerical Integration,
00214 //    Second Edition,
00215 //    Dover, 2007,
00216 //    ISBN: 0486453391,
00217 //    LC: QA299.3.D28.
00218 //
00219 //  Parameters:
00220 //
00221 //    Input, int N, the order.
00222 //    1 <= N.
00223 //
00224 //    Output, Scalar W[N], the weights.
00225 //
00226 {
00227   if (n<1) {
00228     std::cerr << "\n";
00229     std::cerr << "CHEBYSHEV1_COMPUTE_WEIGHTS - Fatal error!\n";
00230     std::cerr << "  Illegal value of N = " << n << "\n";
00231     std::exit(1);
00232   }
00233 
00234   for (int i=0;i<n;i++) {
00235     w[i] = M_PI/(Scalar)n;
00236   }
00237 
00238   return;
00239 }
00240 
00241 //****************************************************************************
00242 template<class Scalar> 
00243 void IntrepidBurkardtRules::chebyshev2_compute ( int n, Scalar x[], Scalar w[] )
00244 //****************************************************************************
00245 //
00246 //  Purpose:
00247 //
00248 //    CHEBYSHEV2_COMPUTE computes a Chebyshev type 2 quadrature rule.
00249 //
00250 //  Discussion:
00251 //
00252 //    The integral:
00253 //
00254 //      integral ( -1 <= x <= 1 ) f(x)  sqrt ( 1 - x^2 )  dx
00255 //
00256 //    The quadrature rule:
00257 //
00258 //      sum ( 1 <= i <= n ) w(i) * f ( x(i) )
00259 //
00260 //  Licensing:
00261 //
00262 //    This code is distributed under the GNU LGPL license.
00263 //
00264 //  Modified:
00265 //
00266 //    13 June 2009
00267 //
00268 //  Author:
00269 //
00270 //    John Burkardt
00271 //
00272 //  Reference:
00273 //
00274 //    Philip Davis, Philip Rabinowitz,
00275 //    Methods of Numerical Integration,
00276 //    Second Edition,
00277 //    Dover, 2007,
00278 //    ISBN: 0486453391,
00279 //    LC: QA299.3.D28.
00280 //
00281 //  Parameters:
00282 //
00283 //    Input, int N, the order.
00284 //    1 <= N.
00285 //
00286 //    Output, Scalar X[N], the abscissas.
00287 //
00288 //    Output, Scalar W[N], the weights.
00289 //
00290 {
00291   Scalar angle;
00292 
00293   if (n<1) {
00294     std::cerr << "\n";
00295     std::cerr << "CHEBYSHEV2_COMPUTE - Fatal error!\n";
00296     std::cerr << "  Illegal value of N = " << n << "\n";
00297     std::exit(1);
00298   }
00299 
00300   for (int i=0;i<n;i++) {
00301     angle = M_PI*(Scalar)(n-i)/(Scalar)(n+1);
00302     w[i]  = M_PI/(Scalar)(n+1)*std::pow(std::sin(angle),2);
00303     x[i]  = std::cos(angle);
00304   }
00305 
00306   if ((n%2)==1) {
00307     x[(n-1)/2] = 0.0;
00308   }
00309 
00310   return;
00311 }
00312 
00313 //****************************************************************************
00314 template<class Scalar> 
00315 void IntrepidBurkardtRules::chebyshev2_compute_points ( int n, Scalar x[] )
00316 //****************************************************************************
00317 //
00318 //  Purpose:
00319 //
00320 //    CHEBYSHEV2_COMPUTE_POINTS computes Chebyshev type 2 quadrature points.
00321 //
00322 //  Licensing:
00323 //
00324 //    This code is distributed under the GNU LGPL license.
00325 //
00326 //  Modified:
00327 //
00328 //    13 June 2009
00329 //
00330 //  Author:
00331 //
00332 //    John Burkardt
00333 //
00334 //  Reference:
00335 //
00336 //    Philip Davis, Philip Rabinowitz,
00337 //    Methods of Numerical Integration,
00338 //    Second Edition,
00339 //    Dover, 2007,
00340 //    ISBN: 0486453391,
00341 //    LC: QA299.3.D28.
00342 //
00343 //  Parameters:
00344 //
00345 //    Input, int N, the order.
00346 //    1 <= N.
00347 //
00348 //    Output, Scalar X[N], the abscissas.
00349 //
00350 {
00351   Scalar angle;
00352 
00353   if (n<1) {
00354     std::cerr << "\n";
00355     std::cerr << "CHEBYSHEV2_COMPUTE_POINTS - Fatal error!\n";
00356     std::cerr << "  Illegal value of N = " << n << "\n";
00357     std::exit(1);
00358   }
00359 
00360   for (int i=0;i<n;i++) {
00361     angle = M_PI*(Scalar)(n-i)/(Scalar)(n+1);
00362     x[i]  = std::cos(angle);
00363   }
00364 
00365   if ((n%2)==1) {
00366     x[(n-1)/2] = 0.0;
00367   }
00368 
00369   return;
00370 }
00371 
00372 //****************************************************************************
00373 template<class Scalar> 
00374 void IntrepidBurkardtRules::chebyshev2_compute_weights ( int n, Scalar w[] )
00375 //****************************************************************************
00376 //
00377 //  Purpose:
00378 //
00379 //    CHEBYSHEV2_COMPUTE_WEIGHTS computes Chebyshev type 2 quadrature weights.
00380 //
00381 //  Licensing:
00382 //
00383 //    This code is distributed under the GNU LGPL license.
00384 //
00385 //  Modified:
00386 //
00387 //    13 June 2009
00388 //
00389 //  Author:
00390 //
00391 //    John Burkardt
00392 //
00393 //  Reference:
00394 //
00395 //    Philip Davis, Philip Rabinowitz,
00396 //    Methods of Numerical Integration,
00397 //    Second Edition,
00398 //    Dover, 2007,
00399 //    ISBN: 0486453391,
00400 //    LC: QA299.3.D28.
00401 //
00402 //  Parameters:
00403 //
00404 //    Input, int N, the order.
00405 //    1 <= N.
00406 //
00407 //    Output, Scalar W[N], the weights.
00408 //
00409 {
00410   Scalar angle;
00411 
00412   if (n<1) {
00413     std::cerr << "\n";
00414     std::cerr << "CHEBYSHEV2_COMPUTE_WEIGHTS - Fatal error!\n";
00415     std::cerr << "  Illegal value of N = " << n << "\n";
00416     std::exit(1);
00417   }
00418 
00419   for (int i=0;i<n;i++) {
00420     angle = M_PI*(Scalar)(n-i)/(Scalar)(n+1);
00421     w[i]  = M_PI/(Scalar)(n+1)*std::pow(std::sin(angle),2);
00422   }
00423 
00424   return;
00425 }
00426 
00427 //****************************************************************************
00428 template<class Scalar> 
00429 void IntrepidBurkardtRules::clenshaw_curtis_compute ( int n, Scalar x[], Scalar w[] )
00430 //****************************************************************************
00431 //
00432 //  Purpose:
00433 //
00434 //    CLENSHAW_CURTIS_COMPUTE computes a Clenshaw Curtis quadrature rule.
00435 //
00436 //  Discussion:
00437 //
00438 //    The integral:
00439 //
00440 //      Integral ( -1 <= X <= 1 ) F(X) dX
00441 //
00442 //    The quadrature rule:
00443 //
00444 //      Sum ( 1 <= I <= N ) W(I) * F ( X(I) )
00445 //
00446 //  Licensing:
00447 //
00448 //    This code is distributed under the GNU LGPL license.
00449 //
00450 //  Modified:
00451 //
00452 //    19 March 2009
00453 //
00454 //  Author:
00455 //
00456 //    John Burkardt
00457 //
00458 //  Parameters:
00459 //
00460 //    Input, int N, the order.
00461 //    1 <= N.
00462 //
00463 //    Output, Scalar X[N], the abscissas.
00464 //
00465 //    Output, Scalar W[N], the weights.
00466 //
00467 {
00468   Scalar b, theta;
00469   int i, j;
00470 
00471   if (n<1) {
00472     std::cerr << "\n";
00473     std::cerr << "CLENSHAW_CURTIS_COMPUTE - Fatal error!\n";
00474     std::cerr << "  Illegal value of N = " << n << "\n";
00475     std::exit(1);
00476   }
00477   else if (n==1) {
00478     x[0] = 0.0;
00479     w[0] = 2.0;
00480   }
00481   else {
00482     for (i=0;i<n;i++) {
00483       x[i] = std::cos((Scalar)(n-1-i)*M_PI/(Scalar)(n-1));
00484     }
00485     x[0] = -1.0;
00486     if ((n%2)==1) {
00487       x[(n-1)/2] = 0.0;
00488     }
00489     x[n-1] = +1.0;
00490 
00491     for (i=0;i<n;i++) {
00492       theta = (Scalar)i*M_PI/(Scalar)(n-1);
00493 
00494       w[i] = 1.0;
00495 
00496       for (j=1;j<=(n-1)/2;j++) {
00497         if (2*j==(n-1)) {
00498           b = 1.0;
00499         }
00500         else {
00501           b = 2.0;
00502         }
00503 
00504         w[i] = w[i]-b*std::cos(2.0*(Scalar)(j)*theta)/(Scalar)(4*j*j-1);
00505       }
00506     }
00507 
00508     w[0] = w[0]/(Scalar)(n-1);
00509     for (i=1;i<n-1;i++) {
00510       w[i] = 2.0*w[i]/(Scalar)(n-1);
00511     }
00512     w[n-1] = w[n-1]/(Scalar)(n-1);
00513   }
00514 
00515   return;
00516 }
00517 
00518 //****************************************************************************
00519 template<class Scalar> 
00520 void IntrepidBurkardtRules::clenshaw_curtis_compute_points ( int n, Scalar x[] )
00521 //****************************************************************************
00522 //
00523 //  Purpose:
00524 //
00525 //    CLENSHAW_CURTIS_COMPUTE_POINTS computes Clenshaw Curtis quadrature points.
00526 //
00527 //  Discussion:
00528 //
00529 //    Our convention is that the abscissas are numbered from left to right.
00530 //
00531 //    This rule is defined on [-1,1].
00532 //
00533 //  Licensing:
00534 //
00535 //    This code is distributed under the GNU LGPL license.
00536 //
00537 //  Modified:
00538 //
00539 //    13 June 2009
00540 //
00541 //  Author:
00542 //
00543 //    John Burkardt
00544 //
00545 //  Parameters:
00546 //
00547 //    Input, int N, the order.
00548 //
00549 //    Output, Scalar X[N], the abscissas.
00550 //
00551 {
00552   int index;
00553 
00554   if (n<1) {
00555     std::cerr << "\n";
00556     std::cerr << "CLENSHAW_CURTIS_COMPUTE_POINTS - Fatal error!\n";
00557     std::cerr << "  N < 1.\n";
00558     std::exit(1);
00559   }
00560   else if (n==1) {
00561     x[0] = 0.0;
00562   }
00563   else {
00564     for (index=1;index<=n;index++) {
00565       x[index-1] = std::cos((Scalar)(n-index)*M_PI/(Scalar)(n-1));
00566     }
00567     x[0] = -1.0;
00568     if ((n%2)==1) {
00569       x[(n-1)/2] = 0.0;
00570     }
00571     x[n-1] = +1.0;
00572   }
00573   return;
00574 }
00575 
00576 //****************************************************************************
00577 template<class Scalar> 
00578 void IntrepidBurkardtRules::clenshaw_curtis_compute_weights ( int n, Scalar w[] )
00579 //****************************************************************************
00580 //
00581 //  Purpose:
00582 //
00583 //    CLENSHAW_CURTIS_COMPUTE_WEIGHTS computes Clenshaw Curtis quadrature weights.
00584 //
00585 //  Discussion:
00586 //
00587 //    The user must preallocate space for the output array W.
00588 //
00589 //  Licensing:
00590 //
00591 //    This code is distributed under the GNU LGPL license.
00592 //
00593 //  Modified:
00594 //
00595 //    13 June 2009
00596 //
00597 //  Author:
00598 //
00599 //    John Burkardt
00600 //
00601 //  Reference:
00602 //
00603 //    Charles Clenshaw, Alan Curtis,
00604 //    A Method for Numerical Integration on an Automatic Computer,
00605 //    Numerische Mathematik,
00606 //    Volume 2, Number 1, December 1960, pages 197-205.
00607 //
00608 //  Parameters:
00609 //
00610 //    Input, int N, the order.
00611 //
00612 //    Output, Scalar W[N], the weights.
00613 //
00614 {
00615   Scalar b, theta;
00616   int i, j;
00617 
00618   if (n<1) {
00619     std::cerr << "\n";
00620     std::cerr << "CLENSHAW_CURTIS_COMPUTE_WEIGHTS - Fatal error!\n";
00621     std::cerr << "  N < 1.\n";
00622     std::exit(1);
00623   }
00624   else if (n==1) {
00625     w[0] = 2.0;
00626     return;
00627   }
00628 
00629   for (i=1;i<=n;i++) {
00630     theta = (Scalar)(i-1)*M_PI/(Scalar)(n-1);
00631 
00632     w[i-1] = 1.0;
00633 
00634     for (j=1;j<=(n-1)/2;j++) {
00635       if (2*j==(n-1)) {
00636         b = 1.0;
00637       }
00638       else {
00639         b = 2.0;
00640       }
00641 
00642       w[i-1] = w[i-1]-b*std::cos(2.0*(Scalar)j*theta)/(Scalar)(4*j*j-1);
00643     }
00644   }
00645 
00646   w[0] = w[0]/(Scalar)(n-1);
00647   for (i=1;i<n-1;i++) {
00648     w[i] = 2.0*w[i]/(Scalar)(n-1);
00649   }
00650   w[n-1] = w[n-1]/(Scalar)(n-1);
00651 
00652   return;
00653 }
00654 
00655 //****************************************************************************
00656 template<class Scalar> 
00657 void IntrepidBurkardtRules::fejer2_compute ( int n, Scalar x[], Scalar w[] )
00658 //****************************************************************************
00659 //
00660 //  Purpose:
00661 //
00662 //    FEJER2_COMPUTE computes a Fejer type 2 rule.
00663 //
00664 //  Discussion:
00665 //
00666 //    Our convention is that the abscissas are numbered from left to right.
00667 //
00668 //    The rule is defined on [-1,1].
00669 //
00670 //  Licensing:
00671 //
00672 //    This code is distributed under the GNU LGPL license.
00673 //
00674 //  Modified:
00675 //
00676 //    13 June 2009
00677 //
00678 //  Author:
00679 //
00680 //    John Burkardt
00681 //
00682 //  Parameters:
00683 //
00684 //    Input, int N, the order.
00685 //    1 <= N.
00686 //
00687 //    Output, Scalar X[N], the abscissas.
00688 //
00689 //    Output, Scalar W[N], the weights.
00690 //
00691 {
00692   Scalar p, theta;
00693 
00694   if (n<1) {
00695     std::cerr << "\n";
00696     std::cerr << "FEJER2_COMPUTE - Fatal error!\n";
00697     std::cerr << "  Illegal value of N = " << n << "\n";
00698     std::exit(1);
00699   }
00700   else if (n==1) {
00701     x[0] = 0.0;
00702     w[0] = 2.0;
00703     return;
00704   }
00705 
00706   for (int i=0;i<n;i++) {
00707     x[i] =  std::cos((Scalar)(n-i)*M_PI/(Scalar)(n+1));
00708   }
00709   if ((n%2)==1) {
00710     x[(n-1)/2] = 0.0;
00711   }
00712 
00713   if (n==2) {
00714     w[0] = 1.0;
00715     w[1] = 1.0;
00716   }
00717   else {
00718     for (int i=0;i<n;i++) {
00719       theta = (Scalar)(n-i)*M_PI/(Scalar)(n+1);
00720 
00721       w[i] = 1.0;
00722 
00723       for (int j=1;j<=((n-1)/2);j++) {
00724         w[i] = w[i]-2.0*std::cos(2.0*(Scalar)j*theta)/(Scalar)(4*j*j-1);
00725       }
00726       p = 2.0*(Scalar)(((n+1)/2))-1.0;
00727       w[i] = w[i]-std::cos((p+1.0)*theta)/p;
00728     }
00729     for (int i=0;i<n;i++) {
00730       w[i] = 2.0*w[i]/(Scalar)(n+1);
00731     }
00732   }
00733   return;
00734 }
00735 
00736 //****************************************************************************
00737 template<class Scalar> 
00738 void IntrepidBurkardtRules::fejer2_compute_points ( int n, Scalar x[] )
00739 //****************************************************************************
00740 //
00741 //  Purpose:
00742 //
00743 //    FEJER2_COMPUTE_POINTS computes Fejer type 2 quadrature points.
00744 //
00745 //  Discussion:
00746 //
00747 //    Our convention is that the abscissas are numbered from left to right.
00748 //
00749 //    The rule is defined on [-1,1].
00750 //
00751 //  Licensing:
00752 //
00753 //    This code is distributed under the GNU LGPL license.
00754 //
00755 //  Modified:
00756 //
00757 //    13 June 2009
00758 //
00759 //  Author:
00760 //
00761 //    John Burkardt
00762 //
00763 //  Parameters:
00764 //
00765 //    Input, int N, the order.
00766 //    1 <= N.
00767 //
00768 //    Output, Scalar X[N], the abscissas.
00769 //
00770 {
00771   int i;
00772 
00773   if (n<1) {
00774     std::cerr << "\n";
00775     std::cerr << "FEJER2_COMPUTE_POINTS - Fatal error!\n";
00776     std::cerr << "  N < 1.\n";
00777     std::exit(1);
00778   }
00779   else if (n==1) {
00780     x[0] = 0.0;
00781   }
00782   else {
00783     for (i=1;i<=n;i++) {
00784       x[i-1] = std::cos((Scalar)(n+1-i)*M_PI/(Scalar)(n+1));
00785     }
00786     if ((n%2)==1) {
00787       x[(n-1)/2] = 0.0;
00788     }
00789   }
00790   return;
00791 }
00792 
00793 //****************************************************************************
00794 template<class Scalar> 
00795 void IntrepidBurkardtRules::fejer2_compute_weights ( int n, Scalar w[] )
00796 //****************************************************************************
00797 //
00798 //  Purpose:
00799 //
00800 //    FEJER2_COMPUTE_WEIGHTS computes Fejer type 2 quadrature weights.
00801 //
00802 //  Discussion:
00803 //
00804 //    The user must preallocate space for the output array W.
00805 //
00806 //  Licensing:
00807 //
00808 //    This code is distributed under the GNU LGPL license.
00809 //
00810 //  Modified:
00811 //
00812 //    13 June 2009
00813 //
00814 //  Author:
00815 //
00816 //    John Burkardt
00817 //
00818 //  Reference:
00819 //
00820 //    Philip Davis, Philip Rabinowitz,
00821 //    Methods of Numerical Integration,
00822 //    Second Edition,
00823 //    Dover, 2007,
00824 //    ISBN: 0486453391,
00825 //    LC: QA299.3.D28.
00826 //
00827 //    Walter Gautschi,
00828 //    Numerical Quadrature in the Presence of a Singularity,
00829 //    SIAM Journal on Numerical Analysis,
00830 //    Volume 4, Number 3, 1967, pages 357-362.
00831 //
00832 //    Joerg Waldvogel,
00833 //    Fast Construction of the Fejer and Clenshaw-Curtis Quadrature Rules,
00834 //    BIT Numerical Mathematics,
00835 //    Volume 43, Number 1, 2003, pages 1-18.
00836 //
00837 //  Parameters:
00838 //
00839 //    Input, int N, the order.
00840 //
00841 //    Output, Scalar W[N], the weights.
00842 //
00843 {
00844   int i, j;
00845   Scalar p, theta;
00846 
00847   if (n<1) {
00848     std::cerr << "\n";
00849     std::cerr << "FEJER2_COMPUTE_WEIGHTS - Fatal error!\n";
00850     std::cerr << "  N < 1.\n";
00851     std::exit(1);
00852   }
00853   else if (n==1) {
00854     w[0] = 2.0;
00855   }
00856   else if (n==2) {
00857     w[0] = 1.0;
00858     w[1] = 1.0;
00859   }
00860   else {
00861     for (i=1;i<=n;i++) {
00862       theta = (Scalar)(n+1-i)*M_PI/(Scalar)(n+1);
00863 
00864       w[i-1] = 1.0;
00865 
00866       for (j=1;j<=((n-1)/2);j++) {
00867         w[i-1] = w[i-1]-2.0*std::cos(2.0*(Scalar)j*theta)/(Scalar)(4*j*j-1);
00868       }
00869       p = 2.0*(Scalar)(((n+1)/2))-1.0;
00870       w[i-1] = w[i-1]-std::cos((p+1.0)*theta)/p;
00871     }
00872     for (i=0;i<n;i++) {
00873       w[i] = 2.0*w[i]/(Scalar)(n+1);
00874     }
00875   }
00876   return;
00877 }
00878 
00879 //****************************************************************************
00880 template<class Scalar> 
00881 void IntrepidBurkardtRules::hermite_compute ( int n, Scalar x[], Scalar w[] )
00882 //****************************************************************************
00883 //
00884 //  Purpose:
00885 //
00886 //    HERMITE_COMPUTE computes a Gauss-Hermite quadrature rule.
00887 //
00888 //  Discussion:
00889 //
00890 //    The code uses an algorithm by Elhay and Kautsky.
00891 //
00892 //    The abscissas are the zeros of the N-th order Hermite polynomial.
00893 //
00894 //    The integral:
00895 //
00896 //      integral ( -oo < x < +oo ) exp ( - x * x ) * f(x) dx
00897 //
00898 //    The quadrature rule:
00899 //
00900 //      sum ( 1 <= i <= n ) w(i) * f ( x(i) )
00901 //
00902 //  Licensing:
00903 //
00904 //    This code is distributed under the GNU LGPL license.
00905 //
00906 //  Modified:
00907 //
00908 //    19 April 2011
00909 //
00910 //  Author:
00911 //
00912 //    Original FORTRAN77 version by Sylvan Elhay, Jaroslav Kautsky.
00913 //    C++ version by John Burkardt.
00914 //
00915 //  Reference:
00916 //
00917 //    Sylvan Elhay, Jaroslav Kautsky,
00918 //    Algorithm 655: IQPACK, FORTRAN Subroutines for the Weights of
00919 //    Interpolatory Quadrature,
00920 //    ACM Transactions on Mathematical Software,
00921 //    Volume 13, Number 4, December 1987, pages 399-415.
00922 //
00923 //  Parameters:
00924 //
00925 //    Input, int N, the number of abscissas.
00926 //
00927 //    Output, Scalar X[N], the abscissas.
00928 //
00929 //    Output, Scalar W[N], the weights.
00930 //
00931 {
00932   Scalar* bj;
00933 //
00934 //  Define the zero-th moment.
00935 //
00936   Scalar zemu = std::sqrt(M_PI); 
00937 //
00938 //  Define the Jacobi matrix.
00939 //
00940   bj = new Scalar[n];
00941 
00942   for (int i=0;i<n;i++) {
00943     bj[i] = std::sqrt((Scalar)(i+1)/2.0);
00944   }
00945 
00946   for (int i=0;i<n;i++) {
00947     x[i] = 0.0;
00948   }
00949 
00950   w[0] = std::sqrt (zemu);
00951   for (int i=1;i<n;i++) {
00952     w[i] = 0.0;
00953   }
00954 //
00955 //  Diagonalize the Jacobi matrix.
00956 //
00957   IntrepidBurkardtRules::imtqlx ( n, x, bj, w );
00958 
00959   for (int i=0;i<n;i++) {
00960     w[i] = w[i]*w[i];
00961   }
00962   
00963   // Ensure that zero is actually zero.
00964   if (n%2) {
00965     int ind = (int)((Scalar)n/2.0);
00966     x[ind]  = 0.0;
00967   }
00968 
00969   delete [] bj;
00970 
00971   return;
00972 }
00973 
00974 //****************************************************************************
00975 template<class Scalar> 
00976 void IntrepidBurkardtRules::hermite_compute_points ( int order, Scalar x[] )
00977 //****************************************************************************
00978 //
00979 //  Purpose:
00980 //
00981 //    HERMITE_COMPUTE_POINTS computes Hermite quadrature points.
00982 //
00983 //  Licensing:
00984 //
00985 //    This code is distributed under the GNU LGPL license.
00986 //
00987 //  Modified:
00988 //
00989 //    13 June 2009
00990 //
00991 //  Author:
00992 //
00993 //    John Burkardt
00994 //
00995 //  Parameters:
00996 //
00997 //    Input, int ORDER, the order.
00998 //
00999 //    Output, Scalar X[ORDER], the abscissas.
01000 //
01001 {
01002   Scalar *w;  w = new Scalar[order];
01003   IntrepidBurkardtRules::hermite_compute ( order, x, w );
01004   delete [] w;
01005 
01006   return;
01007 }
01008 
01009 //****************************************************************************
01010 template<class Scalar> 
01011 void IntrepidBurkardtRules::hermite_compute_weights ( int order, Scalar w[] )
01012 //****************************************************************************
01013 //
01014 //  Purpose:
01015 //
01016 //    HERMITE_COMPUTE_WEIGHTS computes Hermite quadrature weights.
01017 //
01018 //  Licensing:
01019 //
01020 //    This code is distributed under the GNU LGPL license.
01021 //
01022 //  Modified:
01023 //
01024 //    13 June 2009
01025 //
01026 //  Author:
01027 //
01028 //    John Burkardt
01029 //
01030 //  Parameters:
01031 //
01032 //    Input, int ORDER, the order.
01033 //
01034 //    Output, Scalar W[ORDER], the weights.
01035 //
01036 {
01037   Scalar *x; x = new Scalar[order];
01038   IntrepidBurkardtRules::hermite_compute ( order, x, w );
01039   delete [] x;
01040 
01041   return;
01042 }
01043 
01044 //****************************************************************************
01045 template<class Scalar> 
01046 void IntrepidBurkardtRules::hermite_genz_keister_lookup ( int n, Scalar x[], Scalar w[] )
01047 //****************************************************************************
01048 //
01049 //  Purpose:
01050 //
01051 //    HERMITE_GENZ_KEISTER_LOOKUP looks up a Genz-Keister Hermite rule.
01052 //
01053 //  Discussion:
01054 //
01055 //    The integral:
01056 //
01057 //      integral ( -oo <= x <= +oo ) f(x) exp ( - x * x ) dx
01058 //
01059 //    The quadrature rule:
01060 //
01061 //      sum ( 1 <= i <= n ) w(i) * f ( x(i) )
01062 //
01063 //    A nested family of rules for the Hermite integration problem
01064 //    was produced by Genz and Keister.  The structure of the nested
01065 //    family was denoted by 1+2+6+10+16, that is, it comprised rules
01066 //    of successive orders O = 1, 3, 9, 19, and 35.
01067 //
01068 //    The precisions of these rules are P = 1, 5, 15, 29, and 51.
01069 //
01070 //  Licensing:
01071 //
01072 //    This code is distributed under the GNU LGPL license.
01073 //
01074 //  Modified:
01075 //
01076 //    07 June 2010
01077 //
01078 //  Author:
01079 //
01080 //    John Burkardt
01081 //
01082 //  Reference:
01083 //
01084 //    Alan Genz, Bradley Keister,
01085 //    Fully symmetric interpolatory rules for multiple integrals
01086 //    over infinite regions with Gaussian weight,
01087 //    Journal of Computational and Applied Mathematics,
01088 //    Volume 71, 1996, pages 299-309
01089 //
01090 //    Florian Heiss, Viktor Winschel,
01091 //    Likelihood approximation by numerical integration on sparse grids,
01092 //    Journal of Econometrics,
01093 //    Volume 144, 2008, pages 62-80.
01094 //
01095 //    Thomas Patterson,
01096 //    The Optimal Addition of Points to Quadrature Formulae,
01097 //    Mathematics of Computation,
01098 //    Volume 22, Number 104, October 1968, pages 847-856.
01099 //
01100 //  Parameters:
01101 //
01102 //    Input, int N, the order.
01103 //    N must be 1, 3, 9, 19, or 35.
01104 //
01105 //    Output, Scalar X[N], the abscissas.
01106 //
01107 //    Output, Scalar W[N], the weights.
01108 //
01109 {
01110   IntrepidBurkardtRules::hermite_genz_keister_lookup_points ( n, x );
01111   IntrepidBurkardtRules::hermite_genz_keister_lookup_weights ( n, w );
01112 
01113   return;
01114 }
01115 
01116 //****************************************************************************
01117 template<class Scalar> 
01118 void IntrepidBurkardtRules::hermite_genz_keister_lookup_points ( int n, Scalar x[] )
01119 //****************************************************************************
01120 //
01121 //  Purpose:
01122 //
01123 //    HERMITE_GENZ_KEISTER_LOOKUP_POINTS looks up Genz-Keister Hermite abscissas.
01124 //
01125 //  Discussion:
01126 //
01127 //    The integral:
01128 //
01129 //      integral ( -oo <= x <= +oo ) f(x) exp ( - x * x ) dx
01130 //
01131 //    The quadrature rule:
01132 //
01133 //      sum ( 1 <= i <= n ) w(i) * f ( x(i) )
01134 //
01135 //    A nested family of rules for the Hermite integration problem
01136 //    was produced by Genz and Keister.  The structure of the nested
01137 //    family was denoted by 1+2+6+10+16, that is, it comprised rules
01138 //    of successive orders O = 1, 3, 9, 19, and 35.
01139 //
01140 //    The precisions of these rules are P = 1, 5, 15, 29, and 51.
01141 //
01142 //    Three related families begin the same way, but end with a different final
01143 //    rule.  As a convenience, this function includes these final rules as well:
01144 //
01145 //    Designation  Orders       Precisions
01146 //
01147 //    1+2+6+10+16, 1,3,9,19,35  1,5,15,29,51
01148 //    1+2+6+10+18  1,3,9,19,37  1,5,15,29,55
01149 //    1+2+6+10+22  1,3,9,19,41  1,5,15,29,63
01150 //    1+2+6+10+24  1,3,9,19,43  1,5,15,29,67
01151 //
01152 //    Some of the data in this function was kindly supplied directly by
01153 //    Alan Genz on 24 April 2011.
01154 //
01155 //  Licensing:
01156 //
01157 //    This code is distributed under the GNU LGPL license.
01158 //
01159 //  Modified:
01160 //
01161 //    18 May 2011
01162 //
01163 //  Author:
01164 //
01165 //    John Burkardt
01166 //
01167 //  Reference:
01168 //
01169 //    Alan Genz, Bradley Keister,
01170 //    Fully symmetric interpolatory rules for multiple integrals
01171 //    over infinite regions with Gaussian weight,
01172 //    Journal of Computational and Applied Mathematics,
01173 //    Volume 71, 1996, pages 299-309
01174 //
01175 //    Florian Heiss, Viktor Winschel,
01176 //    Likelihood approximation by numerical integration on sparse grids,
01177 //    Journal of Econometrics,
01178 //    Volume 144, 2008, pages 62-80.
01179 //
01180 //    Thomas Patterson,
01181 //    The Optimal Addition of Points to Quadrature Formulae,
01182 //    Mathematics of Computation,
01183 //    Volume 22, Number 104, October 1968, pages 847-856.
01184 //
01185 //  Parameters:
01186 //
01187 //    Input, int N, the order.
01188 //    N must be 1, 3, 9, 19, 35, 27, 41, or 43.
01189 //
01190 //    Output, Scalar X[N], the abscissas.
01191 //
01192 {
01193   if (n==1) {
01194     x[ 0] =   0.0000000000000000E+00;
01195   }
01196   else if (n==3) {
01197     x[ 0] =  -1.2247448713915889E+00;
01198     x[ 1] =   0.0000000000000000E+00;
01199     x[ 2] =   1.2247448713915889E+00;
01200   }
01201   else if (n==9) {
01202     x[ 0] =  -2.9592107790638380E+00;
01203     x[ 1] =  -2.0232301911005157E+00;
01204     x[ 2] =  -1.2247448713915889E+00;
01205     x[ 3] =  -5.2403354748695763E-01;
01206     x[ 4] =   0.0000000000000000E+00;
01207     x[ 5] =   5.2403354748695763E-01;
01208     x[ 6] =   1.2247448713915889E+00;
01209     x[ 7] =   2.0232301911005157E+00;
01210     x[ 8] =   2.9592107790638380E+00;
01211   }
01212   else if (n==19) {
01213     x[ 0] =  -4.4995993983103881E+00;
01214     x[ 1] =  -3.6677742159463378E+00;
01215     x[ 2] =  -2.9592107790638380E+00;
01216     x[ 3] =  -2.2665132620567876E+00;
01217     x[ 4] =  -2.0232301911005157E+00;
01218     x[ 5] =  -1.8357079751751868E+00;
01219     x[ 6] =  -1.2247448713915889E+00;
01220     x[ 7] =  -8.7004089535290285E-01;
01221     x[ 8] =  -5.2403354748695763E-01;
01222     x[ 9] =   0.0000000000000000E+00;
01223     x[10] =   5.2403354748695763E-01;
01224     x[11] =   8.7004089535290285E-01;
01225     x[12] =   1.2247448713915889E+00;
01226     x[13] =   1.8357079751751868E+00;
01227     x[14] =   2.0232301911005157E+00;
01228     x[15] =   2.2665132620567876E+00;
01229     x[16] =   2.9592107790638380E+00;
01230     x[17] =   3.6677742159463378E+00;
01231     x[18] =   4.4995993983103881E+00;
01232   }
01233   else if (n==35) {
01234     x[ 0] =  -6.3759392709822356E+00;
01235     x[ 1] =  -5.6432578578857449E+00;
01236     x[ 2] =  -5.0360899444730940E+00;
01237     x[ 3] =  -4.4995993983103881E+00;
01238     x[ 4] =  -4.0292201405043713E+00;
01239     x[ 5] =  -3.6677742159463378E+00;
01240     x[ 6] =  -3.3491639537131945E+00;
01241     x[ 7] =  -2.9592107790638380E+00;
01242     x[ 8] =  -2.5705583765842968E+00;
01243     x[ 9] =  -2.2665132620567876E+00;
01244     x[10] =  -2.0232301911005157E+00;
01245     x[11] =  -1.8357079751751868E+00;
01246     x[12] =  -1.5794121348467671E+00;
01247     x[13] =  -1.2247448713915889E+00;
01248     x[14] =  -8.7004089535290285E-01;
01249     x[15] =  -5.2403354748695763E-01;
01250     x[16] =  -1.7606414208200893E-01;
01251     x[17] =   0.0000000000000000E+00;
01252     x[18] =   1.7606414208200893E-01;
01253     x[19] =   5.2403354748695763E-01;
01254     x[20] =   8.7004089535290285E-01;
01255     x[21] =   1.2247448713915889E+00;
01256     x[22] =   1.5794121348467671E+00;
01257     x[23] =   1.8357079751751868E+00;
01258     x[24] =   2.0232301911005157E+00;
01259     x[25] =   2.2665132620567876E+00;
01260     x[26] =   2.5705583765842968E+00;
01261     x[27] =   2.9592107790638380E+00;
01262     x[28] =   3.3491639537131945E+00;
01263     x[29] =   3.6677742159463378E+00;
01264     x[30] =   4.0292201405043713E+00;
01265     x[31] =   4.4995993983103881E+00;
01266     x[32] =   5.0360899444730940E+00;
01267     x[33] =   5.6432578578857449E+00;
01268     x[34] =   6.3759392709822356E+00;
01269   }
01270   else if (n==37) {
01271     x[ 0] =  -6.853200069757519;
01272     x[ 1] =  -6.124527854622158;
01273     x[ 2] =  -5.521865209868350;
01274     x[ 3] =  -4.986551454150765;
01275     x[ 4] =  -4.499599398310388;
01276     x[ 5] =  -4.057956316089741;
01277     x[ 6] =  -3.667774215946338;
01278     x[ 7] =  -3.315584617593290;
01279     x[ 8] =  -2.959210779063838;
01280     x[ 9] =  -2.597288631188366;
01281     x[10] =  -2.266513262056788;
01282     x[11] =  -2.023230191100516;
01283     x[12] =  -1.835707975175187;
01284     x[13] =  -1.561553427651873;
01285     x[14] =  -1.224744871391589;
01286     x[15] =  -0.870040895352903;
01287     x[16] =  -0.524033547486958;
01288     x[17] =  -0.214618180588171;
01289     x[18] =   0.000000000000000;
01290     x[19] =   0.214618180588171;
01291     x[20] =   0.524033547486958;
01292     x[21] =   0.870040895352903;
01293     x[22] =   1.224744871391589;
01294     x[23] =   1.561553427651873;
01295     x[24] =   1.835707975175187;
01296     x[25] =   2.023230191100516;
01297     x[26] =   2.266513262056788;
01298     x[27] =   2.597288631188366;
01299     x[28] =   2.959210779063838;
01300     x[29] =   3.315584617593290;
01301     x[30] =   3.667774215946338;
01302     x[31] =   4.057956316089741;
01303     x[32] =   4.499599398310388;
01304     x[33] =   4.986551454150765;
01305     x[34] =   5.521865209868350;
01306     x[35] =   6.124527854622158;
01307     x[36] =   6.853200069757519;
01308   }
01309   else if (n==41) {
01310     x[ 0] =  -7.251792998192644;
01311     x[ 1] =  -6.547083258397540;
01312     x[ 2] =  -5.961461043404500;
01313     x[ 3] =  -5.437443360177798;
01314     x[ 4] =  -4.953574342912980;
01315     x[ 5] =  -4.4995993983103881;
01316     x[ 6] =  -4.070919267883068;
01317     x[ 7] =  -3.6677742159463378;
01318     x[ 8] =  -3.296114596212218;
01319     x[ 9] =  -2.9592107790638380;
01320     x[10] =  -2.630415236459871;
01321     x[11] =  -2.2665132620567876;
01322     x[12] =  -2.043834754429505;
01323     x[13] =  -2.0232301911005157;
01324     x[14] =  -1.8357079751751868;
01325     x[15] =  -1.585873011819188;
01326     x[16] =  -1.2247448713915889;
01327     x[17] =  -0.87004089535290285;
01328     x[18] =  -0.52403354748695763;
01329     x[19] =  -0.195324784415805;
01330     x[20] =   0.0000000000000000;
01331     x[21] =   0.195324784415805;
01332     x[22] =   0.52403354748695763;
01333     x[23] =   0.87004089535290285;
01334     x[24] =   1.2247448713915889;
01335     x[25] =   1.585873011819188;
01336     x[26] =   1.8357079751751868;
01337     x[27] =   2.0232301911005157;
01338     x[28] =   2.043834754429505;
01339     x[29] =   2.2665132620567876;
01340     x[30] =   2.630415236459871;
01341     x[31] =   2.9592107790638380;
01342     x[32] =   3.296114596212218;
01343     x[33] =   3.6677742159463378;
01344     x[34] =   4.070919267883068;
01345     x[35] =   4.4995993983103881;
01346     x[36] =   4.953574342912980;
01347     x[37] =   5.437443360177798;
01348     x[38] =   5.961461043404500;
01349     x[39] =   6.547083258397540;
01350     x[40] =   7.251792998192644;
01351   }
01352   else if (n==43) {
01353     x[ 0] = -10.167574994881873;
01354     x[ 1] =  -7.231746029072501;
01355     x[ 2] =  -6.535398426382995;
01356     x[ 3] =  -5.954781975039809;
01357     x[ 4] =  -5.434053000365068;
01358     x[ 5] =  -4.952329763008589;
01359     x[ 6] =  -4.4995993983103881;
01360     x[ 7] =  -4.071335874253583;
01361     x[ 8] =  -3.6677742159463378;
01362     x[ 9] =  -3.295265921534226;
01363     x[10] =  -2.9592107790638380;
01364     x[11] =  -2.633356763661946;
01365     x[12] =  -2.2665132620567876;
01366     x[13] =  -2.089340389294661;
01367     x[14] =  -2.0232301911005157;
01368     x[15] =  -1.8357079751751868;
01369     x[16] =  -1.583643465293944;
01370     x[17] =  -1.2247448713915889;
01371     x[18] =  -0.87004089535290285;
01372     x[19] =  -0.52403354748695763;
01373     x[20] =  -0.196029453662011;
01374     x[21] =   0.0000000000000000;
01375     x[22] =   0.196029453662011;
01376     x[23] =   0.52403354748695763;
01377     x[24] =   0.87004089535290285;
01378     x[25] =   1.2247448713915889;
01379     x[26] =   1.583643465293944;
01380     x[27] =   1.8357079751751868;
01381     x[28] =   2.0232301911005157;
01382     x[29] =   2.089340389294661;
01383     x[30] =   2.2665132620567876;
01384     x[31] =   2.633356763661946;
01385     x[32] =   2.9592107790638380;
01386     x[33] =   3.295265921534226;
01387     x[34] =   3.6677742159463378;
01388     x[35] =   4.071335874253583;
01389     x[36] =   4.4995993983103881;
01390     x[37] =   4.952329763008589;
01391     x[38] =   5.434053000365068;
01392     x[39] =   5.954781975039809;
01393     x[40] =   6.535398426382995;
01394     x[41] =   7.231746029072501;
01395     x[42] =  10.167574994881873;
01396   }
01397   else {
01398     std::cerr << "\n";
01399     std::cerr << "HERMITE_GENZ_KEISTER_LOOKUP_POINTS - Fatal error!\n";
01400     std::cerr << "  Illegal input value of N.\n";
01401     std::cerr << "  N must be 1, 3, 9, 19, 35, 37, 41 or 43.\n";
01402     std::exit(1);
01403   }
01404   return;
01405 }
01406 
01407 //****************************************************************************
01408 template<class Scalar> 
01409 void IntrepidBurkardtRules::hermite_genz_keister_lookup_weights ( int n, Scalar w[] )
01410 //****************************************************************************
01411 //
01412 //  Purpose:
01413 //
01414 //    HERMITE_GENZ_KEISTER_LOOKUP_WEIGHTS looks up Genz-Keister Hermite weights.
01415 //
01416 //  Discussion:
01417 //
01418 //    The integral:
01419 //
01420 //      integral ( -oo <= x <= +oo ) f(x) exp ( - x * x ) dx
01421 //
01422 //    The quadrature rule:
01423 //
01424 //      sum ( 1 <= i <= n ) w(i) * f ( x(i) )
01425 //
01426 //    A nested family of rules for the Hermite integration problem
01427 //    was produced by Genz and Keister.  The structure of the nested
01428 //    family was denoted by 1+2+6+10+16, that is, it comprised rules
01429 //    of successive orders O = 1, 3, 9, 19, and 35.
01430 //
01431 //    The precisions of these rules are P = 1, 5, 15, 29, and 51.
01432 //
01433 //    Three related families begin the same way, but end with a different final
01434 //    rule.  As a convenience, this function includes these final rules as well:
01435 //
01436 //    Designation  Orders       Precisions
01437 //
01438 //    1+2+6+10+16, 1,3,9,19,35  1,5,15,29,51
01439 //    1+2+6+10+18  1,3,9,19,37  1,5,15,29,55
01440 //    1+2+6+10+22  1,3,9,19,41  1,5,15,29,63
01441 //    1+2+6+10+24  1,3,9,19,43  1,5,15,29,67
01442 //
01443 //    Some of the data in this function was kindly supplied directly by
01444 //    Alan Genz on 24 April 2011.
01445 //
01446 //  Licensing:
01447 //
01448 //    This code is distributed under the GNU LGPL license.
01449 //
01450 //  Modified:
01451 //
01452 //    18 May 2011
01453 //
01454 //  Author:
01455 //
01456 //    John Burkardt
01457 //
01458 //  Reference:
01459 //
01460 //    Alan Genz, Bradley Keister,
01461 //    Fully symmetric interpolatory rules for multiple integrals
01462 //    over infinite regions with Gaussian weight,
01463 //    Journal of Computational and Applied Mathematics,
01464 //    Volume 71, 1996, pages 299-309
01465 //
01466 //    Florian Heiss, Viktor Winschel,
01467 //    Likelihood approximation by numerical integration on sparse grids,
01468 //    Journal of Econometrics,
01469 //    Volume 144, 2008, pages 62-80.
01470 //
01471 //    Thomas Patterson,
01472 //    The Optimal Addition of Points to Quadrature Formulae,
01473 //    Mathematics of Computation,
01474 //    Volume 22, Number 104, October 1968, pages 847-856.
01475 //
01476 //  Parameters:
01477 //
01478 //    Input, int N, the order.
01479 //    N must be 1, 3, 9, 19, 35, 37, 41, or 43.
01480 //
01481 //    Output, Scalar W[N], the weights.
01482 //
01483 {
01484   if (n==1) {
01485     w[ 0] =   1.7724538509055159E+00;
01486   }
01487   else if (n==3) {
01488     w[ 0] =   2.9540897515091930E-01;
01489     w[ 1] =   1.1816359006036772E+00;
01490     w[ 2] =   2.9540897515091930E-01;
01491   }
01492   else if (n==9) {
01493     w[ 0] =   1.6708826306882348E-04;
01494     w[ 1] =   1.4173117873979098E-02;
01495     w[ 2] =   1.6811892894767771E-01;
01496     w[ 3] =   4.7869428549114124E-01;
01497     w[ 4] =   4.5014700975378197E-01;
01498     w[ 5] =   4.7869428549114124E-01;
01499     w[ 6] =   1.6811892894767771E-01;
01500     w[ 7] =   1.4173117873979098E-02;
01501     w[ 8] =   1.6708826306882348E-04;
01502   }
01503   else if (n==19) {
01504     w[ 0] =   1.5295717705322357E-09;
01505     w[ 1] =   1.0802767206624762E-06;
01506     w[ 2] =   1.0656589772852267E-04;
01507     w[ 3] =   5.1133174390883855E-03;
01508     w[ 4] =  -1.1232438489069229E-02;
01509     w[ 5] =   3.2055243099445879E-02;
01510     w[ 6] =   1.1360729895748269E-01;
01511     w[ 7] =   1.0838861955003017E-01;
01512     w[ 8] =   3.6924643368920851E-01;
01513     w[ 9] =   5.3788160700510168E-01;
01514     w[10] =   3.6924643368920851E-01;
01515     w[11] =   1.0838861955003017E-01;
01516     w[12] =   1.1360729895748269E-01;
01517     w[13] =   3.2055243099445879E-02;
01518     w[14] =  -1.1232438489069229E-02;
01519     w[15] =   5.1133174390883855E-03;
01520     w[16] =   1.0656589772852267E-04;
01521     w[17] =   1.0802767206624762E-06;
01522     w[18] =   1.5295717705322357E-09;
01523   }
01524   else if (n==35) {
01525     w[ 0] =   1.8684014894510604E-18;
01526     w[ 1] =   9.6599466278563243E-15;
01527     w[ 2] =   5.4896836948499462E-12;
01528     w[ 3] =   8.1553721816916897E-10;
01529     w[ 4] =   3.7920222392319532E-08;
01530     w[ 5] =   4.3737818040926989E-07;
01531     w[ 6] =   4.8462799737020461E-06;
01532     w[ 7] =   6.3328620805617891E-05;
01533     w[ 8] =   4.8785399304443770E-04;
01534     w[ 9] =   1.4515580425155904E-03;
01535     w[10] =   4.0967527720344047E-03;
01536     w[11] =   5.5928828911469180E-03;
01537     w[12] =   2.7780508908535097E-02;
01538     w[13] =   8.0245518147390893E-02;
01539     w[14] =   1.6371221555735804E-01;
01540     w[15] =   2.6244871488784277E-01;
01541     w[16] =   3.3988595585585218E-01;
01542     w[17] =   9.1262675363737921E-04;
01543     w[18] =   3.3988595585585218E-01;
01544     w[19] =   2.6244871488784277E-01;
01545     w[20] =   1.6371221555735804E-01;
01546     w[21] =   8.0245518147390893E-02;
01547     w[22] =   2.7780508908535097E-02;
01548     w[23] =   5.5928828911469180E-03;
01549     w[24] =   4.0967527720344047E-03;
01550     w[25] =   1.4515580425155904E-03;
01551     w[26] =   4.8785399304443770E-04;
01552     w[27] =   6.3328620805617891E-05;
01553     w[28] =   4.8462799737020461E-06;
01554     w[29] =   4.3737818040926989E-07;
01555     w[30] =   3.7920222392319532E-08;
01556     w[31] =   8.1553721816916897E-10;
01557     w[32] =   5.4896836948499462E-12;
01558     w[33] =   9.6599466278563243E-15;
01559     w[34] =   1.8684014894510604E-18;
01560   }
01561   else if (n==37) {
01562     w[ 0] = 0.19030350940130498E-20;
01563     w[ 1] = 0.187781893143728947E-16;
01564     w[ 2] = 0.182242751549129356E-13;
01565     w[ 3] = 0.45661763676186859E-11;
01566     w[ 4] = 0.422525843963111041E-09;
01567     w[ 5] = 0.16595448809389819E-07;
01568     w[ 6] = 0.295907520230744049E-06;
01569     w[ 7] = 0.330975870979203419E-05;
01570     w[ 8] = 0.32265185983739747E-04;
01571     w[ 9] = 0.234940366465975222E-03;
01572     w[10] = 0.985827582996483824E-03;
01573     w[11] = 0.176802225818295443E-02;
01574     w[12] = 0.43334988122723492E-02;
01575     w[13] = 0.15513109874859354E-01;
01576     w[14] = 0.442116442189845444E-01;
01577     w[15] = 0.937208280655245902E-01;
01578     w[16] = 0.143099302896833389E+00;
01579     w[17] = 0.147655710402686249E+00;
01580     w[18] = 0.968824552928425499E-01;
01581     w[19] = 0.147655710402686249E+00;
01582     w[20] = 0.143099302896833389E+00;
01583     w[21] = 0.937208280655245902E-01;
01584     w[22] = 0.442116442189845444E-01;
01585     w[23] = 0.15513109874859354E-01;
01586     w[24] = 0.43334988122723492E-02;
01587     w[25] = 0.176802225818295443E-02;
01588     w[26] = 0.985827582996483824E-03;
01589     w[27] = 0.234940366465975222E-03;
01590     w[28] = 0.32265185983739747E-04;
01591     w[29] = 0.330975870979203419E-05;
01592     w[30] = 0.295907520230744049E-06;
01593     w[31] = 0.16595448809389819E-07;
01594     w[32] = 0.422525843963111041E-09;
01595     w[33] = 0.45661763676186859E-11;
01596     w[34] = 0.182242751549129356E-13;
01597     w[35] = 0.187781893143728947E-16;
01598     w[36] = 0.19030350940130498E-20;
01599   }
01600   else if (n==41) {
01601     w[ 0] =   0.664195893812757801E-23;
01602     w[ 1] =   0.860427172512207236E-19;
01603     w[ 2] =   0.1140700785308509E-15;
01604     w[ 3] =   0.408820161202505983E-13;
01605     w[ 4] =   0.581803393170320419E-11;
01606     w[ 5] =   0.400784141604834759E-09;
01607     w[ 6] =   0.149158210417831408E-07;
01608     w[ 7] =   0.315372265852264871E-06;
01609     w[ 8] =   0.381182791749177506E-05;
01610     w[ 9] =   0.288976780274478689E-04;
01611     w[10] =   0.189010909805097887E-03;
01612     w[11] =   0.140697424065246825E-02;
01613     w[12] = - 0.144528422206988237E-01;
01614     w[13] =   0.178852543033699732E-01;
01615     w[14] =   0.705471110122962612E-03;
01616     w[15] =   0.165445526705860772E-01;
01617     w[16] =   0.45109010335859128E-01;
01618     w[17] =   0.928338228510111845E-01;
01619     w[18] =   0.145966293895926429E+00;
01620     w[19] =   0.165639740400529554E+00;
01621     w[20] =   0.562793426043218877E-01;
01622     w[21] =   0.165639740400529554E+00;
01623     w[22] =   0.145966293895926429E+00;
01624     w[23] =   0.928338228510111845E-01;
01625     w[24] =   0.45109010335859128E-01;
01626     w[25] =   0.165445526705860772E-01;
01627     w[26] =   0.705471110122962612E-03;
01628     w[27] =   0.178852543033699732E-01;
01629     w[28] = - 0.144528422206988237E-01;
01630     w[29] =   0.140697424065246825E-02;
01631     w[30] =   0.189010909805097887E-03;
01632     w[31] =   0.288976780274478689E-04;
01633     w[32] =   0.381182791749177506E-05;
01634     w[33] =   0.315372265852264871E-06;
01635     w[34] =   0.149158210417831408E-07;
01636     w[35] =   0.400784141604834759E-09;
01637     w[36] =   0.581803393170320419E-11;
01638     w[37] =   0.408820161202505983E-13;
01639     w[38] =   0.1140700785308509E-15;
01640     w[39] =   0.860427172512207236E-19;
01641     w[40] =   0.664195893812757801E-23;
01642   }
01643   else if (n==43) {
01644     w[ 0] =   0.546191947478318097E-37;
01645     w[ 1] =   0.87544909871323873E-23;
01646     w[ 2] =   0.992619971560149097E-19;
01647     w[ 3] =   0.122619614947864357E-15;
01648     w[ 4] =   0.421921851448196032E-13;
01649     w[ 5] =   0.586915885251734856E-11;
01650     w[ 6] =   0.400030575425776948E-09;
01651     w[ 7] =   0.148653643571796457E-07;
01652     w[ 8] =   0.316018363221289247E-06;
01653     w[ 9] =   0.383880761947398577E-05;
01654     w[10] =   0.286802318064777813E-04;
01655     w[11] =   0.184789465688357423E-03;
01656     w[12] =   0.150909333211638847E-02;
01657     w[13] = - 0.38799558623877157E-02;
01658     w[14] =   0.67354758901013295E-02;
01659     w[15] =   0.139966252291568061E-02;
01660     w[16] =   0.163616873493832402E-01;
01661     w[17] =   0.450612329041864976E-01;
01662     w[18] =   0.928711584442575456E-01;
01663     w[19] =   0.145863292632147353E+00;
01664     w[20] =   0.164880913687436689E+00;
01665     w[21] =   0.579595986101181095E-01;
01666     w[22] =   0.164880913687436689E+00;
01667     w[23] =   0.145863292632147353E+00;
01668     w[24] =   0.928711584442575456E-01;
01669     w[25] =   0.450612329041864976E-01;
01670     w[26] =   0.163616873493832402E-01;
01671     w[27] =   0.139966252291568061E-02;
01672     w[28] =   0.67354758901013295E-02;
01673     w[29] = - 0.38799558623877157E-02;
01674     w[30] =   0.150909333211638847E-02;
01675     w[31] =   0.184789465688357423E-03;
01676     w[32] =   0.286802318064777813E-04;
01677     w[33] =   0.383880761947398577E-05;
01678     w[34] =   0.316018363221289247E-06;
01679     w[35] =   0.148653643571796457E-07;
01680     w[36] =   0.400030575425776948E-09;
01681     w[37] =   0.586915885251734856E-11;
01682     w[38] =   0.421921851448196032E-13;
01683     w[39] =   0.122619614947864357E-15;
01684     w[40] =   0.992619971560149097E-19;
01685     w[41] =   0.87544909871323873E-23;
01686     w[42] =   0.546191947478318097E-37;
01687   }
01688   else {
01689     std::cerr << "\n";
01690     std::cerr << "HERMITE_GENZ_KEISTER_LOOKUP_WEIGHTS - Fatal error!\n";
01691     std::cerr << "  Illegal input value of N.\n";
01692     std::cerr << "  N must be 1, 3, 9, 19, 35, 37, 41 or 43.\n";
01693     std::exit(1);
01694   }
01695   return;
01696 }
01697 
01698 //****************************************************************************
01699 template<class Scalar> 
01700 void IntrepidBurkardtRules::hermite_lookup ( int n, Scalar x[], Scalar w[] )
01701 //****************************************************************************
01702 //
01703 //  Purpose:
01704 //
01705 //    HERMITE_LOOKUP looks up abscissas and weights for Gauss-Hermite quadrature.
01706 //
01707 //  Licensing:
01708 //
01709 //    This code is distributed under the GNU LGPL license.
01710 //
01711 //  Modified:
01712 //
01713 //    27 April 2010
01714 //
01715 //  Author:
01716 //
01717 //    John Burkardt
01718 //
01719 //  Reference:
01720 //
01721 //    Milton Abramowitz, Irene Stegun,
01722 //    Handbook of Mathematical Functions,
01723 //    National Bureau of Standards, 1964,
01724 //    ISBN: 0-486-61272-4,
01725 //    LC: QA47.A34.
01726 //
01727 //    Vladimir Krylov,
01728 //    Approximate Calculation of Integrals,
01729 //    Dover, 2006,
01730 //    ISBN: 0486445798.
01731 //    LC: QA311.K713.
01732 //
01733 //    Arthur Stroud, Don Secrest,
01734 //    Gaussian Quadrature Formulas,
01735 //    Prentice Hall, 1966,
01736 //    LC: QA299.4G3S7.
01737 //
01738 //    Stephen Wolfram,
01739 //    The Mathematica Book,
01740 //    Fourth Edition,
01741 //    Cambridge University Press, 1999,
01742 //    ISBN: 0-521-64314-7,
01743 //    LC: QA76.95.W65.
01744 //
01745 //    Daniel Zwillinger, editor,
01746 //    CRC Standard Mathematical Tables and Formulae,
01747 //    30th Edition,
01748 //    CRC Press, 1996,
01749 //    ISBN: 0-8493-2479-3,
01750 //    LC: QA47.M315.
01751 //
01752 //  Parameters:
01753 //
01754 //    Input, int N, the order.
01755 //    N must be between 1 and 20.
01756 //
01757 //    Output, Scalar X[N], the abscissas.
01758 //
01759 //    Output, Scalar W[N], the weights.
01760 //
01761 {
01762   IntrepidBurkardtRules::hermite_lookup_points ( n, x );
01763   IntrepidBurkardtRules::hermite_lookup_weights ( n, w );
01764 
01765   return;
01766 }
01767 
01768 //****************************************************************************
01769 template<class Scalar> 
01770 void IntrepidBurkardtRules::hermite_lookup_points ( int n, Scalar x[] )
01771 //****************************************************************************
01772 //
01773 //  Purpose:
01774 //
01775 //    HERMITE_LOOKUP_POINTS looks up abscissas for Hermite quadrature.
01776 //
01777 //  Discussion:
01778 //
01779 //    The integral:
01780 //
01781 //      integral ( -oo < x < +oo ) exp ( - x * x ) * f(x) dx
01782 //
01783 //    The quadrature rule:
01784 //
01785 //      sum ( 1 <= i <= n ) w(i) * f ( x(i) ).
01786 //
01787 //    Mathematica can numerically estimate the abscissas
01788 //    of order N to P digits by the command:
01789 //
01790 //      NSolve [ HermiteH [ n, x ] == 0, x, p ]
01791 //
01792 //  Licensing:
01793 //
01794 //    This code is distributed under the GNU LGPL license.
01795 //
01796 //  Modified:
01797 //
01798 //    27 April 2010
01799 //
01800 //  Author:
01801 //
01802 //    John Burkardt
01803 //
01804 //  Reference:
01805 //
01806 //    Milton Abramowitz, Irene Stegun,
01807 //    Handbook of Mathematical Functions,
01808 //    National Bureau of Standards, 1964,
01809 //    ISBN: 0-486-61272-4,
01810 //    LC: QA47.A34.
01811 //
01812 //    Vladimir Krylov,
01813 //    Approximate Calculation of Integrals,
01814 //    Dover, 2006,
01815 //    ISBN: 0486445798,
01816 //    LC: QA311.K713.
01817 //
01818 //    Arthur Stroud, Don Secrest,
01819 //    Gaussian Quadrature Formulas,
01820 //    Prentice Hall, 1966,
01821 //    LC: QA299.4G3S7.
01822 //
01823 //    Stephen Wolfram,
01824 //    The Mathematica Book,
01825 //    Fourth Edition,
01826 //    Cambridge University Press, 1999,
01827 //    ISBN: 0-521-64314-7,
01828 //    LC: QA76.95.W65.
01829 //
01830 //    Daniel Zwillinger, editor,
01831 //    CRC Standard Mathematical Tables and Formulae,
01832 //    30th Edition,
01833 //    CRC Press, 1996,
01834 //    ISBN: 0-8493-2479-3,
01835 //    LC: QA47.M315.
01836 //
01837 //  Parameters:
01838 //
01839 //    Input, int N, the order.
01840 //    N must be between 1 and 20.
01841 //
01842 //    Output, Scalar X[N], the abscissas.
01843 //
01844 {
01845   if (n==1) {
01846     x[ 0] = 0.0;
01847   }
01848   else if(n==2) {
01849     x[ 0] = - 0.707106781186547524400844362105E+00;
01850     x[ 1] =   0.707106781186547524400844362105E+00;
01851   }
01852   else if (n==3) {
01853     x[ 0] = - 0.122474487139158904909864203735E+01;
01854     x[ 1] =   0.0E+00;
01855     x[ 2] =   0.122474487139158904909864203735E+01;
01856   }
01857   else if (n==4) {
01858     x[ 0] = - 0.165068012388578455588334111112E+01;
01859     x[ 1] = - 0.524647623275290317884060253835E+00;
01860     x[ 2] =   0.524647623275290317884060253835E+00;
01861     x[ 3] =   0.165068012388578455588334111112E+01;
01862   }
01863   else if (n==5) {
01864     x[ 0] = - 0.202018287045608563292872408814E+01;
01865     x[ 1] = - 0.958572464613818507112770593893E+00;
01866     x[ 2] =   0.0E+00;
01867     x[ 3] =   0.958572464613818507112770593893E+00;
01868     x[ 4] =   0.202018287045608563292872408814E+01;
01869   }
01870   else if (n==6) {
01871     x[ 0] = - 0.235060497367449222283392198706E+01;
01872     x[ 1] = - 0.133584907401369694971489528297E+01;
01873     x[ 2] = - 0.436077411927616508679215948251E+00;
01874     x[ 3] =   0.436077411927616508679215948251E+00;
01875     x[ 4] =   0.133584907401369694971489528297E+01;
01876     x[ 5] =   0.235060497367449222283392198706E+01;
01877   }
01878   else if (n==7) {
01879     x[ 0] = - 0.265196135683523349244708200652E+01;
01880     x[ 1] = - 0.167355162876747144503180139830E+01;
01881     x[ 2] = - 0.816287882858964663038710959027E+00;
01882     x[ 3] =   0.0E+00;
01883     x[ 4] =   0.816287882858964663038710959027E+00;
01884     x[ 5] =   0.167355162876747144503180139830E+01;
01885     x[ 6] =   0.265196135683523349244708200652E+01;
01886   }
01887   else if (n==8) {
01888     x[ 0] = - 0.293063742025724401922350270524E+01;
01889     x[ 1] = - 0.198165675669584292585463063977E+01;
01890     x[ 2] = - 0.115719371244678019472076577906E+01;
01891     x[ 3] = - 0.381186990207322116854718885584E+00;
01892     x[ 4] =   0.381186990207322116854718885584E+00;
01893     x[ 5] =   0.115719371244678019472076577906E+01;
01894     x[ 6] =   0.198165675669584292585463063977E+01;
01895     x[ 7] =   0.293063742025724401922350270524E+01;
01896   }
01897   else if (n==9) {
01898     x[ 0] = - 0.319099320178152760723004779538E+01;
01899     x[ 1] = - 0.226658058453184311180209693284E+01;
01900     x[ 2] = - 0.146855328921666793166701573925E+01;
01901     x[ 3] = - 0.723551018752837573322639864579E+00;
01902     x[ 4] =   0.0E+00;
01903     x[ 5] =   0.723551018752837573322639864579E+00;
01904     x[ 6] =   0.146855328921666793166701573925E+01;
01905     x[ 7] =   0.226658058453184311180209693284E+01;
01906     x[ 8] =   0.319099320178152760723004779538E+01;
01907   }
01908   else if (n==10) {
01909     x[ 0] =  - 0.343615911883773760332672549432E+01;
01910     x[ 1] =  - 0.253273167423278979640896079775E+01;
01911     x[ 2] =  - 0.175668364929988177345140122011E+01;
01912     x[ 3] =  - 0.103661082978951365417749191676E+01;
01913     x[ 4] =  - 0.342901327223704608789165025557E+00;
01914     x[ 5] =    0.342901327223704608789165025557E+00;
01915     x[ 6] =    0.103661082978951365417749191676E+01;
01916     x[ 7] =    0.175668364929988177345140122011E+01;
01917     x[ 8] =    0.253273167423278979640896079775E+01;
01918     x[ 9] =    0.343615911883773760332672549432E+01;
01919   }
01920   else if (n==11) {
01921     x[ 0] =  - 0.366847084655958251845837146485E+01;
01922     x[ 1] =  - 0.278329009978165177083671870152E+01;
01923     x[ 2] =  - 0.202594801582575533516591283121E+01;
01924     x[ 3] =  - 0.132655708449493285594973473558E+01;
01925     x[ 4] =  - 0.656809566882099765024611575383E+00;
01926     x[ 5] =    0.0E+00;
01927     x[ 6] =    0.656809566882099765024611575383E+00;
01928     x[ 7] =    0.132655708449493285594973473558E+01;
01929     x[ 8] =    0.202594801582575533516591283121E+01;
01930     x[ 9] =    0.278329009978165177083671870152E+01;
01931     x[10] =    0.366847084655958251845837146485E+01;
01932   }
01933   else if (n==12) {
01934     x[ 0] =  - 0.388972489786978191927164274724E+01;
01935     x[ 1] =  - 0.302063702512088977171067937518E+01;
01936     x[ 2] =  - 0.227950708050105990018772856942E+01;
01937     x[ 3] =  - 0.159768263515260479670966277090E+01;
01938     x[ 4] =  - 0.947788391240163743704578131060E+00;
01939     x[ 5] =  - 0.314240376254359111276611634095E+00;
01940     x[ 6] =    0.314240376254359111276611634095E+00;
01941     x[ 7] =    0.947788391240163743704578131060E+00;
01942     x[ 8] =    0.159768263515260479670966277090E+01;
01943     x[ 9] =    0.227950708050105990018772856942E+01;
01944     x[10] =    0.302063702512088977171067937518E+01;
01945     x[11] =    0.388972489786978191927164274724E+01;
01946   }
01947   else if (n==13) {
01948     x[ 0] =  - 0.410133759617863964117891508007E+01;
01949     x[ 1] =  - 0.324660897837240998812205115236E+01;
01950     x[ 2] =  - 0.251973568567823788343040913628E+01;
01951     x[ 3] =  - 0.185310765160151214200350644316E+01;
01952     x[ 4] =  - 0.122005503659074842622205526637E+01;
01953     x[ 5] =  - 0.605763879171060113080537108602E+00;
01954     x[ 6] =    0.0E+00;
01955     x[ 7] =    0.605763879171060113080537108602E+00;
01956     x[ 8] =    0.122005503659074842622205526637E+01;
01957     x[ 9] =    0.185310765160151214200350644316E+01;
01958     x[10] =    0.251973568567823788343040913628E+01;
01959     x[11] =    0.324660897837240998812205115236E+01;
01960     x[12] =    0.410133759617863964117891508007E+01;
01961   }
01962   else if (n==14) {
01963     x[ 0] =  - 0.430444857047363181262129810037E+01;
01964     x[ 1] =  - 0.346265693360227055020891736115E+01;
01965     x[ 2] =  - 0.274847072498540256862499852415E+01;
01966     x[ 3] =  - 0.209518325850771681573497272630E+01;
01967     x[ 4] =  - 0.147668273114114087058350654421E+01;
01968     x[ 5] =  - 0.878713787329399416114679311861E+00;
01969     x[ 6] =  - 0.291745510672562078446113075799E+00;
01970     x[ 7] =    0.291745510672562078446113075799E+00;
01971     x[ 8] =    0.878713787329399416114679311861E+00;
01972     x[ 9] =    0.147668273114114087058350654421E+01;
01973     x[10] =    0.209518325850771681573497272630E+01;
01974     x[11] =    0.274847072498540256862499852415E+01;
01975     x[12] =    0.346265693360227055020891736115E+01;
01976     x[13] =    0.430444857047363181262129810037E+01;
01977   }
01978   else if (n==15) {
01979     x[ 0] =  - 0.449999070730939155366438053053E+01;
01980     x[ 1] =  - 0.366995037340445253472922383312E+01;
01981     x[ 2] =  - 0.296716692790560324848896036355E+01;
01982     x[ 3] =  - 0.232573248617385774545404479449E+01;
01983     x[ 4] =  - 0.171999257518648893241583152515E+01;
01984     x[ 5] =  - 0.113611558521092066631913490556E+01;
01985     x[ 6] =  - 0.565069583255575748526020337198E+00;
01986     x[ 7] =    0.0E+00;
01987     x[ 8] =    0.565069583255575748526020337198E+00;
01988     x[ 9] =    0.113611558521092066631913490556E+01;
01989     x[10] =    0.171999257518648893241583152515E+01;
01990     x[11] =    0.232573248617385774545404479449E+01;
01991     x[12] =    0.296716692790560324848896036355E+01;
01992     x[13] =    0.366995037340445253472922383312E+01;
01993     x[14] =    0.449999070730939155366438053053E+01;
01994   }
01995   else if (n==16) {
01996     x[ 0] =  - 0.468873893930581836468849864875E+01;
01997     x[ 1] =  - 0.386944790486012269871942409801E+01;
01998     x[ 2] =  - 0.317699916197995602681399455926E+01;
01999     x[ 3] =  - 0.254620215784748136215932870545E+01;
02000     x[ 4] =  - 0.195178799091625397743465541496E+01;
02001     x[ 5] =  - 0.138025853919888079637208966969E+01;
02002     x[ 6] =  - 0.822951449144655892582454496734E+00;
02003     x[ 7] =  - 0.273481046138152452158280401965E+00;
02004     x[ 8] =    0.273481046138152452158280401965E+00;
02005     x[ 9] =    0.822951449144655892582454496734E+00;
02006     x[10] =    0.138025853919888079637208966969E+01;
02007     x[11] =    0.195178799091625397743465541496E+01;
02008     x[12] =    0.254620215784748136215932870545E+01;
02009     x[13] =    0.317699916197995602681399455926E+01;
02010     x[14] =    0.386944790486012269871942409801E+01;
02011     x[15] =    0.468873893930581836468849864875E+01;
02012   }
02013   else if (n==17) {
02014     x[ 0] =  - 0.487134519367440308834927655662E+01;
02015     x[ 1] =  - 0.406194667587547430689245559698E+01;
02016     x[ 2] =  - 0.337893209114149408338327069289E+01;
02017     x[ 3] =  - 0.275776291570388873092640349574E+01;
02018     x[ 4] =  - 0.217350282666662081927537907149E+01;
02019     x[ 5] =  - 0.161292431422123133311288254454E+01;
02020     x[ 6] =  - 0.106764872574345055363045773799E+01;
02021     x[ 7] =  - 0.531633001342654731349086553718E+00;
02022     x[ 8] =    0.0E+00;
02023     x[ 9] =    0.531633001342654731349086553718E+00;
02024     x[10] =    0.106764872574345055363045773799E+01;
02025     x[11] =    0.161292431422123133311288254454E+01;
02026     x[12] =    0.217350282666662081927537907149E+01;
02027     x[13] =    0.275776291570388873092640349574E+01;
02028     x[14] =    0.337893209114149408338327069289E+01;
02029     x[15] =    0.406194667587547430689245559698E+01;
02030     x[16] =    0.487134519367440308834927655662E+01;
02031   }
02032   else if (n==18) {
02033     x[ 0] =  - 0.504836400887446676837203757885E+01;
02034     x[ 1] =  - 0.424811787356812646302342016090E+01;
02035     x[ 2] =  - 0.357376906848626607950067599377E+01;
02036     x[ 3] =  - 0.296137750553160684477863254906E+01;
02037     x[ 4] =  - 0.238629908916668600026459301424E+01;
02038     x[ 5] =  - 0.183553160426162889225383944409E+01;
02039     x[ 6] =  - 0.130092085838961736566626555439E+01;
02040     x[ 7] =  - 0.776682919267411661316659462284E+00;
02041     x[ 8] =  - 0.258267750519096759258116098711E+00;
02042     x[ 9] =    0.258267750519096759258116098711E+00;
02043     x[10] =    0.776682919267411661316659462284E+00;
02044     x[11] =    0.130092085838961736566626555439E+01;
02045     x[12] =    0.183553160426162889225383944409E+01;
02046     x[13] =    0.238629908916668600026459301424E+01;
02047     x[14] =    0.296137750553160684477863254906E+01;
02048     x[15] =    0.357376906848626607950067599377E+01;
02049     x[16] =    0.424811787356812646302342016090E+01;
02050     x[17] =    0.504836400887446676837203757885E+01;
02051   }
02052   else if (n==19) {
02053     x[ 0] =  - 0.522027169053748216460967142500E+01;
02054     x[ 1] =  - 0.442853280660377943723498532226E+01;
02055     x[ 2] =  - 0.376218735196402009751489394104E+01;
02056     x[ 3] =  - 0.315784881834760228184318034120E+01;
02057     x[ 4] =  - 0.259113378979454256492128084112E+01;
02058     x[ 5] =  - 0.204923170985061937575050838669E+01;
02059     x[ 6] =  - 0.152417061939353303183354859367E+01;
02060     x[ 7] =  - 0.101036838713431135136859873726E+01;
02061     x[ 8] =  - 0.503520163423888209373811765050E+00;
02062     x[ 9] =    0.0E+00;
02063     x[10] =    0.503520163423888209373811765050E+00;
02064     x[11] =    0.101036838713431135136859873726E+01;
02065     x[12] =    0.152417061939353303183354859367E+01;
02066     x[13] =    0.204923170985061937575050838669E+01;
02067     x[14] =    0.259113378979454256492128084112E+01;
02068     x[15] =    0.315784881834760228184318034120E+01;
02069     x[16] =    0.376218735196402009751489394104E+01;
02070     x[17] =    0.442853280660377943723498532226E+01;
02071     x[18] =    0.522027169053748216460967142500E+01;
02072   }
02073   else if (n==20) {
02074     x[ 0] =  - 0.538748089001123286201690041068E+01;
02075     x[ 1] =  - 0.460368244955074427307767524898E+01;
02076     x[ 2] =  - 0.394476404011562521037562880052E+01;
02077     x[ 3] =  - 0.334785456738321632691492452300E+01;
02078     x[ 4] =  - 0.278880605842813048052503375640E+01;
02079     x[ 5] =  - 0.225497400208927552308233334473E+01;
02080     x[ 6] =  - 0.173853771211658620678086566214E+01;
02081     x[ 7] =  - 0.123407621539532300788581834696E+01;
02082     x[ 8] =  - 0.737473728545394358705605144252E+00;
02083     x[ 9] =  - 0.245340708300901249903836530634E+00;
02084     x[10] =    0.245340708300901249903836530634E+00;
02085     x[11] =    0.737473728545394358705605144252E+00;
02086     x[12] =    0.123407621539532300788581834696E+01;
02087     x[13] =    0.173853771211658620678086566214E+01;
02088     x[14] =    0.225497400208927552308233334473E+01;
02089     x[15] =    0.278880605842813048052503375640E+01;
02090     x[16] =    0.334785456738321632691492452300E+01;
02091     x[17] =    0.394476404011562521037562880052E+01;
02092     x[18] =    0.460368244955074427307767524898E+01;
02093     x[19] =    0.538748089001123286201690041068E+01;
02094   }
02095   else {
02096     std::cerr << "\n";
02097     std::cerr << "HERMITE_LOOKUP_POINTS - Fatal error!\n";
02098     std::cerr << "  Illegal value of N = " << n << "\n";
02099     std::cerr << "  Legal values are 1 through 20.\n";
02100     std::exit(1);
02101   }
02102 
02103   return;
02104 }
02105 
02106 //****************************************************************************
02107 template<class Scalar> 
02108 void IntrepidBurkardtRules::hermite_lookup_weights ( int n, Scalar w[] )
02109 //****************************************************************************
02110 //
02111 //  Purpose:
02112 //
02113 //    HERMITE_LOOKUP_WEIGHTS looks up weights for Hermite quadrature.
02114 //
02115 //  Discussion:
02116 //
02117 //    The integral:
02118 //
02119 //      integral ( -oo < x < +oo ) exp ( - x * x ) * f(x) dx
02120 //
02121 //    The quadrature rule:
02122 //
02123 //      sum ( 1 <= i <= n ) w(i) * f ( x(i) ).
02124 //
02125 //    Mathematica can numerically estimate the abscissas
02126 //    of order N to P digits by the command:
02127 //
02128 //      NSolve [ HermiteH [ n, x ] == 0, x, p ]
02129 //
02130 //  Licensing:
02131 //
02132 //    This code is distributed under the GNU LGPL license.
02133 //
02134 //  Modified:
02135 //
02136 //    27 April 2010
02137 //
02138 //  Author:
02139 //
02140 //    John Burkardt
02141 //
02142 //  Reference:
02143 //
02144 //    Milton Abramowitz, Irene Stegun,
02145 //    Handbook of Mathematical Functions,
02146 //    National Bureau of Standards, 1964,
02147 //    ISBN: 0-486-61272-4,
02148 //    LC: QA47.A34.
02149 //
02150 //    Vladimir Krylov,
02151 //    Approximate Calculation of Integrals,
02152 //    Dover, 2006,
02153 //    ISBN: 0486445798,
02154 //    LC: QA311.K713.
02155 //
02156 //    Arthur Stroud, Don Secrest,
02157 //    Gaussian Quadrature Formulas,
02158 //    Prentice Hall, 1966,
02159 //    LC: QA299.4G3S7.
02160 //
02161 //    Stephen Wolfram,
02162 //    The Mathematica Book,
02163 //    Fourth Edition,
02164 //    Cambridge University Press, 1999,
02165 //    ISBN: 0-521-64314-7,
02166 //    LC: QA76.95.W65.
02167 //
02168 //    Daniel Zwillinger, editor,
02169 //    CRC Standard Mathematical Tables and Formulae,
02170 //    30th Edition,
02171 //    CRC Press, 1996,
02172 //    ISBN: 0-8493-2479-3,
02173 //    LC: QA47.M315.
02174 //
02175 //  Parameters:
02176 //
02177 //    Input, int N, the order.
02178 //    N must be between 1 and 20.
02179 //
02180 //    Output, Scalar W[N], the weights.
02181 //
02182 {
02183   if (n==1) {
02184     w[ 0] = 1.77245385090551602729816748334;
02185   }
02186   else if (n==2) {
02187     w[ 0] = 0.886226925452758013649083741671E+00;
02188     w[ 1] = 0.886226925452758013649083741671E+00;
02189   }
02190   else if (n==3) {
02191     w[ 0] = 0.295408975150919337883027913890E+00;
02192     w[ 1] = 0.118163590060367735153211165556E+01;
02193     w[ 2] = 0.295408975150919337883027913890E+00;
02194   }
02195   else if (n==4) {
02196     w[ 0] = 0.813128354472451771430345571899E-01;
02197     w[ 1] = 0.804914090005512836506049184481E+00;
02198     w[ 2] = 0.804914090005512836506049184481E+00;
02199     w[ 3] = 0.813128354472451771430345571899E-01;
02200   }
02201   else if (n==5) {
02202     w[ 0] = 0.199532420590459132077434585942E-01;
02203     w[ 1] = 0.393619323152241159828495620852E+00;
02204     w[ 2] = 0.945308720482941881225689324449E+00;
02205     w[ 3] = 0.393619323152241159828495620852E+00;
02206     w[ 4] = 0.199532420590459132077434585942E-01;
02207   }
02208   else if (n==6) {
02209     w[ 0] = 0.453000990550884564085747256463E-02;
02210     w[ 1] = 0.157067320322856643916311563508E+00;
02211     w[ 2] = 0.724629595224392524091914705598E+00;
02212     w[ 3] = 0.724629595224392524091914705598E+00;
02213     w[ 4] = 0.157067320322856643916311563508E+00;
02214     w[ 5] = 0.453000990550884564085747256463E-02;
02215   }
02216   else if (n==7) {
02217     w[ 0] = 0.971781245099519154149424255939E-03;
02218     w[ 1] = 0.545155828191270305921785688417E-01;
02219     w[ 2] = 0.425607252610127800520317466666E+00;
02220     w[ 3] = 0.810264617556807326764876563813E+00;
02221     w[ 4] = 0.425607252610127800520317466666E+00;
02222     w[ 5] = 0.545155828191270305921785688417E-01;
02223     w[ 6] = 0.971781245099519154149424255939E-03;
02224   }
02225   else if (n==8) {
02226     w[ 0] = 0.199604072211367619206090452544E-03;
02227     w[ 1] = 0.170779830074134754562030564364E-01;
02228     w[ 2] = 0.207802325814891879543258620286E+00;
02229     w[ 3] = 0.661147012558241291030415974496E+00;
02230     w[ 4] = 0.661147012558241291030415974496E+00;
02231     w[ 5] = 0.207802325814891879543258620286E+00;
02232     w[ 6] = 0.170779830074134754562030564364E-01;
02233     w[ 7] = 0.199604072211367619206090452544E-03;
02234   }
02235   else if (n==9) {
02236     w[ 0] = 0.396069772632643819045862946425E-04;
02237     w[ 1] = 0.494362427553694721722456597763E-02;
02238     w[ 2] = 0.884745273943765732879751147476E-01;
02239     w[ 3] = 0.432651559002555750199812112956E+00;
02240     w[ 4] = 0.720235215606050957124334723389E+00;
02241     w[ 5] = 0.432651559002555750199812112956E+00;
02242     w[ 6] = 0.884745273943765732879751147476E-01;
02243     w[ 7] = 0.494362427553694721722456597763E-02;
02244     w[ 8] = 0.396069772632643819045862946425E-04;
02245   }
02246   else if (n==10) {
02247     w[ 0] =  0.764043285523262062915936785960E-05;
02248     w[ 1] =  0.134364574678123269220156558585E-02;
02249     w[ 2] =  0.338743944554810631361647312776E-01;
02250     w[ 3] =  0.240138611082314686416523295006E+00;
02251     w[ 4] =  0.610862633735325798783564990433E+00;
02252     w[ 5] =  0.610862633735325798783564990433E+00;
02253     w[ 6] =  0.240138611082314686416523295006E+00;
02254     w[ 7] =  0.338743944554810631361647312776E-01;
02255     w[ 8] =  0.134364574678123269220156558585E-02;
02256     w[ 9] =  0.764043285523262062915936785960E-05;
02257   }
02258   else if (n==11) {
02259     w[ 0] =  0.143956039371425822033088366032E-05;
02260     w[ 1] =  0.346819466323345510643413772940E-03;
02261     w[ 2] =  0.119113954449115324503874202916E-01;
02262     w[ 3] =  0.117227875167708503381788649308E+00;
02263     w[ 4] =  0.429359752356125028446073598601E+00;
02264     w[ 5] =  0.654759286914591779203940657627E+00;
02265     w[ 6] =  0.429359752356125028446073598601E+00;
02266     w[ 7] =  0.117227875167708503381788649308E+00;
02267     w[ 8] =  0.119113954449115324503874202916E-01;
02268     w[ 9] =  0.346819466323345510643413772940E-03;
02269     w[10] =  0.143956039371425822033088366032E-05;
02270   }
02271   else if (n==12) {
02272     w[ 0] =  0.265855168435630160602311400877E-06;
02273     w[ 1] =  0.857368704358785865456906323153E-04;
02274     w[ 2] =  0.390539058462906185999438432620E-02;
02275     w[ 3] =  0.516079856158839299918734423606E-01;
02276     w[ 4] =  0.260492310264161129233396139765E+00;
02277     w[ 5] =  0.570135236262479578347113482275E+00;
02278     w[ 6] =  0.570135236262479578347113482275E+00;
02279     w[ 7] =  0.260492310264161129233396139765E+00;
02280     w[ 8] =  0.516079856158839299918734423606E-01;
02281     w[ 9] =  0.390539058462906185999438432620E-02;
02282     w[10] =  0.857368704358785865456906323153E-04;
02283     w[11] =  0.265855168435630160602311400877E-06;
02284   }
02285   else if (n==13) {
02286     w[ 0] =  0.482573185007313108834997332342E-07;
02287     w[ 1] =  0.204303604027070731248669432937E-04;
02288     w[ 2] =  0.120745999271938594730924899224E-02;
02289     w[ 3] =  0.208627752961699392166033805050E-01;
02290     w[ 4] =  0.140323320687023437762792268873E+00;
02291     w[ 5] =  0.421616296898543221746893558568E+00;
02292     w[ 6] =  0.604393187921161642342099068579E+00;
02293     w[ 7] =  0.421616296898543221746893558568E+00;
02294     w[ 8] =  0.140323320687023437762792268873E+00;
02295     w[ 9] =  0.208627752961699392166033805050E-01;
02296     w[10] =  0.120745999271938594730924899224E-02;
02297     w[11] =  0.204303604027070731248669432937E-04;
02298     w[12] =  0.482573185007313108834997332342E-07;
02299   }
02300   else if (n==14) {
02301     w[ 0] =  0.862859116812515794532041783429E-08;
02302     w[ 1] =  0.471648435501891674887688950105E-05;
02303     w[ 2] =  0.355092613551923610483661076691E-03;
02304     w[ 3] =  0.785005472645794431048644334608E-02;
02305     w[ 4] =  0.685055342234652055387163312367E-01;
02306     w[ 5] =  0.273105609064246603352569187026E+00;
02307     w[ 6] =  0.536405909712090149794921296776E+00;
02308     w[ 7] =  0.536405909712090149794921296776E+00;
02309     w[ 8] =  0.273105609064246603352569187026E+00;
02310     w[ 9] =  0.685055342234652055387163312367E-01;
02311     w[10] =  0.785005472645794431048644334608E-02;
02312     w[11] =  0.355092613551923610483661076691E-03;
02313     w[12] =  0.471648435501891674887688950105E-05;
02314     w[13] =  0.862859116812515794532041783429E-08;
02315   }
02316   else if (n==15) {
02317     w[ 0] =  0.152247580425351702016062666965E-08;
02318     w[ 1] =  0.105911554771106663577520791055E-05;
02319     w[ 2] =  0.100004441232499868127296736177E-03;
02320     w[ 3] =  0.277806884291277589607887049229E-02;
02321     w[ 4] =  0.307800338725460822286814158758E-01;
02322     w[ 5] =  0.158488915795935746883839384960E+00;
02323     w[ 6] =  0.412028687498898627025891079568E+00;
02324     w[ 7] =  0.564100308726417532852625797340E+00;
02325     w[ 8] =  0.412028687498898627025891079568E+00;
02326     w[ 9] =  0.158488915795935746883839384960E+00;
02327     w[10] =  0.307800338725460822286814158758E-01;
02328     w[11] =  0.277806884291277589607887049229E-02;
02329     w[12] =  0.100004441232499868127296736177E-03;
02330     w[13] =  0.105911554771106663577520791055E-05;
02331     w[14] =  0.152247580425351702016062666965E-08;
02332   }
02333   else if (n==16) {
02334     w[ 0] =  0.265480747401118224470926366050E-09;
02335     w[ 1] =  0.232098084486521065338749423185E-06;
02336     w[ 2] =  0.271186009253788151201891432244E-04;
02337     w[ 3] =  0.932284008624180529914277305537E-03;
02338     w[ 4] =  0.128803115355099736834642999312E-01;
02339     w[ 5] =  0.838100413989858294154207349001E-01;
02340     w[ 6] =  0.280647458528533675369463335380E+00;
02341     w[ 7] =  0.507929479016613741913517341791E+00;
02342     w[ 8] =  0.507929479016613741913517341791E+00;
02343     w[ 9] =  0.280647458528533675369463335380E+00;
02344     w[10] =  0.838100413989858294154207349001E-01;
02345     w[11] =  0.128803115355099736834642999312E-01;
02346     w[12] =  0.932284008624180529914277305537E-03;
02347     w[13] =  0.271186009253788151201891432244E-04;
02348     w[14] =  0.232098084486521065338749423185E-06;
02349     w[15] =  0.265480747401118224470926366050E-09;
02350   }
02351   else if (n==17) {
02352     w[ 0] =  0.458057893079863330580889281222E-10;
02353     w[ 1] =  0.497707898163079405227863353715E-07;
02354     w[ 2] =  0.711228914002130958353327376218E-05;
02355     w[ 3] =  0.298643286697753041151336643059E-03;
02356     w[ 4] =  0.506734995762753791170069495879E-02;
02357     w[ 5] =  0.409200341495762798094994877854E-01;
02358     w[ 6] =  0.172648297670097079217645196219E+00;
02359     w[ 7] =  0.401826469470411956577635085257E+00;
02360     w[ 8] =  0.530917937624863560331883103379E+00;
02361     w[ 9] =  0.401826469470411956577635085257E+00;
02362     w[10] =  0.172648297670097079217645196219E+00;
02363     w[11] =  0.409200341495762798094994877854E-01;
02364     w[12] =  0.506734995762753791170069495879E-02;
02365     w[13] =  0.298643286697753041151336643059E-03;
02366     w[14] =  0.711228914002130958353327376218E-05;
02367     w[15] =  0.497707898163079405227863353715E-07;
02368     w[16] =  0.458057893079863330580889281222E-10;
02369   }
02370   else if (n==18) {
02371     w[ 0] =  0.782819977211589102925147471012E-11;
02372     w[ 1] =  0.104672057957920824443559608435E-07;
02373     w[ 2] =  0.181065448109343040959702385911E-05;
02374     w[ 3] =  0.918112686792940352914675407371E-04;
02375     w[ 4] =  0.188852263026841789438175325426E-02;
02376     w[ 5] =  0.186400423875446519219315221973E-01;
02377     w[ 6] =  0.973017476413154293308537234155E-01;
02378     w[ 7] =  0.284807285669979578595606820713E+00;
02379     w[ 8] =  0.483495694725455552876410522141E+00;
02380     w[ 9] =  0.483495694725455552876410522141E+00;
02381     w[10] =  0.284807285669979578595606820713E+00;
02382     w[11] =  0.973017476413154293308537234155E-01;
02383     w[12] =  0.186400423875446519219315221973E-01;
02384     w[13] =  0.188852263026841789438175325426E-02;
02385     w[14] =  0.918112686792940352914675407371E-04;
02386     w[15] =  0.181065448109343040959702385911E-05;
02387     w[16] =  0.104672057957920824443559608435E-07;
02388     w[17] =  0.782819977211589102925147471012E-11;
02389   }
02390   else if (n==19) {
02391     w[ 0] =  0.132629709449851575185289154385E-11;
02392     w[ 1] =  0.216305100986355475019693077221E-08;
02393     w[ 2] =  0.448824314722312295179447915594E-06;
02394     w[ 3] =  0.272091977631616257711941025214E-04;
02395     w[ 4] =  0.670877521407181106194696282100E-03;
02396     w[ 5] =  0.798886677772299020922211491861E-02;
02397     w[ 6] =  0.508103869090520673569908110358E-01;
02398     w[ 7] =  0.183632701306997074156148485766E+00;
02399     w[ 8] =  0.391608988613030244504042313621E+00;
02400     w[ 9] =  0.502974888276186530840731361096E+00;
02401     w[10] =  0.391608988613030244504042313621E+00;
02402     w[11] =  0.183632701306997074156148485766E+00;
02403     w[12] =  0.508103869090520673569908110358E-01;
02404     w[13] =  0.798886677772299020922211491861E-02;
02405     w[14] =  0.670877521407181106194696282100E-03;
02406     w[15] =  0.272091977631616257711941025214E-04;
02407     w[16] =  0.448824314722312295179447915594E-06;
02408     w[17] =  0.216305100986355475019693077221E-08;
02409     w[18] =  0.132629709449851575185289154385E-11;
02410   }
02411   else if (n==20) {
02412     w[ 0] =  0.222939364553415129252250061603E-12;
02413     w[ 1] =  0.439934099227318055362885145547E-09;
02414     w[ 2] =  0.108606937076928169399952456345E-06;
02415     w[ 3] =  0.780255647853206369414599199965E-05;
02416     w[ 4] =  0.228338636016353967257145917963E-03;
02417     w[ 5] =  0.324377334223786183218324713235E-02;
02418     w[ 6] =  0.248105208874636108821649525589E-01;
02419     w[ 7] =  0.109017206020023320013755033535E+00;
02420     w[ 8] =  0.286675505362834129719659706228E+00;
02421     w[ 9] =  0.462243669600610089650328639861E+00;
02422     w[10] =  0.462243669600610089650328639861E+00;
02423     w[11] =  0.286675505362834129719659706228E+00;
02424     w[12] =  0.109017206020023320013755033535E+00;
02425     w[13] =  0.248105208874636108821649525589E-01;
02426     w[14] =  0.324377334223786183218324713235E-02;
02427     w[15] =  0.228338636016353967257145917963E-03;
02428     w[16] =  0.780255647853206369414599199965E-05;
02429     w[17] =  0.108606937076928169399952456345E-06;
02430     w[18] =  0.439934099227318055362885145547E-09;
02431     w[19] =  0.222939364553415129252250061603E-12;
02432   }
02433   else {
02434     std::cerr << "\n";
02435     std::cerr << "HERMITE_LOOKUP_WEIGHTS - Fatal error!\n";
02436     std::cerr << "  Illegal value of N = " << n << "\n";
02437     std::cerr << "  Legal values are 1 through 20.\n";
02438     std::exit(1);
02439   }
02440 
02441   return;
02442 }
02443 
02444 //****************************************************************************
02445 template<class Scalar> 
02446 void IntrepidBurkardtRules::imtqlx ( int n, Scalar d[], Scalar e[], Scalar z[] )
02447 //****************************************************************************
02448 //
02449 //  Purpose:
02450 //
02451 //    IMTQLX diagonalizes a symmetric tridiagonal matrix.
02452 //
02453 //  Discussion:
02454 //
02455 //    This routine is a slightly modified version of the EISPACK routine to 
02456 //    perform the implicit QL algorithm on a symmetric tridiagonal matrix. 
02457 //
02458 //    The authors thank the authors of EISPACK for permission to use this
02459 //    routine. 
02460 //
02461 //    It has been modified to produce the product Q' * Z, where Z is an input 
02462 //    vector and Q is the orthogonal matrix diagonalizing the input matrix.  
02463 //    The changes consist (essentially) of applying the orthogonal transformations
02464 //    directly to Z as they are generated.
02465 //
02466 //  Licensing:
02467 //
02468 //    This code is distributed under the GNU LGPL license. 
02469 //
02470 //  Modified:
02471 //
02472 //    08 January 2010
02473 //
02474 //  Author:
02475 //
02476 //    Original FORTRAN77 version by Sylvan Elhay, Jaroslav Kautsky.
02477 //    C++ version by John Burkardt.
02478 //
02479 //  Reference:
02480 //
02481 //    Sylvan Elhay, Jaroslav Kautsky,
02482 //    Algorithm 655: IQPACK, FORTRAN Subroutines for the Weights of 
02483 //    Interpolatory Quadrature,
02484 //    ACM Transactions on Mathematical Software,
02485 //    Volume 13, Number 4, December 1987, pages 399-415.
02486 //
02487 //    Roger Martin, James Wilkinson,
02488 //    The Implicit QL Algorithm,
02489 //    Numerische Mathematik,
02490 //    Volume 12, Number 5, December 1968, pages 377-383.
02491 //
02492 //  Parameters:
02493 //
02494 //    Input, int N, the order of the matrix.
02495 //
02496 //    Input/output, Scalar D(N), the diagonal entries of the matrix.
02497 //    On output, the information in D has been overwritten.
02498 //
02499 //    Input/output, Scalar E(N), the subdiagonal entries of the 
02500 //    matrix, in entries E(1) through E(N-1).  On output, the information in
02501 //    E has been overwritten.
02502 //
02503 //    Input/output, Scalar Z(N).  On input, a vector.  On output,
02504 //    the value of Q' * Z, where Q is the matrix that diagonalizes the
02505 //    input symmetric tridiagonal matrix.
02506 //
02507 {
02508   Scalar b = 0, c = 0, f = 0, g = 0, p = 0, r = 0, s = 0;
02509   int i = 0, ii = 0, j = 0, k = 0, l = 0, mml = 0, m = 0, itn = 30;
02510   Scalar prec = IntrepidBurkardtRules::r8_epsilon(1.0); //2.22E-16;
02511 
02512   if (n==1) {
02513     return;
02514   }
02515 
02516   e[n-1] = 0.0;
02517 
02518   for (l=1;l<=n;l++) {
02519     j = 0;
02520     for ( ; ; ) {
02521       for (m=l;m<=n;m++) {
02522         if (m==n) {
02523           break;
02524         }
02525         if (std::abs(e[m-1])<=prec*(std::abs(d[m-1])+std::abs(d[m]))) {
02526           break;
02527         }
02528       }
02529       p = d[l-1];
02530       if (m==l) {
02531         break;
02532       }
02533       if (itn<=j) {
02534         std::cerr << "\n";
02535         std::cerr << "IMTQLX - Fatal error!\n";
02536         std::cerr << "  Iteration limit exceeded\n";
02537         std::exit(1);
02538       }
02539       j   = j+1;
02540       g   = (d[l]-p)/(2.0*e[l-1]);
02541       r   = std::sqrt(g*g+1.0);
02542       g   = d[m-1]-p+e[l-1]/(g+std::abs(r)*IntrepidBurkardtRules::r8_sign(g));
02543       s   = 1.0;
02544       c   = 1.0;
02545       p   = 0.0;
02546       mml = m-l;
02547 
02548       for (ii=1;ii<=mml;ii++) {
02549         i = m-ii;
02550         f = s*e[i-1];
02551         b = c*e[i-1];
02552 
02553         if (std::abs(g)<=std::abs(f)) {
02554           c    = g/f;
02555           r    = std::sqrt(c*c+1.0);
02556           e[i] = f*r;
02557           s    = 1.0/r;
02558           c    = c*s;
02559         }
02560         else {
02561           s    = f/g;
02562           r    = std::sqrt(s*s+1.0);
02563           e[i] = g*r;
02564           c    = 1.0/r;
02565           s    = s*c;
02566         }
02567         g      = d[i]-p;
02568         r      = (d[i-1]-g)*s+2.0*c*b;
02569         p      = s*r;
02570         d[i]   = g+p;
02571         g      = c*r-b;
02572         f      = z[i];
02573         z[i]   = s*z[i-1]+c*f;
02574         z[i-1] = c*z[i-1]-s*f;
02575       }
02576       d[l-1] = d[l-1]-p;
02577       e[l-1] = g;
02578       e[m-1] = 0.0;
02579     }
02580   }
02581 //
02582 //  Sorting.
02583 //
02584   for (ii=2;ii<=m;ii++) {
02585     i = ii-1;
02586     k = i;
02587     p = d[i-1];
02588 
02589     for (j=ii;j<=n;j++) {
02590       if (d[j-1]<p) {
02591          k = j;
02592          p = d[j-1];
02593       }
02594     }
02595 
02596     if (k!=i) {
02597       d[k-1] = d[i-1];
02598       d[i-1] = p;
02599       p      = z[i-1];
02600       z[i-1] = z[k-1];
02601       z[k-1] = p;
02602     }
02603   }
02604   return;
02605 }
02606 
02607 //****************************************************************************
02608 template<class Scalar> 
02609 void IntrepidBurkardtRules::laguerre_compute ( int n, Scalar x[], Scalar w[] )
02610 //****************************************************************************
02611 //
02612 //  Purpose:
02613 //
02614 //    LAGUERRE_COMPUTE: Laguerre quadrature rule by the Elhay-Kautsky method.
02615 //
02616 //  Licensing:
02617 //
02618 //    This code is distributed under the GNU LGPL license.
02619 //
02620 //  Modified:
02621 //
02622 //    23 April 2011
02623 //
02624 //  Author:
02625 //
02626 //    Original FORTRAN77 version by Sylvan Elhay, Jaroslav Kautsky.
02627 //    C++ version by John Burkardt.
02628 //
02629 //  Reference:
02630 //
02631 //    Sylvan Elhay, Jaroslav Kautsky,
02632 //    Algorithm 655: IQPACK, FORTRAN Subroutines for the Weights of
02633 //    Interpolatory Quadrature,
02634 //    ACM Transactions on Mathematical Software,
02635 //    Volume 13, Number 4, December 1987, pages 399-415.
02636 //
02637 //  Parameters:
02638 //
02639 //    Input, int N, the order.
02640 //
02641 //    Output, Scalar X[N], the abscissas.
02642 //
02643 //    Output, Scalar W[N], the weights.
02644 //
02645 {
02646   Scalar *bj;
02647   int i;
02648   Scalar zemu;
02649 //
02650 //  Define the zero-th moment.
02651 //
02652   zemu = 1.0;
02653 //
02654 //  Define the Jacobi matrix.
02655 //
02656   bj = new Scalar[n];
02657 
02658   for (i=0;i<n;i++) {
02659     bj[i] = (Scalar)(i+1);
02660   }
02661 
02662   for (i=0;i<n;i++) {
02663     x[i] = (Scalar)(2*i+1);
02664   }
02665 
02666   w[0] = std::sqrt(zemu);
02667 
02668   for (i=1;i<n;i++) {
02669     w[i] = 0.0;
02670   }
02671 //
02672 //  Diagonalize the Jacobi matrix.
02673 //
02674   IntrepidBurkardtRules::imtqlx(n,x,bj,w);
02675 
02676   for (i=0;i<n;i++) {
02677     w[i] = w[i]*w[i];
02678   }
02679 
02680   delete [] bj;
02681 
02682   return;
02683 }
02684 
02685 //****************************************************************************
02686 template<class Scalar> 
02687 void IntrepidBurkardtRules::laguerre_compute_points ( int order, Scalar x[] )
02688 //****************************************************************************
02689 //
02690 //  Purpose:
02691 //
02692 //    LAGUERRE_COMPUTE_POINTS computes Laguerre quadrature points.
02693 //
02694 //  Licensing:
02695 //
02696 //    This code is distributed under the GNU LGPL license.
02697 //
02698 //  Modified:
02699 //
02700 //    13 June 2009
02701 //
02702 //  Author:
02703 //
02704 //    John Burkardt
02705 //
02706 //  Parameters:
02707 //
02708 //    Input, int ORDER, the order.
02709 //
02710 //    Output, Scalar X[ORDER], the abscissas.
02711 //
02712 {
02713   Scalar *w; w = new Scalar[order];
02714   IntrepidBurkardtRules::laguerre_compute ( order, x, w );
02715   delete [] w;
02716 
02717   return;
02718 }
02719 
02720 //****************************************************************************
02721 template<class Scalar> 
02722 void IntrepidBurkardtRules::laguerre_compute_weights ( int order, Scalar w[] )
02723 //****************************************************************************
02724 //
02725 //  Purpose:
02726 //
02727 //    LAGUERRE_COMPUTE_WEIGHTS computes Laguerre quadrature weights.
02728 //
02729 //  Licensing:
02730 //
02731 //    This code is distributed under the GNU LGPL license.
02732 //
02733 //  Modified:
02734 //
02735 //    13 June 2009
02736 //
02737 //  Author:
02738 //
02739 //    John Burkardt
02740 //
02741 //  Parameters:
02742 //
02743 //    Input, int ORDER, the order.
02744 //
02745 //    Output, Scalar W[ORDER], the weights.
02746 //
02747 {
02748   Scalar *x; x = new Scalar[order];
02749   IntrepidBurkardtRules::laguerre_compute ( order, x, w );
02750   delete [] x;
02751 
02752   return;
02753 }
02754 
02755 //****************************************************************************
02756 template<class Scalar> 
02757 void IntrepidBurkardtRules::laguerre_lookup ( int n, Scalar x[], Scalar w[] )
02758 //****************************************************************************
02759 //
02760 //  Purpose:
02761 //
02762 //    LAGUERRE_LOOKUP looks up abscissas and weights for Laguerre quadrature.
02763 //
02764 //  Discussion:
02765 //
02766 //    The abscissas are the zeroes of the Laguerre polynomial L(N)(X).
02767 //
02768 //    The integral:
02769 //
02770 //      Integral ( 0 <= X < +oo ) exp ( -X ) * F(X) dX
02771 //
02772 //    The quadrature rule:
02773 //
02774 //      Sum ( 1 <= I <= N ) W(I) * f ( X(I) )
02775 //
02776 //    The integral:
02777 //
02778 //      Integral ( 0 <= X < +oo ) F(X) dX
02779 //
02780 //    The quadrature rule:
02781 //
02782 //      Sum ( 1 <= I <= N ) W(I) * exp ( X(I) ) * f ( X(I) )
02783 //
02784 //    Mathematica can numerically estimate the abscissas for the
02785 //    n-th order polynomial to p digits of precision by the command:
02786 //
02787 //      NSolve [ LaguerreL[n,x] == 0, x, p ]
02788 //
02789 //  Licensing:
02790 //
02791 //    This code is distributed under the GNU LGPL license.
02792 //
02793 //  Modified:
02794 //
02795 //    27 April 2010
02796 //
02797 //  Author:
02798 //
02799 //    John Burkardt
02800 //
02801 //  Reference:
02802 //
02803 //    Milton Abramowitz, Irene Stegun,
02804 //    Handbook of Mathematical Functions,
02805 //    National Bureau of Standards, 1964,
02806 //    ISBN: 0-486-61272-4,
02807 //    LC: QA47.A34.
02808 //
02809 //    Vladimir Krylov,
02810 //    Approximate Calculation of Integrals,
02811 //    Dover, 2006,
02812 //    ISBN: 0486445798,
02813 //    LC: QA311.K713.
02814 //
02815 //    Arthur Stroud, Don Secrest,
02816 //    Gaussian Quadrature Formulas,
02817 //    Prentice Hall, 1966,
02818 //    LC: QA299.4G3S7.
02819 //
02820 //    Stephen Wolfram,
02821 //    The Mathematica Book,
02822 //    Fourth Edition,
02823 //    Cambridge University Press, 1999,
02824 //    ISBN: 0-521-64314-7,
02825 //    LC: QA76.95.W65.
02826 //
02827 //    Daniel Zwillinger, editor,
02828 //    CRC Standard Mathematical Tables and Formulae,
02829 //    30th Edition,
02830 //    CRC Press, 1996,
02831 //    ISBN: 0-8493-2479-3.
02832 //
02833 //  Parameters:
02834 //
02835 //    Input, int N, the order.
02836 //    N must be between 1 and 20.
02837 //
02838 //    Output, Scalar X[N], the abscissas.
02839 //
02840 //    Output, Scalar W[N], the weights.
02841 //
02842 {
02843   IntrepidBurkardtRules::laguerre_lookup_points ( n, x );
02844   IntrepidBurkardtRules::laguerre_lookup_weights ( n, w );
02845 
02846   return;
02847 }
02848 
02849 //****************************************************************************
02850 template<class Scalar> 
02851 void IntrepidBurkardtRules::laguerre_lookup_points ( int n, Scalar x[] )
02852 //****************************************************************************
02853 //
02854 //  Purpose:
02855 //
02856 //    LAGUERRE_LOOKUP_POINTS looks up abscissas for Laguerre quadrature.
02857 //
02858 //  Licensing:
02859 //
02860 //    This code is distributed under the GNU LGPL license.
02861 //
02862 //  Modified:
02863 //
02864 //    27 April 2010
02865 //
02866 //  Author:
02867 //
02868 //    John Burkardt
02869 //
02870 //  Reference:
02871 //
02872 //    Milton Abramowitz, Irene Stegun,
02873 //    Handbook of Mathematical Functions,
02874 //    National Bureau of Standards, 1964,
02875 //    ISBN: 0-486-61272-4,
02876 //    LC: QA47.A34.
02877 //
02878 //    Vladimir Krylov,
02879 //    Approximate Calculation of Integrals,
02880 //    Dover, 2006,
02881 //    ISBN: 0486445798,
02882 //    LC: QA311.K713.
02883 //
02884 //    Arthur Stroud, Don Secrest,
02885 //    Gaussian Quadrature Formulas,
02886 //    Prentice Hall, 1966,
02887 //    LC: QA299.4G3S7.
02888 //
02889 //    Stephen Wolfram,
02890 //    The Mathematica Book,
02891 //    Fourth Edition,
02892 //    Cambridge University Press, 1999,
02893 //    ISBN: 0-521-64314-7,
02894 //    LC: QA76.95.W65.
02895 //
02896 //    Daniel Zwillinger, editor,
02897 //    CRC Standard Mathematical Tables and Formulae,
02898 //    30th Edition,
02899 //    CRC Press, 1996,
02900 //    ISBN: 0-8493-2479-3.
02901 //
02902 //  Parameters:
02903 //
02904 //    Input, int N, the order.
02905 //    N must be between 1 and 20.
02906 //
02907 //    Output, Scalar X[N], the abscissas.
02908 //
02909 {
02910   if (n==1) {
02911     x[ 0] =  1.00000000000000000000000000000E+00;
02912   }
02913   else if (n==2) {
02914     x[ 0] = 0.585786437626904951198311275790E+00;
02915     x[ 1] = 3.41421356237309504880168872421E+00;
02916   }
02917   else if (n==3) {
02918     x[ 0] = 0.415774556783479083311533873128E+00;
02919     x[ 1] = 2.29428036027904171982205036136E+00;
02920     x[ 2] = 6.28994508293747919686641576551E+00;
02921   }
02922   else if (n==4) {
02923     x[ 0] = 0.322547689619392311800361459104E+00;
02924     x[ 1] = 1.74576110115834657568681671252E+00;
02925     x[ 2] = 4.53662029692112798327928538496E+00;
02926     x[ 3] = 9.39507091230113312923353644342E+00;
02927   }
02928   else if (n==5) {
02929     x[ 0] = 0.263560319718140910203061943361E+00;
02930     x[ 1] = 1.41340305910651679221840798019E+00;
02931     x[ 2] = 3.59642577104072208122318658878E+00;
02932     x[ 3] = 7.08581000585883755692212418111E+00;
02933     x[ 4] = 12.6408008442757826594332193066E+00;
02934   }
02935   else if (n==6) {
02936     x[ 0] = 0.222846604179260689464354826787E+00;
02937     x[ 1] = 1.18893210167262303074315092194E+00;
02938     x[ 2] = 2.99273632605931407769132528451E+00;
02939     x[ 3] = 5.77514356910451050183983036943E+00;
02940     x[ 4] = 9.83746741838258991771554702994E+00;
02941     x[ 5] = 15.9828739806017017825457915674E+00;
02942   }
02943   else if (n==7) {
02944     x[ 0] = 0.193043676560362413838247885004E+00;
02945     x[ 1] = 1.02666489533919195034519944317E+00;
02946     x[ 2] = 2.56787674495074620690778622666E+00;
02947     x[ 3] = 4.90035308452648456810171437810E+00;
02948     x[ 4] = 8.18215344456286079108182755123E+00;
02949     x[ 5] = 12.7341802917978137580126424582E+00;
02950     x[ 6] = 19.3957278622625403117125820576E+00;
02951   }
02952   else if (n==8) {
02953     x[ 0] = 0.170279632305100999788861856608E+00;
02954     x[ 1] = 0.903701776799379912186020223555E+00;
02955     x[ 2] = 2.25108662986613068930711836697E+00;
02956     x[ 3] = 4.26670017028765879364942182690E+00;
02957     x[ 4] = 7.04590540239346569727932548212E+00;
02958     x[ 5] = 10.7585160101809952240599567880E+00;
02959     x[ 6] = 15.7406786412780045780287611584E+00;
02960     x[ 7] = 22.8631317368892641057005342974E+00;
02961   }
02962   else if (n==9) {
02963     x[ 0] = 0.152322227731808247428107073127E+00;
02964     x[ 1] = 0.807220022742255847741419210952E+00;
02965     x[ 2] = 2.00513515561934712298303324701E+00;
02966     x[ 3] = 3.78347397333123299167540609364E+00;
02967     x[ 4] = 6.20495677787661260697353521006E+00;
02968     x[ 5] = 9.37298525168757620180971073215E+00;
02969     x[ 6] = 13.4662369110920935710978818397E+00;
02970     x[ 7] = 18.8335977889916966141498992996E+00;
02971     x[ 8] = 26.3740718909273767961410072937E+00;
02972   }
02973   else if (n==10) {
02974     x[ 0] = 0.137793470540492430830772505653E+00;
02975     x[ 1] = 0.729454549503170498160373121676E+00;
02976     x[ 2] = 1.80834290174031604823292007575E+00;
02977     x[ 3] = 3.40143369785489951448253222141E+00;
02978     x[ 4] = 5.55249614006380363241755848687E+00;
02979     x[ 5] = 8.33015274676449670023876719727E+00;
02980     x[ 6] = 11.8437858379000655649185389191E+00;
02981     x[ 7] = 16.2792578313781020995326539358E+00;
02982     x[ 8] = 21.9965858119807619512770901956E+00;
02983     x[ 9] = 29.9206970122738915599087933408E+00;
02984   }
02985   else if (n==11) {
02986     x[ 0] = 0.125796442187967522675794577516E+00;
02987     x[ 1] = 0.665418255839227841678127839420E+00;
02988     x[ 2] = 1.64715054587216930958700321365E+00;
02989     x[ 3] = 3.09113814303525495330195934259E+00;
02990     x[ 4] = 5.02928440157983321236999508366E+00;
02991     x[ 5] = 7.50988786380661681941099714450E+00;
02992     x[ 6] = 10.6059509995469677805559216457E+00;
02993     x[ 7] = 14.4316137580641855353200450349E+00;
02994     x[ 8] = 19.1788574032146786478174853989E+00;
02995     x[ 9] = 25.2177093396775611040909447797E+00;
02996     x[10] = 33.4971928471755372731917259395E+00;
02997   }
02998   else if (n==12) {
02999     x[ 0] = 0.115722117358020675267196428240E+00;
03000     x[ 1] = 0.611757484515130665391630053042E+00;
03001     x[ 2] = 1.51261026977641878678173792687E+00;
03002     x[ 3] = 2.83375133774350722862747177657E+00;
03003     x[ 4] = 4.59922763941834848460572922485E+00;
03004     x[ 5] = 6.84452545311517734775433041849E+00;
03005     x[ 6] = 9.62131684245686704391238234923E+00;
03006     x[ 7] = 13.0060549933063477203460524294E+00;
03007     x[ 8] = 17.1168551874622557281840528008E+00;
03008     x[ 9] = 22.1510903793970056699218950837E+00;
03009     x[10] = 28.4879672509840003125686072325E+00;
03010     x[11] = 37.0991210444669203366389142764E+00;
03011   }
03012   else if (n==13) {
03013     x[ 0] = 0.107142388472252310648493376977E+00;
03014     x[ 1] = 0.566131899040401853406036347177E+00;
03015     x[ 2] = 1.39856433645101971792750259921E+00;
03016     x[ 3] = 2.61659710840641129808364008472E+00;
03017     x[ 4] = 4.23884592901703327937303389926E+00;
03018     x[ 5] = 6.29225627114007378039376523025E+00;
03019     x[ 6] = 8.81500194118697804733348868036E+00;
03020     x[ 7] = 11.8614035888112425762212021880E+00;
03021     x[ 8] = 15.5107620377037527818478532958E+00;
03022     x[ 9] = 19.8846356638802283332036594634E+00;
03023     x[10] = 25.1852638646777580842970297823E+00;
03024     x[11] = 31.8003863019472683713663283526E+00;
03025     x[12] = 40.7230086692655795658979667001E+00;
03026   }
03027   else if (n==14) {
03028     x[ 0] = 0.0997475070325975745736829452514E+00;
03029     x[ 1] = 0.526857648851902896404583451502E+00;
03030     x[ 2] = 1.30062912125149648170842022116E+00;
03031     x[ 3] = 2.43080107873084463616999751038E+00;
03032     x[ 4] = 3.93210282229321888213134366778E+00;
03033     x[ 5] = 5.82553621830170841933899983898E+00;
03034     x[ 6] = 8.14024014156514503005978046052E+00;
03035     x[ 7] = 10.9164995073660188408130510904E+00;
03036     x[ 8] = 14.2108050111612886831059780825E+00;
03037     x[ 9] = 18.1048922202180984125546272083E+00;
03038     x[10] = 22.7233816282696248232280886985E+00;
03039     x[11] = 28.2729817232482056954158923218E+00;
03040     x[12] = 35.1494436605924265828643121364E+00;
03041     x[13] = 44.3660817111174230416312423666E+00;
03042   }
03043   else if (n==15) {
03044     x[ 0] = 0.0933078120172818047629030383672E+00;
03045     x[ 1] = 0.492691740301883908960101791412E+00;
03046     x[ 2] = 1.21559541207094946372992716488E+00;
03047     x[ 3] = 2.26994952620374320247421741375E+00;
03048     x[ 4] = 3.66762272175143727724905959436E+00;
03049     x[ 5] = 5.42533662741355316534358132596E+00;
03050     x[ 6] = 7.56591622661306786049739555812E+00;
03051     x[ 7] = 10.1202285680191127347927394568E+00;
03052     x[ 8] = 13.1302824821757235640991204176E+00;
03053     x[ 9] = 16.6544077083299578225202408430E+00;
03054     x[10] = 20.7764788994487667729157175676E+00;
03055     x[11] = 25.6238942267287801445868285977E+00;
03056     x[12] = 31.4075191697539385152432196202E+00;
03057     x[13] = 38.5306833064860094162515167595E+00;
03058     x[14] = 48.0260855726857943465734308508E+00;
03059   }
03060   else if (n==16) {
03061     x[ 0] = 0.0876494104789278403601980973401E+00;
03062     x[ 1] = 0.462696328915080831880838260664E+00;
03063     x[ 2] = 1.14105777483122685687794501811E+00;
03064     x[ 3] = 2.12928364509838061632615907066E+00;
03065     x[ 4] = 3.43708663389320664523510701675E+00;
03066     x[ 5] = 5.07801861454976791292305830814E+00;
03067     x[ 6] = 7.07033853504823413039598947080E+00;
03068     x[ 7] = 9.43831433639193878394724672911E+00;
03069     x[ 8] = 12.2142233688661587369391246088E+00;
03070     x[ 9] = 15.4415273687816170767647741622E+00;
03071     x[10] = 19.1801568567531348546631409497E+00;
03072     x[11] = 23.5159056939919085318231872752E+00;
03073     x[12] = 28.5787297428821403675206137099E+00;
03074     x[13] = 34.5833987022866258145276871778E+00;
03075     x[14] = 41.9404526476883326354722330252E+00;
03076     x[15] = 51.7011603395433183643426971197E+00;
03077   }
03078   else if (n==17) {
03079     x[ 0] = 0.0826382147089476690543986151980E+00;
03080     x[ 1] = 0.436150323558710436375959029847E+00;
03081     x[ 2] = 1.07517657751142857732980316755E+00;
03082     x[ 3] = 2.00519353164923224070293371933E+00;
03083     x[ 4] = 3.23425612404744376157380120696E+00;
03084     x[ 5] = 4.77351351370019726480932076262E+00;
03085     x[ 6] = 6.63782920536495266541643929703E+00;
03086     x[ 7] = 8.84668551116980005369470571184E+00;
03087     x[ 8] = 11.4255293193733525869726151469E+00;
03088     x[ 9] = 14.4078230374813180021982874959E+00;
03089     x[10] = 17.8382847307011409290658752412E+00;
03090     x[11] = 21.7782682577222653261749080522E+00;
03091     x[12] = 26.3153178112487997766149598369E+00;
03092     x[13] = 31.5817716804567331343908517497E+00;
03093     x[14] = 37.7960938374771007286092846663E+00;
03094     x[15] = 45.3757165339889661829258363215E+00;
03095     x[16] = 55.3897517898396106640900199790E+00;
03096   }
03097   else if (n==18) {
03098     x[ 0] = 0.0781691666697054712986747615334E+00;
03099     x[ 1] = 0.412490085259129291039101536536E+00;
03100     x[ 2] = 1.01652017962353968919093686187E+00;
03101     x[ 3] = 1.89488850996976091426727831954E+00;
03102     x[ 4] = 3.05435311320265975115241130719E+00;
03103     x[ 5] = 4.50420553888989282633795571455E+00;
03104     x[ 6] = 6.25672507394911145274209116326E+00;
03105     x[ 7] = 8.32782515660563002170470261564E+00;
03106     x[ 8] = 10.7379900477576093352179033397E+00;
03107     x[ 9] = 13.5136562075550898190863812108E+00;
03108     x[10] = 16.6893062819301059378183984163E+00;
03109     x[11] = 20.3107676262677428561313764553E+00;
03110     x[12] = 24.4406813592837027656442257980E+00;
03111     x[13] = 29.1682086625796161312980677805E+00;
03112     x[14] = 34.6279270656601721454012429438E+00;
03113     x[15] = 41.0418167728087581392948614284E+00;
03114     x[16] = 48.8339227160865227486586093290E+00;
03115     x[17] = 59.0905464359012507037157810181E+00;
03116   }
03117   else if (n==19) {
03118     x[ 0] = 0.0741587837572050877131369916024E+00;
03119     x[ 1] = 0.391268613319994607337648350299E+00;
03120     x[ 2] = 0.963957343997958058624878377130E+00;
03121     x[ 3] = 1.79617558206832812557725825252E+00;
03122     x[ 4] = 2.89365138187378399116494713237E+00;
03123     x[ 5] = 4.26421553962776647436040018167E+00;
03124     x[ 6] = 5.91814156164404855815360191408E+00;
03125     x[ 7] = 7.86861891533473373105668358176E+00;
03126     x[ 8] = 10.1324237168152659251627415800E+00;
03127     x[ 9] = 12.7308814638423980045092979656E+00;
03128     x[10] = 15.6912783398358885454136069861E+00;
03129     x[11] = 19.0489932098235501532136429732E+00;
03130     x[12] = 22.8508497608294829323930586693E+00;
03131     x[13] = 27.1606693274114488789963947149E+00;
03132     x[14] = 32.0691222518622423224362865906E+00;
03133     x[15] = 37.7129058012196494770647508283E+00;
03134     x[16] = 44.3173627958314961196067736013E+00;
03135     x[17] = 52.3129024574043831658644222420E+00;
03136     x[18] = 62.8024231535003758413504690673E+00;
03137   }
03138   else if (n==20) {
03139     x[ 0] = 0.0705398896919887533666890045842E+00;
03140     x[ 1] = 0.372126818001611443794241388761E+00;
03141     x[ 2] = 0.916582102483273564667716277074E+00;
03142     x[ 3] = 1.70730653102834388068768966741E+00;
03143     x[ 4] = 2.74919925530943212964503046049E+00;
03144     x[ 5] = 4.04892531385088692237495336913E+00;
03145     x[ 6] = 5.61517497086161651410453988565E+00;
03146     x[ 7] = 7.45901745367106330976886021837E+00;
03147     x[ 8] = 9.59439286958109677247367273428E+00;
03148     x[ 9] = 12.0388025469643163096234092989E+00;
03149     x[10] = 14.8142934426307399785126797100E+00;
03150     x[11] = 17.9488955205193760173657909926E+00;
03151     x[12] = 21.4787882402850109757351703696E+00;
03152     x[13] = 25.4517027931869055035186774846E+00;
03153     x[14] = 29.9325546317006120067136561352E+00;
03154     x[15] = 35.0134342404790000062849359067E+00;
03155     x[16] = 40.8330570567285710620295677078E+00;
03156     x[17] = 47.6199940473465021399416271529E+00;
03157     x[18] = 55.8107957500638988907507734445E+00;
03158     x[19] = 66.5244165256157538186403187915E+00;
03159   }
03160   else {
03161     std::cerr << "\n";
03162     std::cerr << "LAGUERRE_LOOKUP_POINTS - Fatal error!\n";
03163     std::cerr << "  Illegal value of N = " << n << "\n";
03164     std::cerr << "  Legal values are 1 through 20.\n";
03165     std::exit(1);
03166   }
03167 
03168   return;
03169 }
03170 
03171 //****************************************************************************
03172 template<class Scalar> 
03173 void IntrepidBurkardtRules::laguerre_lookup_weights ( int n, Scalar w[] )
03174 //****************************************************************************
03175 //
03176 //  Purpose:
03177 //
03178 //    LAGUERRE_LOOKUP_WEIGHTS looks up weights for Laguerre quadrature.
03179 //
03180 //  Licensing:
03181 //
03182 //    This code is distributed under the GNU LGPL license.
03183 //
03184 //  Modified:
03185 //
03186 //    27 April 2010
03187 //
03188 //  Author:
03189 //
03190 //    John Burkardt
03191 //
03192 //  Reference:
03193 //
03194 //    Milton Abramowitz, Irene Stegun,
03195 //    Handbook of Mathematical Functions,
03196 //    National Bureau of Standards, 1964,
03197 //    ISBN: 0-486-61272-4,
03198 //    LC: QA47.A34.
03199 //
03200 //    Vladimir Krylov,
03201 //    Approximate Calculation of Integrals,
03202 //    Dover, 2006,
03203 //    ISBN: 0486445798,
03204 //    LC: QA311.K713.
03205 //
03206 //    Arthur Stroud, Don Secrest,
03207 //    Gaussian Quadrature Formulas,
03208 //    Prentice Hall, 1966,
03209 //    LC: QA299.4G3S7.
03210 //
03211 //    Stephen Wolfram,
03212 //    The Mathematica Book,
03213 //    Fourth Edition,
03214 //    Cambridge University Press, 1999,
03215 //    ISBN: 0-521-64314-7,
03216 //    LC: QA76.95.W65.
03217 //
03218 //    Daniel Zwillinger, editor,
03219 //    CRC Standard Mathematical Tables and Formulae,
03220 //    30th Edition,
03221 //    CRC Press, 1996,
03222 //    ISBN: 0-8493-2479-3.
03223 //
03224 //  Parameters:
03225 //
03226 //    Input, int N, the order.
03227 //    N must be between 1 and 20.
03228 //
03229 //    Output, Scalar W[N], the weights.
03230 //
03231 {
03232   if (n==1) {
03233     w[ 0] =  1.00000000000000000000000000000E+00;
03234   }
03235   else if (n==2) {
03236     w[ 0] = 0.85355339059327376220042218105E+00;
03237     w[ 1] = 0.146446609406726237799577818948E+00;
03238   }
03239   else if (n==3) {
03240     w[ 0] = 0.71109300992917301544959019114E+00;
03241     w[ 1] = 0.27851773356924084880144488846E+00;
03242     w[ 2] = 0.010389256501586135748964920401E+00;
03243   }
03244   else if (n==4) {
03245     w[ 0] = 0.60315410434163360163596602382E+00;
03246     w[ 1] = 0.35741869243779968664149201746E+00;
03247     w[ 2] = 0.03888790851500538427243816816E+00;
03248     w[ 3] = 0.0005392947055613274501037905676E+00;
03249   }
03250   else if (n==5) {
03251     w[ 0] = 0.52175561058280865247586092879E+00;
03252     w[ 1] = 0.3986668110831759274541333481E+00;
03253     w[ 2] = 0.0759424496817075953876533114E+00;
03254     w[ 3] = 0.00361175867992204845446126257E+00;
03255     w[ 4] = 0.00002336997238577622789114908455E+00;
03256   }
03257   else if (n==6) {
03258     w[ 0] = 0.45896467394996359356828487771E+00;
03259     w[ 1] = 0.4170008307721209941133775662E+00;
03260     w[ 2] = 0.1133733820740449757387061851E+00;
03261     w[ 3] = 0.01039919745314907489891330285E+00;
03262     w[ 4] = 0.000261017202814932059479242860E+00;
03263     w[ 5] = 8.98547906429621238825292053E-07;
03264   }
03265   else if (n==7) {
03266     w[ 0] = 0.40931895170127390213043288002E+00;
03267     w[ 1] = 0.4218312778617197799292810054E+00;
03268     w[ 2] = 0.1471263486575052783953741846E+00;
03269     w[ 3] = 0.0206335144687169398657056150E+00;
03270     w[ 4] = 0.00107401014328074552213195963E+00;
03271     w[ 5] = 0.0000158654643485642012687326223E+00;
03272     w[ 6] = 3.17031547899558056227132215E-08;
03273   }
03274   else if (n==8) {
03275     w[ 0] = 0.36918858934163752992058283938E+00;
03276     w[ 1] = 0.4187867808143429560769785813E+00;
03277     w[ 2] = 0.175794986637171805699659867E+00;
03278     w[ 3] = 0.033343492261215651522132535E+00;
03279     w[ 4] = 0.0027945362352256725249389241E+00;
03280     w[ 5] = 0.00009076508773358213104238501E+00;
03281     w[ 6] = 8.4857467162725315448680183E-07;
03282     w[ 7] = 1.04800117487151038161508854E-09;
03283   }
03284   else if (n==9) {
03285     w[ 0] = 0.336126421797962519673467717606E+00;
03286     w[ 1] = 0.411213980423984387309146942793E+00;
03287     w[ 2] = 0.199287525370885580860575607212E+00;
03288     w[ 3] = 0.0474605627656515992621163600479E+00;
03289     w[ 4] = 0.00559962661079458317700419900556E+00;
03290     w[ 5] = 0.000305249767093210566305412824291E+00;
03291     w[ 6] = 6.59212302607535239225572284875E-06;
03292     w[ 7] = 4.1107693303495484429024104033E-08;
03293     w[ 8] = 3.29087403035070757646681380323E-11;
03294   }
03295   else if (n==10) {
03296     w[ 0] = 0.30844111576502014154747083468E+00;
03297     w[ 1] = 0.4011199291552735515157803099E+00;
03298     w[ 2] = 0.218068287611809421588648523E+00;
03299     w[ 3] = 0.062087456098677747392902129E+00;
03300     w[ 4] = 0.009501516975181100553839072E+00;
03301     w[ 5] = 0.0007530083885875387754559644E+00;
03302     w[ 6] = 0.00002825923349599565567422564E+00;
03303     w[ 7] = 4.249313984962686372586577E-07;
03304     w[ 8] = 1.839564823979630780921535E-09;
03305     w[ 9] = 9.911827219609008558377547E-13;
03306   }
03307   else if (n==11) {
03308     w[ 0] = 0.28493321289420060505605102472E+00;
03309     w[ 1] = 0.3897208895278493779375535080E+00;
03310     w[ 2] = 0.232781831848991333940223796E+00;
03311     w[ 3] = 0.076564453546196686400854179E+00;
03312     w[ 4] = 0.014393282767350695091863919E+00;
03313     w[ 5] = 0.001518880846484873069847776E+00;
03314     w[ 6] = 0.0000851312243547192259720424E+00;
03315     w[ 7] = 2.29240387957450407857683E-06;
03316     w[ 8] = 2.48635370276779587373391E-08;
03317     w[ 9] = 7.71262693369132047028153E-11;
03318     w[10] = 2.883775868323623861597778E-14;
03319   }
03320   else if (n==12) {
03321     w[ 0] = 0.26473137105544319034973889206E+00;
03322     w[ 1] = 0.3777592758731379820244905567E+00;
03323     w[ 2] = 0.244082011319877564254870818E+00;
03324     w[ 3] = 0.09044922221168093072750549E+00;
03325     w[ 4] = 0.02010238115463409652266129E+00;
03326     w[ 5] = 0.002663973541865315881054158E+00;
03327     w[ 6] = 0.000203231592662999392121433E+00;
03328     w[ 7] = 8.3650558568197987453363E-06;
03329     w[ 8] = 1.66849387654091026116990E-07;
03330     w[ 9] = 1.34239103051500414552392E-09;
03331     w[10] = 3.06160163503502078142408E-12;
03332     w[11] = 8.148077467426241682473119E-16;
03333   }
03334   else if (n==13) {
03335     w[ 0] = 0.24718870842996262134624918596E+00;
03336     w[ 1] = 0.3656888229005219453067175309E+00;
03337     w[ 2] = 0.252562420057658502356824289E+00;
03338     w[ 3] = 0.10347075802418370511421863E+00;
03339     w[ 4] = 0.02643275441556161577815877E+00;
03340     w[ 5] = 0.00422039604025475276555209E+00;
03341     w[ 6] = 0.000411881770472734774892473E+00;
03342     w[ 7] = 0.0000235154739815532386882897E+00;
03343     w[ 8] = 7.3173116202490991040105E-07;
03344     w[ 9] = 1.10884162570398067979151E-08;
03345     w[10] = 6.7708266922058988406462E-11;
03346     w[11] = 1.15997995990507606094507E-13;
03347     w[12] = 2.245093203892758415991872E-17;
03348   }
03349   else if (n==14) {
03350     w[ 0] = 0.23181557714486497784077486110E+00;
03351     w[ 1] = 0.3537846915975431518023313013E+00;
03352     w[ 2] = 0.258734610245428085987320561E+00;
03353     w[ 3] = 0.11548289355692321008730499E+00;
03354     w[ 4] = 0.03319209215933736003874996E+00;
03355     w[ 5] = 0.00619286943700661021678786E+00;
03356     w[ 6] = 0.00073989037786738594242589E+00;
03357     w[ 7] = 0.000054907194668416983785733E+00;
03358     w[ 8] = 2.4095857640853774967578E-06;
03359     w[ 9] = 5.801543981676495180886E-08;
03360     w[10] = 6.819314692484974119616E-10;
03361     w[11] = 3.2212077518948479398089E-12;
03362     w[12] = 4.2213524405165873515980E-15;
03363     w[13] = 6.05237502228918880839871E-19;
03364   }
03365   else if (n==15) {
03366     w[ 0] = 0.21823488594008688985641323645E+00;
03367     w[ 1] = 0.3422101779228833296389489568E+00;
03368     w[ 2] = 0.263027577941680097414812275E+00;
03369     w[ 3] = 0.12642581810593053584303055E+00;
03370     w[ 4] = 0.04020686492100091484158548E+00;
03371     w[ 5] = 0.00856387780361183836391576E+00;
03372     w[ 6] = 0.00121243614721425207621921E+00;
03373     w[ 7] = 0.00011167439234425194199258E+00;
03374     w[ 8] = 6.459926762022900924653E-06;
03375     w[ 9] = 2.226316907096272630332E-07;
03376     w[10] = 4.227430384979365007351E-09;
03377     w[11] = 3.921897267041089290385E-11;
03378     w[12] = 1.4565152640731264063327E-13;
03379     w[13] = 1.4830270511133013354616E-16;
03380     w[14] = 1.60059490621113323104998E-20;
03381   }
03382   else if (n==16) {
03383     w[ 0] = 0.20615171495780099433427363674E+00;
03384     w[ 1] = 0.3310578549508841659929830987E+00;
03385     w[ 2] = 0.265795777644214152599502021E+00;
03386     w[ 3] = 0.13629693429637753997554751E+00;
03387     w[ 4] = 0.0473289286941252189780623E+00;
03388     w[ 5] = 0.0112999000803394532312490E+00;
03389     w[ 6] = 0.0018490709435263108642918E+00;
03390     w[ 7] = 0.00020427191530827846012602E+00;
03391     w[ 8] = 0.00001484458687398129877135E+00;
03392     w[ 9] = 6.828319330871199564396E-07;
03393     w[10] = 1.881024841079673213882E-08;
03394     w[11] = 2.862350242973881619631E-10;
03395     w[12] = 2.127079033224102967390E-12;
03396     w[13] = 6.297967002517867787174E-15;
03397     w[14] = 5.050473700035512820402E-18;
03398     w[15] = 4.1614623703728551904265E-22;
03399   }
03400   else if (n==17) {
03401     w[ 0] = 0.19533220525177083214592729770E+00;
03402     w[ 1] = 0.3203753572745402813366256320E+00;
03403     w[ 2] = 0.267329726357171097238809604E+00;
03404     w[ 3] = 0.14512985435875862540742645E+00;
03405     w[ 4] = 0.0544369432453384577793806E+00;
03406     w[ 5] = 0.0143572977660618672917767E+00;
03407     w[ 6] = 0.0026628247355727725684324E+00;
03408     w[ 7] = 0.0003436797271562999206118E+00;
03409     w[ 8] = 0.00003027551783782870109437E+00;
03410     w[ 9] = 1.768515053231676895381E-06;
03411     w[10] = 6.57627288681043332199E-08;
03412     w[11] = 1.469730932159546790344E-09;
03413     w[12] = 1.81691036255544979555E-11;
03414     w[13] = 1.095401388928687402976E-13;
03415     w[14] = 2.617373882223370421551E-16;
03416     w[15] = 1.6729356931461546908502E-19;
03417     w[16] = 1.06562631627404278815253E-23;
03418   }
03419   else if (n==18) {
03420     w[ 0] = 0.18558860314691880562333775228E+00;
03421     w[ 1] = 0.3101817663702252936495975957E+00;
03422     w[ 2] = 0.267866567148536354820854395E+00;
03423     w[ 3] = 0.15297974746807490655384308E+00;
03424     w[ 4] = 0.0614349178609616527076780E+00;
03425     w[ 5] = 0.0176872130807729312772600E+00;
03426     w[ 6] = 0.0036601797677599177980266E+00;
03427     w[ 7] = 0.0005406227870077353231284E+00;
03428     w[ 8] = 0.0000561696505121423113818E+00;
03429     w[ 9] = 4.01530788370115755859E-06;
03430     w[10] = 1.91466985667567497969E-07;
03431     w[11] = 5.8360952686315941292E-09;
03432     w[12] = 1.07171126695539012773E-10;
03433     w[13] = 1.08909871388883385562E-12;
03434     w[14] = 5.38666474837830887608E-15;
03435     w[15] = 1.049865978035703408779E-17;
03436     w[16] = 5.405398451631053643566E-21;
03437     w[17] = 2.6916532692010286270838E-25;
03438   }
03439   else if (n==19) {
03440     w[ 0] = 0.17676847491591250225103547981E+00;
03441     w[ 1] = 0.3004781436072543794821568077E+00;
03442     w[ 2] = 0.267599547038175030772695441E+00;
03443     w[ 3] = 0.15991337213558021678551215E+00;
03444     w[ 4] = 0.0682493799761491134552355E+00;
03445     w[ 5] = 0.0212393076065443249244062E+00;
03446     w[ 6] = 0.0048416273511483959672501E+00;
03447     w[ 7] = 0.0008049127473813667665946E+00;
03448     w[ 8] = 0.0000965247209315350170843E+00;
03449     w[ 9] = 8.20730525805103054409E-06;
03450     w[10] = 4.8305667247307725394E-07;
03451     w[11] = 1.90499136112328569994E-08;
03452     w[12] = 4.8166846309280615577E-10;
03453     w[13] = 7.3482588395511443768E-12;
03454     w[14] = 6.2022753875726163989E-14;
03455     w[15] = 2.54143084301542272372E-16;
03456     w[16] = 4.07886129682571235007E-19;
03457     w[17] = 1.707750187593837061004E-22;
03458     w[18] = 6.715064649908189959990E-27;
03459   }
03460   else if (n==20) {
03461     w[ 0] = 0.168746801851113862149223899689E+00;
03462     w[ 1] = 0.291254362006068281716795323812E+00;
03463     w[ 2] = 0.266686102867001288549520868998E+00;
03464     w[ 3] = 0.166002453269506840031469127816E+00;
03465     w[ 4] = 0.0748260646687923705400624639615E+00;
03466     w[ 5] = 0.0249644173092832210728227383234E+00;
03467     w[ 6] = 0.00620255084457223684744754785395E+00;
03468     w[ 7] = 0.00114496238647690824203955356969E+00;
03469     w[ 8] = 0.000155741773027811974779809513214E+00;
03470     w[ 9] = 0.0000154014408652249156893806714048E+00;
03471     w[10] = 1.08648636651798235147970004439E-06;
03472     w[11] = 5.33012090955671475092780244305E-08;
03473     w[12] = 1.7579811790505820035778763784E-09;
03474     w[13] = 3.72550240251232087262924585338E-11;
03475     w[14] = 4.76752925157819052449488071613E-13;
03476     w[15] = 3.37284424336243841236506064991E-15;
03477     w[16] = 1.15501433950039883096396247181E-17;
03478     w[17] = 1.53952214058234355346383319667E-20;
03479     w[18] = 5.28644272556915782880273587683E-24;
03480     w[19] = 1.65645661249902329590781908529E-28;
03481   }
03482   else {
03483     std::cerr << "\n";
03484     std::cerr << "LAGUERRE_LOOKUP_WEIGHTS - Fatal error!\n";
03485     std::cerr << "  Illegal value of N = " << n << "\n";
03486     std::cerr << "  Legal values are 1 through 20.\n";
03487     std::exit(1);
03488   }
03489 
03490   return;
03491 }
03492 
03493 //****************************************************************************
03494 template<class Scalar> 
03495 void IntrepidBurkardtRules::legendre_compute ( int n, Scalar x[], Scalar w[] )
03496 //****************************************************************************
03497 //
03498 //  Purpose:
03499 //
03500 //    LEGENDRE_COMPUTE: Legendre quadrature rule by the Elhay-Kautsky method.
03501 //
03502 //  Licensing:
03503 //
03504 //    This code is distributed under the GNU LGPL license.
03505 //
03506 //  Modified:
03507 //
03508 //    19 April 2011
03509 //
03510 //  Author:
03511 //
03512 //    Original FORTRAN77 version by Sylvan Elhay, Jaroslav Kautsky.
03513 //    C++ version by John Burkardt.
03514 //
03515 //  Reference:
03516 //
03517 //    Sylvan Elhay, Jaroslav Kautsky,
03518 //    Algorithm 655: IQPACK, FORTRAN Subroutines for the Weights of
03519 //    Interpolatory Quadrature,
03520 //    ACM Transactions on Mathematical Software,
03521 //    Volume 13, Number 4, December 1987, pages 399-415.
03522 //
03523 //  Parameters:
03524 //
03525 //    Input, int N, the order.
03526 //
03527 //    Output, Scalar X[N], the abscissas.
03528 //
03529 //    Output, Scalar W[N], the weights.
03530 //
03531 {
03532   Scalar *bj;
03533   int i;
03534   Scalar zemu;
03535 //
03536 //  Define the zero-th moment.
03537 //
03538   zemu = 2.0;
03539 //
03540 //  Define the Jacobi matrix.
03541 //
03542   bj = new Scalar[n];
03543 
03544   for (i=0;i<n;i++) {
03545     bj[i] = (Scalar)((i+1)*(i+1))/(Scalar)(4*(i+1)*(i+1)-1);
03546     bj[i] = std::sqrt(bj[i]);
03547   }
03548 
03549   for (i=0;i<n;i++) {
03550     x[i] = 0.0;
03551   }
03552 
03553   w[0] = std::sqrt(zemu);
03554 
03555   for (i=1;i<n;i++) {
03556     w[i] = 0.0;
03557   }
03558 //
03559 //  Diagonalize the Jacobi matrix.
03560 //
03561   IntrepidBurkardtRules::imtqlx(n,x,bj,w);
03562 
03563   for (i=0;i<n;i++) {
03564     w[i] = w[i]*w[i];
03565   }
03566 
03567   // Ensure that zero is actually zero.
03568   if (n%2) {
03569     int ind = (int)((Scalar)n/2.0);
03570     x[ind]  = 0.0;
03571   }
03572 
03573   delete [] bj;
03574 
03575   return;
03576 }
03577 
03578 //****************************************************************************
03579 template<class Scalar> 
03580 void IntrepidBurkardtRules::legendre_compute_points ( int n, Scalar x[] )
03581 //****************************************************************************
03582 //
03583 //  Purpose:
03584 //
03585 //    LEGENDRE_COMPUTE_POINTS computes Legendre quadrature points.
03586 //
03587 //  Licensing:
03588 //
03589 //    This code is distributed under the GNU LGPL license.
03590 //
03591 //  Modified:
03592 //
03593 //    13 June 2009
03594 //
03595 //  Author:
03596 //
03597 //    John Burkardt
03598 //
03599 //  Parameters:
03600 //
03601 //    Input, int N, the order.
03602 //
03603 //    Output, Scalar X[N], the abscissas.
03604 //
03605 {
03606   Scalar *w; w= new Scalar[n];
03607   IntrepidBurkardtRules::legendre_compute ( n, x, w );
03608   delete [] w;
03609 
03610   return;
03611 }
03612 
03613 //****************************************************************************
03614 template<class Scalar> 
03615 void IntrepidBurkardtRules::legendre_compute_weights ( int n, Scalar w[] )
03616 //****************************************************************************
03617 //
03618 //  Purpose:
03619 //
03620 //    LEGENDRE_COMPUTE_WEIGHTS computes Legendre quadrature weights.
03621 //
03622 //  Licensing:
03623 //
03624 //    This code is distributed under the GNU LGPL license.
03625 //
03626 //  Modified:
03627 //
03628 //    13 June 2009
03629 //
03630 //  Author:
03631 //
03632 //    John Burkardt
03633 //
03634 //  Parameters:
03635 //
03636 //    Input, int N, the order.
03637 //
03638 //    Output, Scalar W[N], the weights.
03639 //
03640 {
03641   Scalar *x; x = new Scalar[n];
03642   IntrepidBurkardtRules::legendre_compute ( n, x, w );
03643   delete [] x;
03644 
03645   return;
03646 }
03647 
03648 //****************************************************************************
03649 template<class Scalar> 
03650 void IntrepidBurkardtRules::legendre_lookup ( int n, Scalar x[], Scalar w[] )
03651 //****************************************************************************
03652 //
03653 //  Purpose:
03654 //
03655 //    LEGENDRE_LOOKUP looks up abscissas and weights for Gauss-Legendre quadrature.
03656 //
03657 //  Licensing:
03658 //
03659 //    This code is distributed under the GNU LGPL license.
03660 //
03661 //  Modified:
03662 //
03663 //    27 April 2010
03664 //
03665 //  Author:
03666 //
03667 //    John Burkardt
03668 //
03669 //  Reference:
03670 //
03671 //    Milton Abramowitz, Irene Stegun,
03672 //    Handbook of Mathematical Functions,
03673 //    National Bureau of Standards, 1964,
03674 //    ISBN: 0-486-61272-4,
03675 //    LC: QA47.A34.
03676 //
03677 //    Vladimir Krylov,
03678 //    Approximate Calculation of Integrals,
03679 //    Dover, 2006,
03680 //    ISBN: 0486445798.
03681 //    LC: QA311.K713.
03682 //
03683 //    Arthur Stroud, Don Secrest,
03684 //    Gaussian Quadrature Formulas,
03685 //    Prentice Hall, 1966,
03686 //    LC: QA299.4G3S7.
03687 //
03688 //    Stephen Wolfram,
03689 //    The Mathematica Book,
03690 //    Fourth Edition,
03691 //    Cambridge University Press, 1999,
03692 //    ISBN: 0-521-64314-7,
03693 //    LC: QA76.95.W65.
03694 //
03695 //    Daniel Zwillinger, editor,
03696 //    CRC Standard Mathematical Tables and Formulae,
03697 //    30th Edition,
03698 //    CRC Press, 1996,
03699 //    ISBN: 0-8493-2479-3,
03700 //    LC: QA47.M315.
03701 //
03702 //  Parameters:
03703 //
03704 //    Input, int N, the order.
03705 //    N must be between 1 and 33.
03706 //
03707 //    Output, Scalar X[N], the abscissas.
03708 //
03709 //    Output, Scalar W[N], the abscissas.
03710 //
03711 {
03712   IntrepidBurkardtRules::legendre_lookup_points ( n, x );
03713   IntrepidBurkardtRules::legendre_lookup_weights ( n, w );
03714 
03715   return;
03716 }
03717 
03718 //****************************************************************************
03719 template<class Scalar> 
03720 void IntrepidBurkardtRules::legendre_lookup_points ( int n, Scalar x[] )
03721 //****************************************************************************
03722 //
03723 //  Purpose:
03724 //
03725 //    LEGENDRE_LOOKUP_POINTS looks up abscissas for Gauss-Legendre quadrature.
03726 //
03727 //  Licensing:
03728 //
03729 //    This code is distributed under the GNU LGPL license.
03730 //
03731 //  Modified:
03732 //
03733 //    27 April 2010
03734 //
03735 //  Author:
03736 //
03737 //    John Burkardt
03738 //
03739 //  Reference:
03740 //
03741 //    Milton Abramowitz, Irene Stegun,
03742 //    Handbook of Mathematical Functions,
03743 //    National Bureau of Standards, 1964,
03744 //    ISBN: 0-486-61272-4,
03745 //    LC: QA47.A34.
03746 //
03747 //    Vladimir Krylov,
03748 //    Approximate Calculation of Integrals,
03749 //    Dover, 2006,
03750 //    ISBN: 0486445798.
03751 //    LC: QA311.K713.
03752 //
03753 //    Arthur Stroud, Don Secrest,
03754 //    Gaussian Quadrature Formulas,
03755 //    Prentice Hall, 1966,
03756 //    LC: QA299.4G3S7.
03757 //
03758 //    Stephen Wolfram,
03759 //    The Mathematica Book,
03760 //    Fourth Edition,
03761 //    Cambridge University Press, 1999,
03762 //    ISBN: 0-521-64314-7,
03763 //    LC: QA76.95.W65.
03764 //
03765 //    Daniel Zwillinger, editor,
03766 //    CRC Standard Mathematical Tables and Formulae,
03767 //    30th Edition,
03768 //    CRC Press, 1996,
03769 //    ISBN: 0-8493-2479-3,
03770 //    LC: QA47.M315.
03771 //
03772 //  Parameters:
03773 //
03774 //    Input, int N, the order.
03775 //    N must be between 1 and 33.
03776 //
03777 //    Output, Scalar X[N], the abscissas.
03778 //
03779 {
03780   if (n==1) {
03781     x[ 0] = 0.000000000000000000000000000000;
03782   }
03783   else if (n==2) {
03784     x[ 0] = -0.577350269189625764509148780502;
03785     x[ 1] =  0.577350269189625764509148780502;
03786   }
03787   else if (n==3) {
03788     x[ 0] = -0.774596669241483377035853079956;
03789     x[ 1] =  0.000000000000000000000000000000;
03790     x[ 2] =  0.774596669241483377035853079956;
03791   }
03792   else if (n==4) {
03793     x[ 0] = -0.861136311594052575223946488893;
03794     x[ 1] = -0.339981043584856264802665759103;
03795     x[ 2] =  0.339981043584856264802665759103;
03796     x[ 3] =  0.861136311594052575223946488893;
03797   }
03798   else if (n==5) {
03799     x[ 0] = -0.906179845938663992797626878299;
03800     x[ 1] = -0.538469310105683091036314420700;
03801     x[ 2] =  0.000000000000000000000000000000;
03802     x[ 3] =  0.538469310105683091036314420700;
03803     x[ 4] =  0.906179845938663992797626878299;
03804   }
03805   else if (n==6) {
03806     x[ 0] = -0.932469514203152027812301554494;
03807     x[ 1] = -0.661209386466264513661399595020;
03808     x[ 2] = -0.238619186083196908630501721681;
03809     x[ 3] =  0.238619186083196908630501721681;
03810     x[ 4] =  0.661209386466264513661399595020;
03811     x[ 5] =  0.932469514203152027812301554494;
03812   }
03813   else if (n==7) {
03814     x[ 0] = -0.949107912342758524526189684048;
03815     x[ 1] = -0.741531185599394439863864773281;
03816     x[ 2] = -0.405845151377397166906606412077;
03817     x[ 3] =  0.000000000000000000000000000000;
03818     x[ 4] =  0.405845151377397166906606412077;
03819     x[ 5] =  0.741531185599394439863864773281;
03820     x[ 6] =  0.949107912342758524526189684048;
03821   }
03822   else if (n==8) {
03823     x[ 0] = -0.960289856497536231683560868569;
03824     x[ 1] = -0.796666477413626739591553936476;
03825     x[ 2] = -0.525532409916328985817739049189;
03826     x[ 3] = -0.183434642495649804939476142360;
03827     x[ 4] =  0.183434642495649804939476142360;
03828     x[ 5] =  0.525532409916328985817739049189;
03829     x[ 6] =  0.796666477413626739591553936476;
03830     x[ 7] =  0.960289856497536231683560868569;
03831   }
03832   else if (n==9) {
03833     x[ 0] = -0.968160239507626089835576203;
03834     x[ 1] = -0.836031107326635794299429788;
03835     x[ 2] = -0.613371432700590397308702039;
03836     x[ 3] = -0.324253423403808929038538015;
03837     x[ 4] =  0.000000000000000000000000000;
03838     x[ 5] =  0.324253423403808929038538015;
03839     x[ 6] =  0.613371432700590397308702039;
03840     x[ 7] =  0.836031107326635794299429788;
03841     x[ 8] =  0.968160239507626089835576203;
03842   }
03843   else if (n==10) {
03844     x[ 0] = -0.973906528517171720077964012;
03845     x[ 1] = -0.865063366688984510732096688;
03846     x[ 2] = -0.679409568299024406234327365;
03847     x[ 3] = -0.433395394129247190799265943;
03848     x[ 4] = -0.148874338981631210884826001;
03849     x[ 5] =  0.148874338981631210884826001;
03850     x[ 6] =  0.433395394129247190799265943;
03851     x[ 7] =  0.679409568299024406234327365;
03852     x[ 8] =  0.865063366688984510732096688;
03853     x[ 9] =  0.973906528517171720077964012;
03854   }
03855   else if (n==11) {
03856     x[ 0] = -0.978228658146056992803938001;
03857     x[ 1] = -0.887062599768095299075157769;
03858     x[ 2] = -0.730152005574049324093416252;
03859     x[ 3] = -0.519096129206811815925725669;
03860     x[ 4] = -0.269543155952344972331531985;
03861     x[ 5] =  0.000000000000000000000000000;
03862     x[ 6] =  0.269543155952344972331531985;
03863     x[ 7] =  0.519096129206811815925725669;
03864     x[ 8] =  0.730152005574049324093416252;
03865     x[ 9] =  0.887062599768095299075157769;
03866     x[10] =  0.978228658146056992803938001;
03867   }
03868   else if (n==12) {
03869     x[ 0] = -0.981560634246719250690549090;
03870     x[ 1] = -0.904117256370474856678465866;
03871     x[ 2] = -0.769902674194304687036893833;
03872     x[ 3] = -0.587317954286617447296702419;
03873     x[ 4] = -0.367831498998180193752691537;
03874     x[ 5] = -0.125233408511468915472441369;
03875     x[ 6] =  0.125233408511468915472441369;
03876     x[ 7] =  0.367831498998180193752691537;
03877     x[ 8] =  0.587317954286617447296702419;
03878     x[ 9] =  0.769902674194304687036893833;
03879     x[10] =  0.904117256370474856678465866;
03880     x[11] =  0.981560634246719250690549090;
03881   }
03882   else if (n==13) {
03883     x[ 0] = -0.984183054718588149472829449;
03884     x[ 1] = -0.917598399222977965206547837;
03885     x[ 2] = -0.801578090733309912794206490;
03886     x[ 3] = -0.642349339440340220643984607;
03887     x[ 4] = -0.448492751036446852877912852;
03888     x[ 5] = -0.230458315955134794065528121;
03889     x[ 6] =  0.000000000000000000000000000;
03890     x[ 7] =  0.230458315955134794065528121;
03891     x[ 8] =  0.448492751036446852877912852;
03892     x[ 9] =  0.642349339440340220643984607;
03893     x[10] =  0.80157809073330991279420649;
03894     x[11] =  0.91759839922297796520654784;
03895     x[12] =  0.98418305471858814947282945;
03896   }
03897   else if (n==14) {
03898     x[ 0] = -0.986283808696812338841597267;
03899     x[ 1] = -0.928434883663573517336391139;
03900     x[ 2] = -0.827201315069764993189794743;
03901     x[ 3] = -0.687292904811685470148019803;
03902     x[ 4] = -0.515248636358154091965290719;
03903     x[ 5] = -0.319112368927889760435671824;
03904     x[ 6] = -0.108054948707343662066244650;
03905     x[ 7] =  0.108054948707343662066244650;
03906     x[ 8] =  0.31911236892788976043567182;
03907     x[ 9] =  0.51524863635815409196529072;
03908     x[10] =  0.68729290481168547014801980;
03909     x[11] =  0.82720131506976499318979474;
03910     x[12] =  0.92843488366357351733639114;
03911     x[13] =  0.98628380869681233884159727;
03912   }
03913   else if (n==15) {
03914     x[ 0] = -0.987992518020485428489565719;
03915     x[ 1] = -0.937273392400705904307758948;
03916     x[ 2] = -0.848206583410427216200648321;
03917     x[ 3] = -0.724417731360170047416186055;
03918     x[ 4] = -0.570972172608538847537226737;
03919     x[ 5] = -0.394151347077563369897207371;
03920     x[ 6] = -0.201194093997434522300628303;
03921     x[ 7] =  0.00000000000000000000000000;
03922     x[ 8] =  0.20119409399743452230062830;
03923     x[ 9] =  0.39415134707756336989720737;
03924     x[10] =  0.57097217260853884753722674;
03925     x[11] =  0.72441773136017004741618605;
03926     x[12] =  0.84820658341042721620064832;
03927     x[13] =  0.93727339240070590430775895;
03928     x[14] =  0.98799251802048542848956572;
03929   }
03930   else if (n==16) {
03931     x[ 0] = -0.989400934991649932596154173;
03932     x[ 1] = -0.944575023073232576077988416;
03933     x[ 2] = -0.865631202387831743880467898;
03934     x[ 3] = -0.755404408355003033895101195;
03935     x[ 4] = -0.617876244402643748446671764;
03936     x[ 5] = -0.458016777657227386342419443;
03937     x[ 6] = -0.281603550779258913230460501;
03938     x[ 7] = -0.09501250983763744018531934;
03939     x[ 8] =  0.09501250983763744018531934;
03940     x[ 9] =  0.28160355077925891323046050;
03941     x[10] =  0.45801677765722738634241944;
03942     x[11] =  0.61787624440264374844667176;
03943     x[12] =  0.75540440835500303389510119;
03944     x[13] =  0.86563120238783174388046790;
03945     x[14] =  0.94457502307323257607798842;
03946     x[15] =  0.98940093499164993259615417;
03947   }
03948   else if (n==17) {
03949     x[ 0] = -0.990575475314417335675434020;
03950     x[ 1] = -0.950675521768767761222716958;
03951     x[ 2] = -0.880239153726985902122955694;
03952     x[ 3] = -0.781514003896801406925230056;
03953     x[ 4] = -0.657671159216690765850302217;
03954     x[ 5] = -0.512690537086476967886246569;
03955     x[ 6] = -0.35123176345387631529718552;
03956     x[ 7] = -0.17848418149584785585067749;
03957     x[ 8] =  0.00000000000000000000000000;
03958     x[ 9] =  0.17848418149584785585067749;
03959     x[10] =  0.35123176345387631529718552;
03960     x[11] =  0.51269053708647696788624657;
03961     x[12] =  0.65767115921669076585030222;
03962     x[13] =  0.78151400389680140692523006;
03963     x[14] =  0.88023915372698590212295569;
03964     x[15] =  0.95067552176876776122271696;
03965     x[16] =  0.99057547531441733567543402;
03966   }
03967   else if (n==18) {
03968     x[ 0] = -0.991565168420930946730016005;
03969     x[ 1] = -0.955823949571397755181195893;
03970     x[ 2] = -0.892602466497555739206060591;
03971     x[ 3] = -0.803704958972523115682417455;
03972     x[ 4] = -0.691687043060353207874891081;
03973     x[ 5] = -0.55977083107394753460787155;
03974     x[ 6] = -0.41175116146284264603593179;
03975     x[ 7] = -0.25188622569150550958897285;
03976     x[ 8] = -0.08477501304173530124226185;
03977     x[ 9] =  0.08477501304173530124226185;
03978     x[10] =  0.25188622569150550958897285;
03979     x[11] =  0.41175116146284264603593179;
03980     x[12] =  0.55977083107394753460787155;
03981     x[13] =  0.69168704306035320787489108;
03982     x[14] =  0.80370495897252311568241746;
03983     x[15] =  0.89260246649755573920606059;
03984     x[16] =  0.95582394957139775518119589;
03985     x[17] =  0.99156516842093094673001600;
03986   }
03987   else if (n==19) {
03988     x[ 0] = -0.992406843843584403189017670;
03989     x[ 1] = -0.960208152134830030852778841;
03990     x[ 2] = -0.903155903614817901642660929;
03991     x[ 3] = -0.822714656537142824978922487;
03992     x[ 4] = -0.72096617733522937861709586;
03993     x[ 5] = -0.60054530466168102346963816;
03994     x[ 6] = -0.46457074137596094571726715;
03995     x[ 7] = -0.31656409996362983199011733;
03996     x[ 8] = -0.16035864564022537586809612;
03997     x[ 9] =  0.00000000000000000000000000;
03998     x[10] =  0.16035864564022537586809612;
03999     x[11] =  0.31656409996362983199011733;
04000     x[12] =  0.46457074137596094571726715;
04001     x[13] =  0.60054530466168102346963816;
04002     x[14] =  0.72096617733522937861709586;
04003     x[15] =  0.82271465653714282497892249;
04004     x[16] =  0.90315590361481790164266093;
04005     x[17] =  0.96020815213483003085277884;
04006     x[18] =  0.99240684384358440318901767;
04007   }
04008   else if (n==20) {
04009     x[ 0] = -0.993128599185094924786122388;
04010     x[ 1] = -0.963971927277913791267666131;
04011     x[ 2] = -0.912234428251325905867752441;
04012     x[ 3] = -0.83911697182221882339452906;
04013     x[ 4] = -0.74633190646015079261430507;
04014     x[ 5] = -0.63605368072651502545283670;
04015     x[ 6] = -0.51086700195082709800436405;
04016     x[ 7] = -0.37370608871541956067254818;
04017     x[ 8] = -0.22778585114164507808049620;
04018     x[ 9] = -0.07652652113349733375464041;
04019     x[10] =  0.07652652113349733375464041;
04020     x[11] =  0.22778585114164507808049620;
04021     x[12] =  0.37370608871541956067254818;
04022     x[13] =  0.51086700195082709800436405;
04023     x[14] =  0.63605368072651502545283670;
04024     x[15] =  0.74633190646015079261430507;
04025     x[16] =  0.83911697182221882339452906;
04026     x[17] =  0.91223442825132590586775244;
04027     x[18] =  0.96397192727791379126766613;
04028     x[19] =  0.99312859918509492478612239;
04029   }
04030   else if (n==21) {
04031     x[ 0] =  -0.99375217062038950026024204;
04032     x[ 1] =  -0.96722683856630629431662221;
04033     x[ 2] =  -0.92009933415040082879018713;
04034     x[ 3] =  -0.85336336458331728364725064;
04035     x[ 4] =  -0.76843996347567790861587785;
04036     x[ 5] =  -0.66713880419741231930596667;
04037     x[ 6] =  -0.55161883588721980705901880;
04038     x[ 7] =  -0.42434212020743878357366889;
04039     x[ 8] =  -0.28802131680240109660079252;
04040     x[ 9] =  -0.14556185416089509093703098;
04041     x[10] =   0.00000000000000000000000000;
04042     x[11] =  +0.14556185416089509093703098;
04043     x[12] =  +0.28802131680240109660079252;
04044     x[13] =  +0.42434212020743878357366889;
04045     x[14] =  +0.55161883588721980705901880;
04046     x[15] =  +0.66713880419741231930596667;
04047     x[16] =  +0.76843996347567790861587785;
04048     x[17] =  +0.85336336458331728364725064;
04049     x[18] =  +0.92009933415040082879018713;
04050     x[19] =  +0.96722683856630629431662221;
04051     x[20] =  +0.99375217062038950026024204;
04052   }
04053   else if (n==22) {
04054     x[ 0] = -0.99429458548239929207303142;
04055     x[ 1] = -0.97006049783542872712395099;
04056     x[ 2] = -0.92695677218717400052069294;
04057     x[ 3] = -0.86581257772030013653642564;
04058     x[ 4] = -0.78781680597920816200427796;
04059     x[ 5] = -0.69448726318668278005068984;
04060     x[ 6] = -0.58764040350691159295887693;
04061     x[ 7] = -0.46935583798675702640633071;
04062     x[ 8] = -0.34193582089208422515814742;
04063     x[ 9] = -0.20786042668822128547884653;
04064     x[10] = -0.06973927331972222121384180;
04065     x[11] =  0.06973927331972222121384180;
04066     x[12] =  0.20786042668822128547884653;
04067     x[13] =  0.34193582089208422515814742;
04068     x[14] =  0.46935583798675702640633071;
04069     x[15] =  0.58764040350691159295887693;
04070     x[16] =  0.69448726318668278005068984;
04071     x[17] =  0.78781680597920816200427796;
04072     x[18] =  0.86581257772030013653642564;
04073     x[19] =  0.92695677218717400052069294;
04074     x[20] =  0.97006049783542872712395099;
04075     x[21] =  0.99429458548239929207303142;
04076   }
04077   else if (n==23) {
04078     x[ 0] = -0.99476933499755212352392572;
04079     x[ 1] = -0.97254247121811523195602408;
04080     x[ 2] = -0.93297108682601610234919699;
04081     x[ 3] = -0.87675235827044166737815689;
04082     x[ 4] = -0.80488840161883989215111841;
04083     x[ 5] = -0.71866136313195019446162448;
04084     x[ 6] = -0.61960987576364615638509731;
04085     x[ 7] = -0.50950147784600754968979305;
04086     x[ 8] = -0.39030103803029083142148887;
04087     x[ 9] = -0.26413568097034493053386954;
04088     x[10] = -0.13325682429846611093174268;
04089     x[11] =  0.00000000000000000000000000;
04090     x[12] =  0.13325682429846611093174268;
04091     x[13] =  0.26413568097034493053386954;
04092     x[14] =  0.39030103803029083142148887;
04093     x[15] =  0.50950147784600754968979305;
04094     x[16] =  0.61960987576364615638509731;
04095     x[17] =  0.71866136313195019446162448;
04096     x[18] =  0.80488840161883989215111841;
04097     x[19] =  0.87675235827044166737815689;
04098     x[20] =  0.93297108682601610234919699;
04099     x[21] =  0.97254247121811523195602408;
04100     x[22] =  0.99476933499755212352392572;
04101   }
04102   else if (n==24) {
04103     x[ 0] = -0.99518721999702136017999741;
04104     x[ 1] = -0.97472855597130949819839199;
04105     x[ 2] = -0.93827455200273275852364900;
04106     x[ 3] = -0.88641552700440103421315434;
04107     x[ 4] = -0.82000198597390292195394987;
04108     x[ 5] = -0.74012419157855436424382810;
04109     x[ 6] = -0.64809365193697556925249579;
04110     x[ 7] = -0.54542147138883953565837562;
04111     x[ 8] = -0.43379350762604513848708423;
04112     x[ 9] = -0.31504267969616337438679329;
04113     x[10] = -0.19111886747361630915863982;
04114     x[11] = -0.06405689286260562608504308;
04115     x[12] =  0.06405689286260562608504308;
04116     x[13] =  0.19111886747361630915863982;
04117     x[14] =  0.31504267969616337438679329;
04118     x[15] =  0.43379350762604513848708423;
04119     x[16] =  0.54542147138883953565837562;
04120     x[17] =  0.64809365193697556925249579;
04121     x[18] =  0.74012419157855436424382810;
04122     x[19] =  0.82000198597390292195394987;
04123     x[20] =  0.88641552700440103421315434;
04124     x[21] =  0.93827455200273275852364900;
04125     x[22] =  0.97472855597130949819839199;
04126     x[23] =  0.99518721999702136017999741;
04127   }
04128   else if (n==25) {
04129     x[ 0] = -0.99555696979049809790878495;
04130     x[ 1] = -0.97666392145951751149831539;
04131     x[ 2] = -0.94297457122897433941401117;
04132     x[ 3] = -0.89499199787827536885104201;
04133     x[ 4] = -0.83344262876083400142102111;
04134     x[ 5] = -0.75925926303735763057728287;
04135     x[ 6] = -0.67356636847346836448512063;
04136     x[ 7] = -0.57766293024122296772368984;
04137     x[ 8] = -0.47300273144571496052218212;
04138     x[ 9] = -0.36117230580938783773582173;
04139     x[10] = -0.24386688372098843204519036;
04140     x[11] = -0.12286469261071039638735982;
04141     x[12] =  0.00000000000000000000000000;
04142     x[13] =  0.12286469261071039638735982;
04143     x[14] =  0.24386688372098843204519036;
04144     x[15] =  0.36117230580938783773582173;
04145     x[16] =  0.47300273144571496052218212;
04146     x[17] =  0.57766293024122296772368984;
04147     x[18] =  0.67356636847346836448512063;
04148     x[19] =  0.75925926303735763057728287;
04149     x[20] =  0.83344262876083400142102111;
04150     x[21] =  0.89499199787827536885104201;
04151     x[22] =  0.94297457122897433941401117;
04152     x[23] =  0.97666392145951751149831539;
04153     x[24] =  0.99555696979049809790878495;
04154   }
04155   else if (n==26) {
04156     x[ 0] = -0.99588570114561692900321696;
04157     x[ 1] = -0.97838544595647099110058035;
04158     x[ 2] = -0.94715906666171425013591528;
04159     x[ 3] = -0.90263786198430707421766560;
04160     x[ 4] = -0.84544594278849801879750706;
04161     x[ 5] = -0.77638594882067885619296725;
04162     x[ 6] = -0.69642726041995726486381391;
04163     x[ 7] = -0.60669229301761806323197875;
04164     x[ 8] = -0.50844071482450571769570306;
04165     x[ 9] = -0.40305175512348630648107738;
04166     x[10] = -0.29200483948595689514283538;
04167     x[11] = -0.17685882035689018396905775;
04168     x[12] = -0.05923009342931320709371858;
04169     x[13] =  0.05923009342931320709371858;
04170     x[14] =  0.17685882035689018396905775;
04171     x[15] =  0.29200483948595689514283538;
04172     x[16] =  0.40305175512348630648107738;
04173     x[17] =  0.50844071482450571769570306;
04174     x[18] =  0.60669229301761806323197875;
04175     x[19] =  0.69642726041995726486381391;
04176     x[20] =  0.77638594882067885619296725;
04177     x[21] =  0.84544594278849801879750706;
04178     x[22] =  0.90263786198430707421766560;
04179     x[23] =  0.94715906666171425013591528;
04180     x[24] =  0.97838544595647099110058035;
04181     x[25] =  0.99588570114561692900321696;
04182   }
04183   else if (n==27) {
04184     x[ 0] = -0.99617926288898856693888721;
04185     x[ 1] = -0.97992347596150122285587336;
04186     x[ 2] = -0.95090055781470500685190803;
04187     x[ 3] = -0.90948232067749110430064502;
04188     x[ 4] = -0.85620790801829449030273722;
04189     x[ 5] = -0.79177163907050822714439734;
04190     x[ 6] = -0.71701347373942369929481621;
04191     x[ 7] = -0.63290797194649514092773464;
04192     x[ 8] = -0.54055156457945689490030094;
04193     x[ 9] = -0.44114825175002688058597416;
04194     x[10] = -0.33599390363850889973031903;
04195     x[11] = -0.22645936543953685885723911;
04196     x[12] = -0.11397258560952996693289498;
04197     x[13] =  0.00000000000000000000000000;
04198     x[14] =  0.11397258560952996693289498;
04199     x[15] =  0.22645936543953685885723911;
04200     x[16] =  0.33599390363850889973031903;
04201     x[17] =  0.44114825175002688058597416;
04202     x[18] =  0.54055156457945689490030094;
04203     x[19] =  0.63290797194649514092773464;
04204     x[20] =  0.71701347373942369929481621;
04205     x[21] =  0.79177163907050822714439734;
04206     x[22] =  0.85620790801829449030273722;
04207     x[23] =  0.90948232067749110430064502;
04208     x[24] =  0.95090055781470500685190803;
04209     x[25] =  0.97992347596150122285587336;
04210     x[26] =  0.99617926288898856693888721;
04211   }
04212   else if (n==28) {
04213     x[ 0] = -0.99644249757395444995043639;
04214     x[ 1] = -0.98130316537087275369455995;
04215     x[ 2] = -0.95425928062893819725410184;
04216     x[ 3] = -0.91563302639213207386968942;
04217     x[ 4] = -0.86589252257439504894225457;
04218     x[ 5] = -0.80564137091717917144788596;
04219     x[ 6] = -0.73561087801363177202814451;
04220     x[ 7] = -0.65665109403886496121989818;
04221     x[ 8] = -0.56972047181140171930800328;
04222     x[ 9] = -0.47587422495511826103441185;
04223     x[10] = -0.37625151608907871022135721;
04224     x[11] = -0.27206162763517807767682636;
04225     x[12] = -0.16456928213338077128147178;
04226     x[13] = -0.05507928988403427042651653;
04227     x[14] =  0.05507928988403427042651653;
04228     x[15] =  0.16456928213338077128147178;
04229     x[16] =  0.27206162763517807767682636;
04230     x[17] =  0.37625151608907871022135721;
04231     x[18] =  0.47587422495511826103441185;
04232     x[19] =  0.56972047181140171930800328;
04233     x[20] =  0.65665109403886496121989818;
04234     x[21] =  0.73561087801363177202814451;
04235     x[22] =  0.80564137091717917144788596;
04236     x[23] =  0.86589252257439504894225457;
04237     x[24] =  0.91563302639213207386968942;
04238     x[25] =  0.95425928062893819725410184;
04239     x[26] =  0.98130316537087275369455995;
04240     x[27] =  0.99644249757395444995043639;
04241   }
04242   else if (n==29) {
04243     x[ 0] = -0.99667944226059658616319153;
04244     x[ 1] = -0.98254550526141317487092602;
04245     x[ 2] = -0.95728559577808772579820804;
04246     x[ 3] = -0.92118023295305878509375344;
04247     x[ 4] = -0.87463780492010279041779342;
04248     x[ 5] = -0.81818548761525244498957221;
04249     x[ 6] = -0.75246285173447713391261008;
04250     x[ 7] = -0.67821453760268651515618501;
04251     x[ 8] = -0.59628179713822782037958621;
04252     x[ 9] = -0.50759295512422764210262792;
04253     x[10] = -0.41315288817400866389070659;
04254     x[11] = -0.31403163786763993494819592;
04255     x[12] = -0.21135228616600107450637573;
04256     x[13] = -0.10627823013267923017098239;
04257     x[14] =  0.00000000000000000000000000;
04258     x[15] =  0.10627823013267923017098239;
04259     x[16] =  0.21135228616600107450637573;
04260     x[17] =  0.31403163786763993494819592;
04261     x[18] =  0.41315288817400866389070659;
04262     x[19] =  0.50759295512422764210262792;
04263     x[20] =  0.59628179713822782037958621;
04264     x[21] =  0.67821453760268651515618501;
04265     x[22] =  0.75246285173447713391261008;
04266     x[23] =  0.81818548761525244498957221;
04267     x[24] =  0.87463780492010279041779342;
04268     x[25] =  0.92118023295305878509375344;
04269     x[26] =  0.95728559577808772579820804;
04270     x[27] =  0.98254550526141317487092602;
04271     x[28] =  0.99667944226059658616319153;
04272   }
04273   else if (n==30) {
04274     x[ 0] = -0.99689348407464954027163005;
04275     x[ 1] = -0.98366812327974720997003258;
04276     x[ 2] = -0.96002186496830751221687103;
04277     x[ 3] = -0.92620004742927432587932428;
04278     x[ 4] = -0.88256053579205268154311646;
04279     x[ 5] = -0.82956576238276839744289812;
04280     x[ 6] = -0.76777743210482619491797734;
04281     x[ 7] = -0.69785049479331579693229239;
04282     x[ 8] = -0.62052618298924286114047756;
04283     x[ 9] = -0.53662414814201989926416979;
04284     x[10] = -0.44703376953808917678060990;
04285     x[11] = -0.35270472553087811347103721;
04286     x[12] = -0.25463692616788984643980513;
04287     x[13] = -0.15386991360858354696379467;
04288     x[14] = -0.05147184255531769583302521;
04289     x[15] =  0.05147184255531769583302521;
04290     x[16] =  0.15386991360858354696379467;
04291     x[17] =  0.25463692616788984643980513;
04292     x[18] =  0.35270472553087811347103721;
04293     x[19] =  0.44703376953808917678060990;
04294     x[20] =  0.53662414814201989926416979;
04295     x[21] =  0.62052618298924286114047756;
04296     x[22] =  0.69785049479331579693229239;
04297     x[23] =  0.76777743210482619491797734;
04298     x[24] =  0.82956576238276839744289812;
04299     x[25] =  0.88256053579205268154311646;
04300     x[26] =  0.92620004742927432587932428;
04301     x[27] =  0.96002186496830751221687103;
04302     x[28] =  0.98366812327974720997003258;
04303     x[29] =  0.99689348407464954027163005;
04304   }
04305   else if (n==31) {
04306     x[ 0] = -0.99708748181947707405562655;
04307     x[ 1] = -0.98468590966515248400246517;
04308     x[ 2] = -0.96250392509294966178905240;
04309     x[ 3] = -0.93075699789664816495694576;
04310     x[ 4] = -0.88976002994827104337419201;
04311     x[ 5] = -0.83992032014626734008690454;
04312     x[ 6] = -0.78173314841662494040636002;
04313     x[ 7] = -0.71577678458685328390597087;
04314     x[ 8] = -0.64270672292426034618441820;
04315     x[ 9] = -0.56324916140714926272094492;
04316     x[10] = -0.47819378204490248044059404;
04317     x[11] = -0.38838590160823294306135146;
04318     x[12] = -0.29471806998170161661790390;
04319     x[13] = -0.19812119933557062877241300;
04320     x[14] = -0.09955531215234152032517479;
04321     x[15] =  0.00000000000000000000000000;
04322     x[16] =  0.09955531215234152032517479;
04323     x[17] =  0.19812119933557062877241300;
04324     x[18] =  0.29471806998170161661790390;
04325     x[19] =  0.38838590160823294306135146;
04326     x[20] =  0.47819378204490248044059404;
04327     x[21] =  0.56324916140714926272094492;
04328     x[22] =  0.64270672292426034618441820;
04329     x[23] =  0.71577678458685328390597087;
04330     x[24] =  0.78173314841662494040636002;
04331     x[25] =  0.83992032014626734008690454;
04332     x[26] =  0.88976002994827104337419201;
04333     x[27] =  0.93075699789664816495694576;
04334     x[28] =  0.96250392509294966178905240;
04335     x[29] =  0.98468590966515248400246517;
04336     x[30] =  0.99708748181947707405562655;
04337   }
04338   else if (n==32) {
04339     x[ 0] = -0.99726386184948156354498113;
04340     x[ 1] = -0.98561151154526833540017504;
04341     x[ 2] = -0.96476225558750643077381193;
04342     x[ 3] = -0.93490607593773968917091913;
04343     x[ 4] = -0.89632115576605212396530724;
04344     x[ 5] = -0.84936761373256997013369300;
04345     x[ 6] = -0.79448379596794240696309730;
04346     x[ 7] = -0.73218211874028968038742667;
04347     x[ 8] = -0.66304426693021520097511517;
04348     x[ 9] = -0.58771575724076232904074548;
04349     x[10] = -0.50689990893222939002374747;
04350     x[11] = -0.42135127613063534536411944;
04351     x[12] = -0.33186860228212764977991681;
04352     x[13] = -0.23928736225213707454460321;
04353     x[14] = -0.14447196158279649348518637;
04354     x[15] = -0.04830766568773831623481257;
04355     x[16] =  0.04830766568773831623481257;
04356     x[17] =  0.14447196158279649348518637;
04357     x[18] =  0.23928736225213707454460321;
04358     x[19] =  0.33186860228212764977991681;
04359     x[20] =  0.42135127613063534536411944;
04360     x[21] =  0.50689990893222939002374747;
04361     x[22] =  0.58771575724076232904074548;
04362     x[23] =  0.66304426693021520097511517;
04363     x[24] =  0.73218211874028968038742667;
04364     x[25] =  0.79448379596794240696309730;
04365     x[26] =  0.84936761373256997013369300;
04366     x[27] =  0.89632115576605212396530724;
04367     x[28] =  0.93490607593773968917091913;
04368     x[29] =  0.96476225558750643077381193;
04369     x[30] =  0.98561151154526833540017504;
04370     x[31] =  0.99726386184948156354498113;
04371   }
04372   else if (n==33) {
04373     x[ 0] = -0.99742469424645521726616802;
04374     x[ 1] = -0.98645572623064248811037570;
04375     x[ 2] = -0.96682290968999276892837771;
04376     x[ 3] = -0.93869437261116835035583512;
04377     x[ 4] = -0.90231676774343358304053133;
04378     x[ 5] = -0.85800965267650406464306148;
04379     x[ 6] = -0.80616235627416658979620087;
04380     x[ 7] = -0.74723049644956215785905512;
04381     x[ 8] = -0.68173195996974278626821595;
04382     x[ 9] = -0.61024234583637902730728751;
04383     x[10] = -0.53338990478634764354889426;
04384     x[11] = -0.45185001727245069572599328;
04385     x[12] = -0.36633925774807334107022062;
04386     x[13] = -0.27760909715249702940324807;
04387     x[14] = -0.18643929882799157233579876;
04388     x[15] = -0.09363106585473338567074292;
04389     x[16] =  0.00000000000000000000000000;
04390     x[17] =  0.09363106585473338567074292;
04391     x[18] =  0.18643929882799157233579876;
04392     x[19] =  0.27760909715249702940324807;
04393     x[20] =  0.36633925774807334107022062;
04394     x[21] =  0.45185001727245069572599328;
04395     x[22] =  0.53338990478634764354889426;
04396     x[23] =  0.61024234583637902730728751;
04397     x[24] =  0.68173195996974278626821595;
04398     x[25] =  0.74723049644956215785905512;
04399     x[26] =  0.80616235627416658979620087;
04400     x[27] =  0.85800965267650406464306148;
04401     x[28] =  0.90231676774343358304053133;
04402     x[29] =  0.93869437261116835035583512;
04403     x[30] =  0.96682290968999276892837771;
04404     x[31] =  0.98645572623064248811037570;
04405     x[32] =  0.99742469424645521726616802;
04406   }
04407   else {
04408     std::cerr << "\n";
04409     std::cerr << "LEGENDRE_LOOKUP_POINTS - Fatal error!\n";
04410     std::cerr << "  Illegal value of N = " << n << "\n";
04411     std::cerr << "  Legal values are 1 through 33.\n";
04412     std::exit(1);
04413   }
04414   return;
04415 }
04416 
04417 //****************************************************************************
04418 template<class Scalar> 
04419 void IntrepidBurkardtRules::legendre_lookup_weights ( int n, Scalar w[] )
04420 //****************************************************************************
04421 //
04422 //  Purpose:
04423 //
04424 //    LEGENDRE_LOOKUP_WEIGHTS looks up weights for Gauss-Legendre quadrature.
04425 //
04426 //  Licensing:
04427 //
04428 //    This code is distributed under the GNU LGPL license.
04429 //
04430 //  Modified:
04431 //
04432 //    27 April 2010
04433 //
04434 //  Author:
04435 //
04436 //    John Burkardt
04437 //
04438 //  Reference:
04439 //
04440 //    Milton Abramowitz, Irene Stegun,
04441 //    Handbook of Mathematical Functions,
04442 //    National Bureau of Standards, 1964,
04443 //    ISBN: 0-486-61272-4,
04444 //    LC: QA47.A34.
04445 //
04446 //    Vladimir Krylov,
04447 //    Approximate Calculation of Integrals,
04448 //    Dover, 2006,
04449 //    ISBN: 0486445798.
04450 //    LC: QA311.K713.
04451 //
04452 //    Arthur Stroud, Don Secrest,
04453 //    Gaussian Quadrature Formulas,
04454 //    Prentice Hall, 1966,
04455 //    LC: QA299.4G3S7.
04456 //
04457 //    Stephen Wolfram,
04458 //    The Mathematica Book,
04459 //    Fourth Edition,
04460 //    Cambridge University Press, 1999,
04461 //    ISBN: 0-521-64314-7,
04462 //    LC: QA76.95.W65.
04463 //
04464 //    Daniel Zwillinger, editor,
04465 //    CRC Standard Mathematical Tables and Formulae,
04466 //    30th Edition,
04467 //    CRC Press, 1996,
04468 //    ISBN: 0-8493-2479-3,
04469 //    LC: QA47.M315.
04470 //
04471 //  Parameters:
04472 //
04473 //    Input, int N, the order.
04474 //    N must be between 1 and 33.
04475 //
04476 //    Output, Scalar W[N], the weights.
04477 //
04478 {
04479   if (n==1) {
04480     w[ 0] = 2.000000000000000000000000000000;
04481   }
04482   else if (n==2) {
04483     w[ 0] = 1.000000000000000000000000000000;
04484     w[ 1] = 1.000000000000000000000000000000;
04485   }
04486   else if (n==3) {
04487     w[ 0] = 0.555555555555555555555555555556;
04488     w[ 1] = 0.888888888888888888888888888889;
04489     w[ 2] = 0.555555555555555555555555555556;
04490   }
04491   else if (n==4) {
04492     w[ 0] = 0.347854845137453857373063949222;
04493     w[ 1] = 0.652145154862546142626936050778;
04494     w[ 2] = 0.652145154862546142626936050778;
04495     w[ 3] = 0.347854845137453857373063949222;
04496   }
04497   else if (n==5) {
04498     w[ 0] = 0.236926885056189087514264040720;
04499     w[ 1] = 0.478628670499366468041291514836;
04500     w[ 2] = 0.568888888888888888888888888889;
04501     w[ 3] = 0.478628670499366468041291514836;
04502     w[ 4] = 0.236926885056189087514264040720;
04503   }
04504   else if (n==6) {
04505     w[ 0] = 0.171324492379170345040296142173;
04506     w[ 1] = 0.360761573048138607569833513838;
04507     w[ 2] = 0.467913934572691047389870343990;
04508     w[ 3] = 0.467913934572691047389870343990;
04509     w[ 4] = 0.360761573048138607569833513838;
04510     w[ 5] = 0.171324492379170345040296142173;
04511   }
04512   else if (n==7) {
04513     w[ 0] = 0.129484966168869693270611432679;
04514     w[ 1] = 0.279705391489276667901467771424;
04515     w[ 2] = 0.381830050505118944950369775489;
04516     w[ 3] = 0.417959183673469387755102040816;
04517     w[ 4] = 0.381830050505118944950369775489;
04518     w[ 5] = 0.279705391489276667901467771424;
04519     w[ 6] = 0.129484966168869693270611432679;
04520   }
04521   else if (n==8) {
04522     w[ 0] = 0.101228536290376259152531354310;
04523     w[ 1] = 0.222381034453374470544355994426;
04524     w[ 2] = 0.313706645877887287337962201987;
04525     w[ 3] = 0.362683783378361982965150449277;
04526     w[ 4] = 0.362683783378361982965150449277;
04527     w[ 5] = 0.313706645877887287337962201987;
04528     w[ 6] = 0.222381034453374470544355994426;
04529     w[ 7] = 0.101228536290376259152531354310;
04530   }
04531   else if (n==9) {
04532     w[ 0] = 0.081274388361574411971892158111;
04533     w[ 1] = 0.18064816069485740405847203124;
04534     w[ 2] = 0.26061069640293546231874286942;
04535     w[ 3] = 0.31234707704000284006863040658;
04536     w[ 4] = 0.33023935500125976316452506929;
04537     w[ 5] = 0.31234707704000284006863040658;
04538     w[ 6] = 0.26061069640293546231874286942;
04539     w[ 7] = 0.18064816069485740405847203124;
04540     w[ 8] = 0.081274388361574411971892158111;
04541   }
04542   else if (n==10) {
04543     w[ 0] = 0.066671344308688137593568809893;
04544     w[ 1] = 0.14945134915058059314577633966;
04545     w[ 2] = 0.21908636251598204399553493423;
04546     w[ 3] = 0.26926671930999635509122692157;
04547     w[ 4] = 0.29552422471475287017389299465;
04548     w[ 5] = 0.29552422471475287017389299465;
04549     w[ 6] = 0.26926671930999635509122692157;
04550     w[ 7] = 0.21908636251598204399553493423;
04551     w[ 8] = 0.14945134915058059314577633966;
04552     w[ 9] = 0.066671344308688137593568809893;
04553   }
04554   else if (n==11) {
04555     w[ 0] = 0.055668567116173666482753720443;
04556     w[ 1] = 0.12558036946490462463469429922;
04557     w[ 2] = 0.18629021092773425142609764143;
04558     w[ 3] = 0.23319376459199047991852370484;
04559     w[ 4] = 0.26280454451024666218068886989;
04560     w[ 5] = 0.27292508677790063071448352834;
04561     w[ 6] = 0.26280454451024666218068886989;
04562     w[ 7] = 0.23319376459199047991852370484;
04563     w[ 8] = 0.18629021092773425142609764143;
04564     w[ 9] = 0.12558036946490462463469429922;
04565     w[10] = 0.055668567116173666482753720443;
04566   }
04567   else if (n==12) {
04568     w[ 0] = 0.047175336386511827194615961485;
04569     w[ 1] = 0.10693932599531843096025471819;
04570     w[ 2] = 0.16007832854334622633465252954;
04571     w[ 3] = 0.20316742672306592174906445581;
04572     w[ 4] = 0.23349253653835480876084989892;
04573     w[ 5] = 0.24914704581340278500056243604;
04574     w[ 6] = 0.24914704581340278500056243604;
04575     w[ 7] = 0.23349253653835480876084989892;
04576     w[ 8] = 0.20316742672306592174906445581;
04577     w[ 9] = 0.16007832854334622633465252954;
04578     w[10] = 0.10693932599531843096025471819;
04579     w[11] = 0.047175336386511827194615961485;
04580   }
04581   else if (n==13) {
04582     w[ 0] = 0.040484004765315879520021592201;
04583     w[ 1] = 0.092121499837728447914421775954;
04584     w[ 2] = 0.13887351021978723846360177687;
04585     w[ 3] = 0.17814598076194573828004669200;
04586     w[ 4] = 0.20781604753688850231252321931;
04587     w[ 5] = 0.22628318026289723841209018604;
04588     w[ 6] = 0.23255155323087391019458951527;
04589     w[ 7] = 0.22628318026289723841209018604;
04590     w[ 8] = 0.20781604753688850231252321931;
04591     w[ 9] = 0.17814598076194573828004669200;
04592     w[10] = 0.13887351021978723846360177687;
04593     w[11] = 0.092121499837728447914421775954;
04594     w[12] = 0.040484004765315879520021592201;
04595   }
04596   else if (n==14) {
04597     w[ 0] = 0.035119460331751863031832876138;
04598     w[ 1] = 0.08015808715976020980563327706;
04599     w[ 2] = 0.12151857068790318468941480907;
04600     w[ 3] = 0.15720316715819353456960193862;
04601     w[ 4] = 0.18553839747793781374171659013;
04602     w[ 5] = 0.20519846372129560396592406566;
04603     w[ 6] = 0.21526385346315779019587644332;
04604     w[ 7] = 0.21526385346315779019587644332;
04605     w[ 8] = 0.20519846372129560396592406566;
04606     w[ 9] = 0.18553839747793781374171659013;
04607     w[10] = 0.15720316715819353456960193862;
04608     w[11] = 0.12151857068790318468941480907;
04609     w[12] = 0.08015808715976020980563327706;
04610     w[13] = 0.035119460331751863031832876138;
04611   }
04612   else if (n==15) {
04613     w[ 0] = 0.030753241996117268354628393577;
04614     w[ 1] = 0.070366047488108124709267416451;
04615     w[ 2] = 0.107159220467171935011869546686;
04616     w[ 3] = 0.13957067792615431444780479451;
04617     w[ 4] = 0.16626920581699393355320086048;
04618     w[ 5] = 0.18616100001556221102680056187;
04619     w[ 6] = 0.19843148532711157645611832644;
04620     w[ 7] = 0.20257824192556127288062019997;
04621     w[ 8] = 0.19843148532711157645611832644;
04622     w[ 9] = 0.18616100001556221102680056187;
04623     w[10] = 0.16626920581699393355320086048;
04624     w[11] = 0.13957067792615431444780479451;
04625     w[12] = 0.107159220467171935011869546686;
04626     w[13] = 0.070366047488108124709267416451;
04627     w[14] = 0.030753241996117268354628393577;
04628   }
04629   else if (n==16) {
04630     w[ 0] = 0.027152459411754094851780572456;
04631     w[ 1] = 0.062253523938647892862843836994;
04632     w[ 2] = 0.09515851168249278480992510760;
04633     w[ 3] = 0.12462897125553387205247628219;
04634     w[ 4] = 0.14959598881657673208150173055;
04635     w[ 5] = 0.16915651939500253818931207903;
04636     w[ 6] = 0.18260341504492358886676366797;
04637     w[ 7] = 0.18945061045506849628539672321;
04638     w[ 8] = 0.18945061045506849628539672321;
04639     w[ 9] = 0.18260341504492358886676366797;
04640     w[10] = 0.16915651939500253818931207903;
04641     w[11] = 0.14959598881657673208150173055;
04642     w[12] = 0.12462897125553387205247628219;
04643     w[13] = 0.09515851168249278480992510760;
04644     w[14] = 0.062253523938647892862843836994;
04645     w[15] = 0.027152459411754094851780572456;
04646   }
04647   else if (n==17) {
04648     w[ 0] = 0.024148302868547931960110026288;
04649     w[ 1] = 0.055459529373987201129440165359;
04650     w[ 2] = 0.085036148317179180883535370191;
04651     w[ 3] = 0.111883847193403971094788385626;
04652     w[ 4] = 0.13513636846852547328631998170;
04653     w[ 5] = 0.15404576107681028808143159480;
04654     w[ 6] = 0.16800410215645004450997066379;
04655     w[ 7] = 0.17656270536699264632527099011;
04656     w[ 8] = 0.17944647035620652545826564426;
04657     w[ 9] = 0.17656270536699264632527099011;
04658     w[10] = 0.16800410215645004450997066379;
04659     w[11] = 0.15404576107681028808143159480;
04660     w[12] = 0.13513636846852547328631998170;
04661     w[13] = 0.111883847193403971094788385626;
04662     w[14] = 0.085036148317179180883535370191;
04663     w[15] = 0.055459529373987201129440165359;
04664     w[16] = 0.024148302868547931960110026288;
04665   }
04666   else if (n==18) {
04667     w[ 0] = 0.021616013526483310313342710266;
04668     w[ 1] = 0.049714548894969796453334946203;
04669     w[ 2] = 0.07642573025488905652912967762;
04670     w[ 3] = 0.10094204410628716556281398492;
04671     w[ 4] = 0.12255520671147846018451912680;
04672     w[ 5] = 0.14064291467065065120473130375;
04673     w[ 6] = 0.15468467512626524492541800384;
04674     w[ 7] = 0.16427648374583272298605377647;
04675     w[ 8] = 0.16914238296314359184065647013;
04676     w[ 9] = 0.16914238296314359184065647013;
04677     w[10] = 0.16427648374583272298605377647;
04678     w[11] = 0.15468467512626524492541800384;
04679     w[12] = 0.14064291467065065120473130375;
04680     w[13] = 0.12255520671147846018451912680;
04681     w[14] = 0.10094204410628716556281398492;
04682     w[15] = 0.07642573025488905652912967762;
04683     w[16] = 0.049714548894969796453334946203;
04684     w[17] = 0.021616013526483310313342710266;
04685   }
04686   else if (n==19) {
04687     w[ 0] = 0.019461788229726477036312041464;
04688     w[ 1] = 0.044814226765699600332838157402;
04689     w[ 2] = 0.069044542737641226580708258006;
04690     w[ 3] = 0.091490021622449999464462094124;
04691     w[ 4] = 0.111566645547333994716023901682;
04692     w[ 5] = 0.12875396253933622767551578486;
04693     w[ 6] = 0.14260670217360661177574610944;
04694     w[ 7] = 0.15276604206585966677885540090;
04695     w[ 8] = 0.15896884339395434764995643946;
04696     w[ 9] = 0.16105444984878369597916362532;
04697     w[10] = 0.15896884339395434764995643946;
04698     w[11] = 0.15276604206585966677885540090;
04699     w[12] = 0.14260670217360661177574610944;
04700     w[13] = 0.12875396253933622767551578486;
04701     w[14] = 0.111566645547333994716023901682;
04702     w[15] = 0.091490021622449999464462094124;
04703     w[16] = 0.069044542737641226580708258006;
04704     w[17] = 0.044814226765699600332838157402;
04705     w[18] = 0.019461788229726477036312041464;
04706   }
04707   else if (n==20) {
04708     w[ 0] = 0.017614007139152118311861962352;
04709     w[ 1] = 0.040601429800386941331039952275;
04710     w[ 2] = 0.062672048334109063569506535187;
04711     w[ 3] = 0.08327674157670474872475814322;
04712     w[ 4] = 0.10193011981724043503675013548;
04713     w[ 5] = 0.11819453196151841731237737771;
04714     w[ 6] = 0.13168863844917662689849449975;
04715     w[ 7] = 0.14209610931838205132929832507;
04716     w[ 8] = 0.14917298647260374678782873700;
04717     w[ 9] = 0.15275338713072585069808433195;
04718     w[10] = 0.15275338713072585069808433195;
04719     w[11] = 0.14917298647260374678782873700;
04720     w[12] = 0.14209610931838205132929832507;
04721     w[13] = 0.13168863844917662689849449975;
04722     w[14] = 0.11819453196151841731237737771;
04723     w[15] = 0.10193011981724043503675013548;
04724     w[16] = 0.08327674157670474872475814322;
04725     w[17] = 0.062672048334109063569506535187;
04726     w[18] = 0.040601429800386941331039952275;
04727     w[19] = 0.017614007139152118311861962352;
04728   }
04729   else if (n==21) {
04730     w[ 0] =   0.016017228257774333324224616858;
04731     w[ 1] =   0.036953789770852493799950668299;
04732     w[ 2] =   0.057134425426857208283635826472;
04733     w[ 3] =   0.076100113628379302017051653300;
04734     w[ 4] =   0.093444423456033861553289741114;
04735     w[ 5] =   0.108797299167148377663474578070;
04736     w[ 6] =   0.12183141605372853419536717713;
04737     w[ 7] =   0.13226893863333746178105257450;
04738     w[ 8] =   0.13988739479107315472213342387;
04739     w[ 9] =   0.14452440398997005906382716655;
04740     w[10] =   0.14608113364969042719198514768;
04741     w[11] =   0.14452440398997005906382716655;
04742     w[12] =   0.13988739479107315472213342387;
04743     w[13] =   0.13226893863333746178105257450;
04744     w[14] =   0.12183141605372853419536717713;
04745     w[15] =   0.108797299167148377663474578070;
04746     w[16] =   0.093444423456033861553289741114;
04747     w[17] =   0.076100113628379302017051653300;
04748     w[18] =   0.057134425426857208283635826472;
04749     w[19] =   0.036953789770852493799950668299;
04750     w[20] =   0.016017228257774333324224616858;
04751   }
04752   else if (n==22) {
04753     w[ 0] = 0.014627995298272200684991098047;
04754     w[ 1] = 0.033774901584814154793302246866;
04755     w[ 2] = 0.052293335152683285940312051273;
04756     w[ 3] = 0.06979646842452048809496141893;
04757     w[ 4] = 0.08594160621706772741444368137;
04758     w[ 5] = 0.10041414444288096493207883783;
04759     w[ 6] = 0.11293229608053921839340060742;
04760     w[ 7] = 0.12325237681051242428556098615;
04761     w[ 8] = 0.13117350478706237073296499253;
04762     w[ 9] = 0.13654149834601517135257383123;
04763     w[10] = 0.13925187285563199337541024834;
04764     w[11] = 0.13925187285563199337541024834;
04765     w[12] = 0.13654149834601517135257383123;
04766     w[13] = 0.13117350478706237073296499253;
04767     w[14] = 0.12325237681051242428556098615;
04768     w[15] = 0.11293229608053921839340060742;
04769     w[16] = 0.10041414444288096493207883783;
04770     w[17] = 0.08594160621706772741444368137;
04771     w[18] = 0.06979646842452048809496141893;
04772     w[19] = 0.052293335152683285940312051273;
04773     w[20] = 0.033774901584814154793302246866;
04774     w[21] = 0.014627995298272200684991098047;
04775   }
04776   else if (n==23) {
04777     w[ 0] = 0.013411859487141772081309493459;
04778     w[ 1] = 0.030988005856979444310694219642;
04779     w[ 2] = 0.048037671731084668571641071632;
04780     w[ 3] = 0.064232421408525852127169615159;
04781     w[ 4] = 0.079281411776718954922892524742;
04782     w[ 5] = 0.092915766060035147477018617370;
04783     w[ 6] = 0.104892091464541410074086185015;
04784     w[ 7] = 0.11499664022241136494164351293;
04785     w[ 8] = 0.12304908430672953046757840067;
04786     w[ 9] = 0.12890572218808214997859533940;
04787     w[10] = 0.13246203940469661737164246470;
04788     w[11] = 0.13365457218610617535145711055;
04789     w[12] = 0.13246203940469661737164246470;
04790     w[13] = 0.12890572218808214997859533940;
04791     w[14] = 0.12304908430672953046757840067;
04792     w[15] = 0.11499664022241136494164351293;
04793     w[16] = 0.104892091464541410074086185015;
04794     w[17] = 0.092915766060035147477018617370;
04795     w[18] = 0.079281411776718954922892524742;
04796     w[19] = 0.064232421408525852127169615159;
04797     w[20] = 0.048037671731084668571641071632;
04798     w[21] = 0.030988005856979444310694219642;
04799     w[22] = 0.013411859487141772081309493459;
04800   }
04801   else if (n==24) {
04802     w[ 0] = 0.012341229799987199546805667070;
04803     w[ 1] = 0.028531388628933663181307815952;
04804     w[ 2] = 0.044277438817419806168602748211;
04805     w[ 3] = 0.059298584915436780746367758500;
04806     w[ 4] = 0.07334648141108030573403361525;
04807     w[ 5] = 0.08619016153195327591718520298;
04808     w[ 6] = 0.09761865210411388826988066446;
04809     w[ 7] = 0.10744427011596563478257734245;
04810     w[ 8] = 0.11550566805372560135334448391;
04811     w[ 9] = 0.12167047292780339120446315348;
04812     w[10] = 0.12583745634682829612137538251;
04813     w[11] = 0.12793819534675215697405616522;
04814     w[12] = 0.12793819534675215697405616522;
04815     w[13] = 0.12583745634682829612137538251;
04816     w[14] = 0.12167047292780339120446315348;
04817     w[15] = 0.11550566805372560135334448391;
04818     w[16] = 0.10744427011596563478257734245;
04819     w[17] = 0.09761865210411388826988066446;
04820     w[18] = 0.08619016153195327591718520298;
04821     w[19] = 0.07334648141108030573403361525;
04822     w[20] = 0.059298584915436780746367758500;
04823     w[21] = 0.044277438817419806168602748211;
04824     w[22] = 0.028531388628933663181307815952;
04825     w[23] = 0.012341229799987199546805667070;
04826   }
04827   else if (n==25) {
04828     w[ 0] = 0.0113937985010262879479029641132;
04829     w[ 1] = 0.026354986615032137261901815295;
04830     w[ 2] = 0.040939156701306312655623487712;
04831     w[ 3] = 0.054904695975835191925936891541;
04832     w[ 4] = 0.068038333812356917207187185657;
04833     w[ 5] = 0.080140700335001018013234959669;
04834     w[ 6] = 0.091028261982963649811497220703;
04835     w[ 7] = 0.100535949067050644202206890393;
04836     w[ 8] = 0.108519624474263653116093957050;
04837     w[ 9] = 0.11485825914571164833932554587;
04838     w[10] = 0.11945576353578477222817812651;
04839     w[11] = 0.12224244299031004168895951895;
04840     w[12] = 0.12317605372671545120390287308;
04841     w[13] = 0.12224244299031004168895951895;
04842     w[14] = 0.11945576353578477222817812651;
04843     w[15] = 0.11485825914571164833932554587;
04844     w[16] = 0.108519624474263653116093957050;
04845     w[17] = 0.100535949067050644202206890393;
04846     w[18] = 0.091028261982963649811497220703;
04847     w[19] = 0.080140700335001018013234959669;
04848     w[20] = 0.068038333812356917207187185657;
04849     w[21] = 0.054904695975835191925936891541;
04850     w[22] = 0.040939156701306312655623487712;
04851     w[23] = 0.026354986615032137261901815295;
04852     w[24] = 0.0113937985010262879479029641132;
04853   }
04854   else if (n==26) {
04855     w[ 0] = 0.010551372617343007155651187685;
04856     w[ 1] = 0.024417851092631908789615827520;
04857     w[ 2] = 0.037962383294362763950303141249;
04858     w[ 3] = 0.050975825297147811998319900724;
04859     w[ 4] = 0.063274046329574835539453689907;
04860     w[ 5] = 0.07468414976565974588707579610;
04861     w[ 6] = 0.08504589431348523921044776508;
04862     w[ 7] = 0.09421380035591414846366488307;
04863     w[ 8] = 0.10205916109442542323841407025;
04864     w[ 9] = 0.10847184052857659065657942673;
04865     w[10] = 0.11336181654631966654944071844;
04866     w[11] = 0.11666044348529658204466250754;
04867     w[12] = 0.11832141527926227651637108570;
04868     w[13] = 0.11832141527926227651637108570;
04869     w[14] = 0.11666044348529658204466250754;
04870     w[15] = 0.11336181654631966654944071844;
04871     w[16] = 0.10847184052857659065657942673;
04872     w[17] = 0.10205916109442542323841407025;
04873     w[18] = 0.09421380035591414846366488307;
04874     w[19] = 0.08504589431348523921044776508;
04875     w[20] = 0.07468414976565974588707579610;
04876     w[21] = 0.063274046329574835539453689907;
04877     w[22] = 0.050975825297147811998319900724;
04878     w[23] = 0.037962383294362763950303141249;
04879     w[24] = 0.024417851092631908789615827520;
04880     w[25] = 0.010551372617343007155651187685;
04881   }
04882   else if (n==27) {
04883     w[ 0] = 0.0097989960512943602611500550912;
04884     w[ 1] = 0.022686231596180623196034206447;
04885     w[ 2] = 0.035297053757419711022578289305;
04886     w[ 3] = 0.047449412520615062704096710114;
04887     w[ 4] = 0.058983536859833599110300833720;
04888     w[ 5] = 0.069748823766245592984322888357;
04889     w[ 6] = 0.079604867773057771263074959010;
04890     w[ 7] = 0.088423158543756950194322802854;
04891     w[ 8] = 0.096088727370028507565652646558;
04892     w[ 9] = 0.102501637817745798671247711533;
04893     w[10] = 0.107578285788533187212162984427;
04894     w[11] = 0.111252488356845192672163096043;
04895     w[12] = 0.113476346108965148620369948092;
04896     w[13] = 0.11422086737895698904504573690;
04897     w[14] = 0.113476346108965148620369948092;
04898     w[15] = 0.111252488356845192672163096043;
04899     w[16] = 0.107578285788533187212162984427;
04900     w[17] = 0.102501637817745798671247711533;
04901     w[18] = 0.096088727370028507565652646558;
04902     w[19] = 0.088423158543756950194322802854;
04903     w[20] = 0.079604867773057771263074959010;
04904     w[21] = 0.069748823766245592984322888357;
04905     w[22] = 0.058983536859833599110300833720;
04906     w[23] = 0.047449412520615062704096710114;
04907     w[24] = 0.035297053757419711022578289305;
04908     w[25] = 0.022686231596180623196034206447;
04909     w[26] = 0.0097989960512943602611500550912;
04910   }
04911   else if (n==28) {
04912     w[ 0] = 0.009124282593094517738816153923;
04913     w[ 1] = 0.021132112592771259751500380993;
04914     w[ 2] = 0.032901427782304379977630819171;
04915     w[ 3] = 0.044272934759004227839587877653;
04916     w[ 4] = 0.055107345675716745431482918227;
04917     w[ 5] = 0.06527292396699959579339756678;
04918     w[ 6] = 0.07464621423456877902393188717;
04919     w[ 7] = 0.08311341722890121839039649824;
04920     w[ 8] = 0.09057174439303284094218603134;
04921     w[ 9] = 0.09693065799792991585048900610;
04922     w[10] = 0.10211296757806076981421663851;
04923     w[11] = 0.10605576592284641791041643700;
04924     w[12] = 0.10871119225829413525357151930;
04925     w[13] = 0.11004701301647519628237626560;
04926     w[14] = 0.11004701301647519628237626560;
04927     w[15] = 0.10871119225829413525357151930;
04928     w[16] = 0.10605576592284641791041643700;
04929     w[17] = 0.10211296757806076981421663851;
04930     w[18] = 0.09693065799792991585048900610;
04931     w[19] = 0.09057174439303284094218603134;
04932     w[20] = 0.08311341722890121839039649824;
04933     w[21] = 0.07464621423456877902393188717;
04934     w[22] = 0.06527292396699959579339756678;
04935     w[23] = 0.055107345675716745431482918227;
04936     w[24] = 0.044272934759004227839587877653;
04937     w[25] = 0.032901427782304379977630819171;
04938     w[26] = 0.021132112592771259751500380993;
04939     w[27] = 0.009124282593094517738816153923;
04940   }
04941   else if (n==29) {
04942     w[ 0] = 0.0085169038787464096542638133022;
04943     w[ 1] = 0.019732085056122705983859801640;
04944     w[ 2] = 0.030740492202093622644408525375;
04945     w[ 3] = 0.041402062518682836104830010114;
04946     w[ 4] = 0.051594826902497923912594381180;
04947     w[ 5] = 0.061203090657079138542109848024;
04948     w[ 6] = 0.070117933255051278569581486949;
04949     w[ 7] = 0.078238327135763783828144888660;
04950     w[ 8] = 0.085472257366172527545344849297;
04951     w[ 9] = 0.091737757139258763347966411077;
04952     w[10] = 0.096963834094408606301900074883;
04953     w[11] = 0.101091273759914966121820546907;
04954     w[12] = 0.104073310077729373913328471285;
04955     w[13] = 0.105876155097320941406591327852;
04956     w[14] = 0.10647938171831424424651112691;
04957     w[15] = 0.105876155097320941406591327852;
04958     w[16] = 0.104073310077729373913328471285;
04959     w[17] = 0.101091273759914966121820546907;
04960     w[18] = 0.096963834094408606301900074883;
04961     w[19] = 0.091737757139258763347966411077;
04962     w[20] = 0.085472257366172527545344849297;
04963     w[21] = 0.078238327135763783828144888660;
04964     w[22] = 0.070117933255051278569581486949;
04965     w[23] = 0.061203090657079138542109848024;
04966     w[24] = 0.051594826902497923912594381180;
04967     w[25] = 0.041402062518682836104830010114;
04968     w[26] = 0.030740492202093622644408525375;
04969     w[27] = 0.019732085056122705983859801640;
04970     w[28] = 0.0085169038787464096542638133022;
04971   }
04972   else if (n==30) {
04973     w[ 0] = 0.007968192496166605615465883475;
04974     w[ 1] = 0.018466468311090959142302131912;
04975     w[ 2] = 0.028784707883323369349719179611;
04976     w[ 3] = 0.038799192569627049596801936446;
04977     w[ 4] = 0.048402672830594052902938140423;
04978     w[ 5] = 0.057493156217619066481721689402;
04979     w[ 6] = 0.06597422988218049512812851512;
04980     w[ 7] = 0.07375597473770520626824385002;
04981     w[ 8] = 0.08075589522942021535469493846;
04982     w[ 9] = 0.08689978720108297980238753072;
04983     w[10] = 0.09212252223778612871763270709;
04984     w[11] = 0.09636873717464425963946862635;
04985     w[12] = 0.09959342058679526706278028210;
04986     w[13] = 0.10176238974840550459642895217;
04987     w[14] = 0.10285265289355884034128563671;
04988     w[15] = 0.10285265289355884034128563671;
04989     w[16] = 0.10176238974840550459642895217;
04990     w[17] = 0.09959342058679526706278028210;
04991     w[18] = 0.09636873717464425963946862635;
04992     w[19] = 0.09212252223778612871763270709;
04993     w[20] = 0.08689978720108297980238753072;
04994     w[21] = 0.08075589522942021535469493846;
04995     w[22] = 0.07375597473770520626824385002;
04996     w[23] = 0.06597422988218049512812851512;
04997     w[24] = 0.057493156217619066481721689402;
04998     w[25] = 0.048402672830594052902938140423;
04999     w[26] = 0.038799192569627049596801936446;
05000     w[27] = 0.028784707883323369349719179611;
05001     w[28] = 0.018466468311090959142302131912;
05002     w[29] = 0.007968192496166605615465883475;
05003   }
05004   else if (n==31) {
05005     w[ 0] = 0.0074708315792487758586968750322;
05006     w[ 1] = 0.017318620790310582463157996087;
05007     w[ 2] = 0.027009019184979421800608708092;
05008     w[ 3] = 0.036432273912385464024392010468;
05009     w[ 4] = 0.045493707527201102902315857895;
05010     w[ 5] = 0.054103082424916853711666259087;
05011     w[ 6] = 0.062174786561028426910343543687;
05012     w[ 7] = 0.069628583235410366167756126255;
05013     w[ 8] = 0.076390386598776616426357674901;
05014     w[ 9] = 0.082392991761589263903823367432;
05015     w[10] = 0.087576740608477876126198069695;
05016     w[11] = 0.091890113893641478215362871607;
05017     w[12] = 0.095290242912319512807204197488;
05018     w[13] = 0.097743335386328725093474010979;
05019     w[14] = 0.099225011226672307874875514429;
05020     w[15] = 0.09972054479342645142753383373;
05021     w[16] = 0.099225011226672307874875514429;
05022     w[17] = 0.097743335386328725093474010979;
05023     w[18] = 0.095290242912319512807204197488;
05024     w[19] = 0.091890113893641478215362871607;
05025     w[20] = 0.087576740608477876126198069695;
05026     w[21] = 0.082392991761589263903823367432;
05027     w[22] = 0.076390386598776616426357674901;
05028     w[23] = 0.069628583235410366167756126255;
05029     w[24] = 0.062174786561028426910343543687;
05030     w[25] = 0.054103082424916853711666259087;
05031     w[26] = 0.045493707527201102902315857895;
05032     w[27] = 0.036432273912385464024392010468;
05033     w[28] = 0.027009019184979421800608708092;
05034     w[29] = 0.017318620790310582463157996087;
05035     w[30] = 0.0074708315792487758586968750322;
05036   }
05037   else if (n==32) {
05038     w[ 0] = 0.007018610009470096600407063739;
05039     w[ 1] = 0.016274394730905670605170562206;
05040     w[ 2] = 0.025392065309262059455752589789;
05041     w[ 3] = 0.034273862913021433102687732252;
05042     w[ 4] = 0.042835898022226680656878646606;
05043     w[ 5] = 0.050998059262376176196163244690;
05044     w[ 6] = 0.058684093478535547145283637300;
05045     w[ 7] = 0.06582222277636184683765006371;
05046     w[ 8] = 0.07234579410884850622539935648;
05047     w[ 9] = 0.07819389578707030647174091883;
05048     w[10] = 0.08331192422694675522219907460;
05049     w[11] = 0.08765209300440381114277146275;
05050     w[12] = 0.09117387869576388471286857711;
05051     w[13] = 0.09384439908080456563918023767;
05052     w[14] = 0.09563872007927485941908200220;
05053     w[15] = 0.09654008851472780056676483006;
05054     w[16] = 0.09654008851472780056676483006;
05055     w[17] = 0.09563872007927485941908200220;
05056     w[18] = 0.09384439908080456563918023767;
05057     w[19] = 0.09117387869576388471286857711;
05058     w[20] = 0.08765209300440381114277146275;
05059     w[21] = 0.08331192422694675522219907460;
05060     w[22] = 0.07819389578707030647174091883;
05061     w[23] = 0.07234579410884850622539935648;
05062     w[24] = 0.06582222277636184683765006371;
05063     w[25] = 0.058684093478535547145283637300;
05064     w[26] = 0.050998059262376176196163244690;
05065     w[27] = 0.042835898022226680656878646606;
05066     w[28] = 0.034273862913021433102687732252;
05067     w[29] = 0.025392065309262059455752589789;
05068     w[30] = 0.016274394730905670605170562206;
05069     w[31] = 0.007018610009470096600407063739;
05070   }
05071   else if (n==33) {
05072     w[ 0] = 0.0066062278475873780586492352085;
05073     w[ 1] = 0.015321701512934676127945768534;
05074     w[ 2] = 0.023915548101749480350533257529;
05075     w[ 3] = 0.032300358632328953281561447250;
05076     w[ 4] = 0.040401541331669591563409790527;
05077     w[ 5] = 0.048147742818711695670146880138;
05078     w[ 6] = 0.055470846631663561284944495439;
05079     w[ 7] = 0.062306482530317480031627725771;
05080     w[ 8] = 0.068594572818656712805955073015;
05081     w[ 9] = 0.074279854843954149342472175919;
05082     w[10] = 0.079312364794886738363908384942;
05083     w[11] = 0.083647876067038707613928014518;
05084     w[12] = 0.087248287618844337607281670945;
05085     w[13] = 0.090081958660638577239743705500;
05086     w[14] = 0.092123986643316846213240977717;
05087     w[15] = 0.093356426065596116160999126274;
05088     w[16] = 0.09376844616020999656730454155;
05089     w[17] = 0.093356426065596116160999126274;
05090     w[18] = 0.092123986643316846213240977717;
05091     w[19] = 0.090081958660638577239743705500;
05092     w[20] = 0.087248287618844337607281670945;
05093     w[21] = 0.083647876067038707613928014518;
05094     w[22] = 0.079312364794886738363908384942;
05095     w[23] = 0.074279854843954149342472175919;
05096     w[24] = 0.068594572818656712805955073015;
05097     w[25] = 0.062306482530317480031627725771;
05098     w[26] = 0.055470846631663561284944495439;
05099     w[27] = 0.048147742818711695670146880138;
05100     w[28] = 0.040401541331669591563409790527;
05101     w[29] = 0.032300358632328953281561447250;
05102     w[30] = 0.023915548101749480350533257529;
05103     w[31] = 0.015321701512934676127945768534;
05104     w[32] = 0.0066062278475873780586492352085;
05105   }
05106   else {
05107     std::cerr << "\n";
05108     std::cerr << "LEGENDRE_LOOKUP_WEIGHTS - Fatal error!\n";
05109     std::cerr << "  Illegal value of N = " << n << "\n";
05110     std::cerr << "  Legal values are 1 through 33.\n";
05111     std::exit(1);
05112   }
05113   return;
05114 }
05115 
05116 //****************************************************************************
05117 template<class Scalar> 
05118 void IntrepidBurkardtRules::patterson_lookup ( int n, Scalar x[], Scalar w[] )
05119 //****************************************************************************
05120 //
05121 //  Purpose:
05122 //
05123 //    PATTERSON_LOOKUP looks up Patterson quadrature points and weights.
05124 //
05125 //  Discussion:
05126 //
05127 //    Our convention is that the abscissas are numbered from left to right.
05128 //
05129 //    The rule is defined on [-1,1],
05130 //
05131 //  Licensing:
05132 //
05133 //    This code is distributed under the GNU LGPL license.
05134 //
05135 //  Modified:
05136 //
05137 //    11 February 2010
05138 //
05139 //  Author:
05140 //
05141 //    John Burkardt
05142 //
05143 //  Reference:
05144 //
05145 //    Prem Kythe, Michael Schaeferkotter,
05146 //    Handbook of Computational Methods for Integration,
05147 //    Chapman and Hall, 2004,
05148 //    ISBN: 1-58488-428-2,
05149 //    LC: QA299.3.K98.
05150 //
05151 //    Thomas Patterson,
05152 //    The Optimal Addition of Points to Quadrature Formulae,
05153 //    Mathematics of Computation,
05154 //    Volume 22, Number 104, October 1968, pages 847-856.
05155 //
05156 //  Parameters:
05157 //
05158 //    Input, int N, the order.
05159 //    Legal values are 1, 3, 7, 15, 31, 63, 127 and 255.
05160 //
05161 //    Output, Scalar X[N], the abscissas.
05162 //
05163 //    Output, Scalar W[N], the weights.
05164 //
05165 {
05166   IntrepidBurkardtRules::patterson_lookup_points ( n, x );
05167   IntrepidBurkardtRules::patterson_lookup_weights ( n, w );
05168 
05169   return;
05170 }
05171 
05172 //****************************************************************************
05173 template<class Scalar> 
05174 void IntrepidBurkardtRules::patterson_lookup_points ( int n, Scalar x[] )
05175 //****************************************************************************
05176 //
05177 //  Purpose:
05178 //
05179 //    PATTERSON_LOOKUP_POINTS looks up Patterson quadrature points.
05180 //
05181 //  Discussion:
05182 //
05183 //    Our convention is that the abscissas are numbered from left to right.
05184 //
05185 //    The rule is defined on [-1,1],
05186 //
05187 //  Licensing:
05188 //
05189 //    This code is distributed under the GNU LGPL license.
05190 //
05191 //  Modified:
05192 //
05193 //    17 December 2009
05194 //
05195 //  Author:
05196 //
05197 //    John Burkardt
05198 //
05199 //  Reference:
05200 //
05201 //    Prem Kythe, Michael Schaeferkotter,
05202 //    Handbook of Computational Methods for Integration,
05203 //    Chapman and Hall, 2004,
05204 //    ISBN: 1-58488-428-2,
05205 //    LC: QA299.3.K98.
05206 //
05207 //    Thomas Patterson,
05208 //    The Optimal Addition of Points to Quadrature Formulae,
05209 //    Mathematics of Computation,
05210 //    Volume 22, Number 104, October 1968, pages 847-856.
05211 //
05212 //  Parameters:
05213 //
05214 //    Input, int N, the order.
05215 //    Legal values are 1, 3, 7, 15, 31, 63, 127 and 255.
05216 //
05217 //    Output, Scalar X[N], the abscissas.
05218 //
05219 {
05220   if (n==1) {
05221     x[ 0] =  0.0;
05222   }
05223   else if (n==3) {
05224     x[ 0] = -0.77459666924148337704;
05225     x[ 1] =  0.0;
05226     x[ 2] =  0.77459666924148337704;
05227   }
05228   else if (n==7) {
05229     x[ 0] = -0.96049126870802028342;
05230     x[ 1] = -0.77459666924148337704;
05231     x[ 2] = -0.43424374934680255800;
05232     x[ 3] =  0.0;
05233     x[ 4] =  0.43424374934680255800;
05234     x[ 5] =  0.77459666924148337704;
05235     x[ 6] =  0.96049126870802028342;
05236   }
05237   else if (n==15) {
05238     x[ 0] = -0.99383196321275502221;
05239     x[ 1] = -0.96049126870802028342;
05240     x[ 2] = -0.88845923287225699889;
05241     x[ 3] = -0.77459666924148337704;
05242     x[ 4] = -0.62110294673722640294;
05243     x[ 5] = -0.43424374934680255800;
05244     x[ 6] = -0.22338668642896688163;
05245     x[ 7] =  0.0;
05246     x[ 8] =  0.22338668642896688163;
05247     x[ 9] =  0.43424374934680255800;
05248     x[10] =  0.62110294673722640294;
05249     x[11] =  0.77459666924148337704;
05250     x[12] =  0.88845923287225699889;
05251     x[13] =  0.96049126870802028342;
05252     x[14] =  0.99383196321275502221;
05253   }
05254   else if (n==31) {
05255     x[ 0] = -0.99909812496766759766;
05256     x[ 1] = -0.99383196321275502221;
05257     x[ 2] = -0.98153114955374010687;
05258     x[ 3] = -0.96049126870802028342;
05259     x[ 4] = -0.92965485742974005667;
05260     x[ 5] = -0.88845923287225699889;
05261     x[ 6] = -0.83672593816886873550;
05262     x[ 7] = -0.77459666924148337704;
05263     x[ 8] = -0.70249620649152707861;
05264     x[ 9] = -0.62110294673722640294;
05265     x[10] = -0.53131974364437562397;
05266     x[11] = -0.43424374934680255800;
05267     x[12] = -0.33113539325797683309;
05268     x[13] = -0.22338668642896688163;
05269     x[14] = -0.11248894313318662575;
05270     x[15] =  0.0;
05271     x[16] =  0.11248894313318662575;
05272     x[17] =  0.22338668642896688163;
05273     x[18] =  0.33113539325797683309;
05274     x[19] =  0.43424374934680255800;
05275     x[20] =  0.53131974364437562397;
05276     x[21] =  0.62110294673722640294;
05277     x[22] =  0.70249620649152707861;
05278     x[23] =  0.77459666924148337704;
05279     x[24] =  0.83672593816886873550;
05280     x[25] =  0.88845923287225699889;
05281     x[26] =  0.92965485742974005667;
05282     x[27] =  0.96049126870802028342;
05283     x[28] =  0.98153114955374010687;
05284     x[29] =  0.99383196321275502221;
05285     x[30] =  0.99909812496766759766;
05286   }
05287   else if (n==63) {
05288     x[ 0] = -0.99987288812035761194;
05289     x[ 1] = -0.99909812496766759766;
05290     x[ 2] = -0.99720625937222195908;
05291     x[ 3] = -0.99383196321275502221;
05292     x[ 4] = -0.98868475754742947994;
05293     x[ 5] = -0.98153114955374010687;
05294     x[ 6] = -0.97218287474858179658;
05295     x[ 7] = -0.96049126870802028342;
05296     x[ 8] = -0.94634285837340290515;
05297     x[ 9] = -0.92965485742974005667;
05298     x[10] = -0.91037115695700429250;
05299     x[11] = -0.88845923287225699889;
05300     x[12] = -0.86390793819369047715;
05301     x[13] = -0.83672593816886873550;
05302     x[14] = -0.80694053195021761186;
05303     x[15] = -0.77459666924148337704;
05304     x[16] = -0.73975604435269475868;
05305     x[17] = -0.70249620649152707861;
05306     x[18] = -0.66290966002478059546;
05307     x[19] = -0.62110294673722640294;
05308     x[20] = -0.57719571005204581484;
05309     x[21] = -0.53131974364437562397;
05310     x[22] = -0.48361802694584102756;
05311     x[23] = -0.43424374934680255800;
05312     x[24] = -0.38335932419873034692;
05313     x[25] = -0.33113539325797683309;
05314     x[26] = -0.27774982202182431507;
05315     x[27] = -0.22338668642896688163;
05316     x[28] = -0.16823525155220746498;
05317     x[29] = -0.11248894313318662575;
05318     x[30] = -0.056344313046592789972;
05319     x[31] =  0.0;
05320     x[32] =  0.056344313046592789972;
05321     x[33] =  0.11248894313318662575;
05322     x[34] =  0.16823525155220746498;
05323     x[35] =  0.22338668642896688163;
05324     x[36] =  0.27774982202182431507;
05325     x[37] =  0.33113539325797683309;
05326     x[38] =  0.38335932419873034692;
05327     x[39] =  0.43424374934680255800;
05328     x[40] =  0.48361802694584102756;
05329     x[41] =  0.53131974364437562397;
05330     x[42] =  0.57719571005204581484;
05331     x[43] =  0.62110294673722640294;
05332     x[44] =  0.66290966002478059546;
05333     x[45] =  0.70249620649152707861;
05334     x[46] =  0.73975604435269475868;
05335     x[47] =  0.77459666924148337704;
05336     x[48] =  0.80694053195021761186;
05337     x[49] =  0.83672593816886873550;
05338     x[50] =  0.86390793819369047715;
05339     x[51] =  0.88845923287225699889;
05340     x[52] =  0.91037115695700429250;
05341     x[53] =  0.92965485742974005667;
05342     x[54] =  0.94634285837340290515;
05343     x[55] =  0.96049126870802028342;
05344     x[56] =  0.97218287474858179658;
05345     x[57] =  0.98153114955374010687;
05346     x[58] =  0.98868475754742947994;
05347     x[59] =  0.99383196321275502221;
05348     x[60] =  0.99720625937222195908;
05349     x[61] =  0.99909812496766759766;
05350     x[62] =  0.99987288812035761194;
05351   }
05352   else if (n==127) {
05353     x[  0] = -0.99998243035489159858;
05354     x[  1] = -0.99987288812035761194;
05355     x[  2] = -0.99959879967191068325;
05356     x[  3] = -0.99909812496766759766;
05357     x[  4] = -0.99831663531840739253;
05358     x[  5] = -0.99720625937222195908;
05359     x[  6] = -0.99572410469840718851;
05360     x[  7] = -0.99383196321275502221;
05361     x[  8] = -0.99149572117810613240;
05362     x[  9] = -0.98868475754742947994;
05363     x[ 10] = -0.98537149959852037111;
05364     x[ 11] = -0.98153114955374010687;
05365     x[ 12] = -0.97714151463970571416;
05366     x[ 13] = -0.97218287474858179658;
05367     x[ 14] = -0.96663785155841656709;
05368     x[ 15] = -0.96049126870802028342;
05369     x[ 16] = -0.95373000642576113641;
05370     x[ 17] = -0.94634285837340290515;
05371     x[ 18] = -0.93832039777959288365;
05372     x[ 19] = -0.92965485742974005667;
05373     x[ 20] = -0.92034002547001242073;
05374     x[ 21] = -0.91037115695700429250;
05375     x[ 22] = -0.89974489977694003664;
05376     x[ 23] = -0.88845923287225699889;
05377     x[ 24] = -0.87651341448470526974;
05378     x[ 25] = -0.86390793819369047715;
05379     x[ 26] = -0.85064449476835027976;
05380     x[ 27] = -0.83672593816886873550;
05381     x[ 28] = -0.82215625436498040737;
05382     x[ 29] = -0.80694053195021761186;
05383     x[ 30] = -0.79108493379984836143;
05384     x[ 31] = -0.77459666924148337704;
05385     x[ 32] = -0.75748396638051363793;
05386     x[ 33] = -0.73975604435269475868;
05387     x[ 34] = -0.72142308537009891548;
05388     x[ 35] = -0.70249620649152707861;
05389     x[ 36] = -0.68298743109107922809;
05390     x[ 37] = -0.66290966002478059546;
05391     x[ 38] = -0.64227664250975951377;
05392     x[ 39] = -0.62110294673722640294;
05393     x[ 40] = -0.59940393024224289297;
05394     x[ 41] = -0.57719571005204581484;
05395     x[ 42] = -0.55449513263193254887;
05396     x[ 43] = -0.53131974364437562397;
05397     x[ 44] = -0.50768775753371660215;
05398     x[ 45] = -0.48361802694584102756;
05399     x[ 46] = -0.45913001198983233287;
05400     x[ 47] = -0.43424374934680255800;
05401     x[ 48] = -0.40897982122988867241;
05402     x[ 49] = -0.38335932419873034692;
05403     x[ 50] = -0.35740383783153215238;
05404     x[ 51] = -0.33113539325797683309;
05405     x[ 52] = -0.30457644155671404334;
05406     x[ 53] = -0.27774982202182431507;
05407     x[ 54] = -0.25067873030348317661;
05408     x[ 55] = -0.22338668642896688163;
05409     x[ 56] = -0.19589750271110015392;
05410     x[ 57] = -0.16823525155220746498;
05411     x[ 58] = -0.14042423315256017459;
05412     x[ 59] = -0.11248894313318662575;
05413     x[ 60] = -0.084454040083710883710;
05414     x[ 61] = -0.056344313046592789972;
05415     x[ 62] = -0.028184648949745694339;
05416     x[ 63] =  0.0;
05417     x[ 64] =  0.028184648949745694339;
05418     x[ 65] =  0.056344313046592789972;
05419     x[ 66] =  0.084454040083710883710;
05420     x[ 67] =  0.11248894313318662575;
05421     x[ 68] =  0.14042423315256017459;
05422     x[ 69] =  0.16823525155220746498;
05423     x[ 70] =  0.19589750271110015392;
05424     x[ 71] =  0.22338668642896688163;
05425     x[ 72] =  0.25067873030348317661;
05426     x[ 73] =  0.27774982202182431507;
05427     x[ 74] =  0.30457644155671404334;
05428     x[ 75] =  0.33113539325797683309;
05429     x[ 76] =  0.35740383783153215238;
05430     x[ 77] =  0.38335932419873034692;
05431     x[ 78] =  0.40897982122988867241;
05432     x[ 79] =  0.43424374934680255800;
05433     x[ 80] =  0.45913001198983233287;
05434     x[ 81] =  0.48361802694584102756;
05435     x[ 82] =  0.50768775753371660215;
05436     x[ 83] =  0.53131974364437562397;
05437     x[ 84] =  0.55449513263193254887;
05438     x[ 85] =  0.57719571005204581484;
05439     x[ 86] =  0.59940393024224289297;
05440     x[ 87] =  0.62110294673722640294;
05441     x[ 88] =  0.64227664250975951377;
05442     x[ 89] =  0.66290966002478059546;
05443     x[ 90] =  0.68298743109107922809;
05444     x[ 91] =  0.70249620649152707861;
05445     x[ 92] =  0.72142308537009891548;
05446     x[ 93] =  0.73975604435269475868;
05447     x[ 94] =  0.75748396638051363793;
05448     x[ 95] =  0.77459666924148337704;
05449     x[ 96] =  0.79108493379984836143;
05450     x[ 97] =  0.80694053195021761186;
05451     x[ 98] =  0.82215625436498040737;
05452     x[ 99] =  0.83672593816886873550;
05453     x[100] =  0.85064449476835027976;
05454     x[101] =  0.86390793819369047715;
05455     x[102] =  0.87651341448470526974;
05456     x[103] =  0.88845923287225699889;
05457     x[104] =  0.89974489977694003664;
05458     x[105] =  0.91037115695700429250;
05459     x[106] =  0.92034002547001242073;
05460     x[107] =  0.92965485742974005667;
05461     x[108] =  0.93832039777959288365;
05462     x[109] =  0.94634285837340290515;
05463     x[110] =  0.95373000642576113641;
05464     x[111] =  0.96049126870802028342;
05465     x[112] =  0.96663785155841656709;
05466     x[113] =  0.97218287474858179658;
05467     x[114] =  0.97714151463970571416;
05468     x[115] =  0.98153114955374010687;
05469     x[116] =  0.98537149959852037111;
05470     x[117] =  0.98868475754742947994;
05471     x[118] =  0.99149572117810613240;
05472     x[119] =  0.99383196321275502221;
05473     x[120] =  0.99572410469840718851;
05474     x[121] =  0.99720625937222195908;
05475     x[122] =  0.99831663531840739253;
05476     x[123] =  0.99909812496766759766;
05477     x[124] =  0.99959879967191068325;
05478     x[125] =  0.99987288812035761194;
05479     x[126] =  0.99998243035489159858;
05480   }
05481   else if (n==255) {
05482     x[  0] = -0.99999759637974846462;
05483     x[  1] = -0.99998243035489159858;
05484     x[  2] = -0.99994399620705437576;
05485     x[  3] = -0.99987288812035761194;
05486     x[  4] = -0.99976049092443204733;
05487     x[  5] = -0.99959879967191068325;
05488     x[  6] = -0.99938033802502358193;
05489     x[  7] = -0.99909812496766759766;
05490     x[  8] = -0.99874561446809511470;
05491     x[  9] = -0.99831663531840739253;
05492     x[ 10] = -0.99780535449595727456;
05493     x[ 11] = -0.99720625937222195908;
05494     x[ 12] = -0.99651414591489027385;
05495     x[ 13] = -0.99572410469840718851;
05496     x[ 14] = -0.99483150280062100052;
05497     x[ 15] = -0.99383196321275502221;
05498     x[ 16] = -0.99272134428278861533;
05499     x[ 17] = -0.99149572117810613240;
05500     x[ 18] = -0.99015137040077015918;
05501     x[ 19] = -0.98868475754742947994;
05502     x[ 20] = -0.98709252795403406719;
05503     x[ 21] = -0.98537149959852037111;
05504     x[ 22] = -0.98351865757863272876;
05505     x[ 23] = -0.98153114955374010687;
05506     x[ 24] = -0.97940628167086268381;
05507     x[ 25] = -0.97714151463970571416;
05508     x[ 26] = -0.97473445975240266776;
05509     x[ 27] = -0.97218287474858179658;
05510     x[ 28] = -0.96948465950245923177;
05511     x[ 29] = -0.96663785155841656709;
05512     x[ 30] = -0.96364062156981213252;
05513     x[ 31] = -0.96049126870802028342;
05514     x[ 32] = -0.95718821610986096274;
05515     x[ 33] = -0.95373000642576113641;
05516     x[ 34] = -0.95011529752129487656;
05517     x[ 35] = -0.94634285837340290515;
05518     x[ 36] = -0.94241156519108305981;
05519     x[ 37] = -0.93832039777959288365;
05520     x[ 38] = -0.93406843615772578800;
05521     x[ 39] = -0.92965485742974005667;
05522     x[ 40] = -0.92507893290707565236;
05523     x[ 41] = -0.92034002547001242073;
05524     x[ 42] = -0.91543758715576504064;
05525     x[ 43] = -0.91037115695700429250;
05526     x[ 44] = -0.90514035881326159519;
05527     x[ 45] = -0.89974489977694003664;
05528     x[ 46] = -0.89418456833555902286;
05529     x[ 47] = -0.88845923287225699889;
05530     x[ 48] = -0.88256884024734190684;
05531     x[ 49] = -0.87651341448470526974;
05532     x[ 50] = -0.87029305554811390585;
05533     x[ 51] = -0.86390793819369047715;
05534     x[ 52] = -0.85735831088623215653;
05535     x[ 53] = -0.85064449476835027976;
05536     x[ 54] = -0.84376688267270860104;
05537     x[ 55] = -0.83672593816886873550;
05538     x[ 56] = -0.82952219463740140018;
05539     x[ 57] = -0.82215625436498040737;
05540     x[ 58] = -0.81462878765513741344;
05541     x[ 59] = -0.80694053195021761186;
05542     x[ 60] = -0.79909229096084140180;
05543     x[ 61] = -0.79108493379984836143;
05544     x[ 62] = -0.78291939411828301639;
05545     x[ 63] = -0.77459666924148337704;
05546     x[ 64] = -0.76611781930376009072;
05547     x[ 65] = -0.75748396638051363793;
05548     x[ 66] = -0.74869629361693660282;
05549     x[ 67] = -0.73975604435269475868;
05550     x[ 68] = -0.73066452124218126133;
05551     x[ 69] = -0.72142308537009891548;
05552     x[ 70] = -0.71203315536225203459;
05553     x[ 71] = -0.70249620649152707861;
05554     x[ 72] = -0.69281376977911470289;
05555     x[ 73] = -0.68298743109107922809;
05556     x[ 74] = -0.67301883023041847920;
05557     x[ 75] = -0.66290966002478059546;
05558     x[ 76] = -0.65266166541001749610;
05559     x[ 77] = -0.64227664250975951377;
05560     x[ 78] = -0.63175643771119423041;
05561     x[ 79] = -0.62110294673722640294;
05562     x[ 80] = -0.61031811371518640016;
05563     x[ 81] = -0.59940393024224289297;
05564     x[ 82] = -0.58836243444766254143;
05565     x[ 83] = -0.57719571005204581484;
05566     x[ 84] = -0.56590588542365442262;
05567     x[ 85] = -0.55449513263193254887;
05568     x[ 86] = -0.54296566649831149049;
05569     x[ 87] = -0.53131974364437562397;
05570     x[ 88] = -0.51955966153745702199;
05571     x[ 89] = -0.50768775753371660215;
05572     x[ 90] = -0.49570640791876146017;
05573     x[ 91] = -0.48361802694584102756;
05574     x[ 92] = -0.47142506587165887693;
05575     x[ 93] = -0.45913001198983233287;
05576     x[ 94] = -0.44673538766202847374;
05577     x[ 95] = -0.43424374934680255800;
05578     x[ 96] = -0.42165768662616330006;
05579     x[ 97] = -0.40897982122988867241;
05580     x[ 98] = -0.39621280605761593918;
05581     x[ 99] = -0.38335932419873034692;
05582     x[100] = -0.37042208795007823014;
05583     x[101] = -0.35740383783153215238;
05584     x[102] = -0.34430734159943802278;
05585     x[103] = -0.33113539325797683309;
05586     x[104] = -0.31789081206847668318;
05587     x[105] = -0.30457644155671404334;
05588     x[106] = -0.29119514851824668196;
05589     x[107] = -0.27774982202182431507;
05590     x[108] = -0.26424337241092676194;
05591     x[109] = -0.25067873030348317661;
05592     x[110] = -0.23705884558982972721;
05593     x[111] = -0.22338668642896688163;
05594     x[112] = -0.20966523824318119477;
05595     x[113] = -0.19589750271110015392;
05596     x[114] = -0.18208649675925219825;
05597     x[115] = -0.16823525155220746498;
05598     x[116] = -0.15434681148137810869;
05599     x[117] = -0.14042423315256017459;
05600     x[118] = -0.12647058437230196685;
05601     x[119] = -0.11248894313318662575;
05602     x[120] = -0.098482396598119202090;
05603     x[121] = -0.084454040083710883710;
05604     x[122] = -0.070406976042855179063;
05605     x[123] = -0.056344313046592789972;
05606     x[124] = -0.042269164765363603212;
05607     x[125] = -0.028184648949745694339;
05608     x[126] = -0.014093886410782462614;
05609     x[127] =  0.0;
05610     x[128] =  0.014093886410782462614;
05611     x[129] =  0.028184648949745694339;
05612     x[130] =  0.042269164765363603212;
05613     x[131] =  0.056344313046592789972;
05614     x[132] =  0.070406976042855179063;
05615     x[133] =  0.084454040083710883710;
05616     x[134] =  0.098482396598119202090;
05617     x[135] =  0.11248894313318662575;
05618     x[136] =  0.12647058437230196685;
05619     x[137] =  0.14042423315256017459;
05620     x[138] =  0.15434681148137810869;
05621     x[139] =  0.16823525155220746498;
05622     x[140] =  0.18208649675925219825;
05623     x[141] =  0.19589750271110015392;
05624     x[142] =  0.20966523824318119477;
05625     x[143] =  0.22338668642896688163;
05626     x[144] =  0.23705884558982972721;
05627     x[145] =  0.25067873030348317661;
05628     x[146] =  0.26424337241092676194;
05629     x[147] =  0.27774982202182431507;
05630     x[148] =  0.29119514851824668196;
05631     x[149] =  0.30457644155671404334;
05632     x[150] =  0.31789081206847668318;
05633     x[151] =  0.33113539325797683309;
05634     x[152] =  0.34430734159943802278;
05635     x[153] =  0.35740383783153215238;
05636     x[154] =  0.37042208795007823014;
05637     x[155] =  0.38335932419873034692;
05638     x[156] =  0.39621280605761593918;
05639     x[157] =  0.40897982122988867241;
05640     x[158] =  0.42165768662616330006;
05641     x[159] =  0.43424374934680255800;
05642     x[160] =  0.44673538766202847374;
05643     x[161] =  0.45913001198983233287;
05644     x[162] =  0.47142506587165887693;
05645     x[163] =  0.48361802694584102756;
05646     x[164] =  0.49570640791876146017;
05647     x[165] =  0.50768775753371660215;
05648     x[166] =  0.51955966153745702199;
05649     x[167] =  0.53131974364437562397;
05650     x[168] =  0.54296566649831149049;
05651     x[169] =  0.55449513263193254887;
05652     x[170] =  0.56590588542365442262;
05653     x[171] =  0.57719571005204581484;
05654     x[172] =  0.58836243444766254143;
05655     x[173] =  0.59940393024224289297;
05656     x[174] =  0.61031811371518640016;
05657     x[175] =  0.62110294673722640294;
05658     x[176] =  0.63175643771119423041;
05659     x[177] =  0.64227664250975951377;
05660     x[178] =  0.65266166541001749610;
05661     x[179] =  0.66290966002478059546;
05662     x[180] =  0.67301883023041847920;
05663     x[181] =  0.68298743109107922809;
05664     x[182] =  0.69281376977911470289;
05665     x[183] =  0.70249620649152707861;
05666     x[184] =  0.71203315536225203459;
05667     x[185] =  0.72142308537009891548;
05668     x[186] =  0.73066452124218126133;
05669     x[187] =  0.73975604435269475868;
05670     x[188] =  0.74869629361693660282;
05671     x[189] =  0.75748396638051363793;
05672     x[190] =  0.76611781930376009072;
05673     x[191] =  0.77459666924148337704;
05674     x[192] =  0.78291939411828301639;
05675     x[193] =  0.79108493379984836143;
05676     x[194] =  0.79909229096084140180;
05677     x[195] =  0.80694053195021761186;
05678     x[196] =  0.81462878765513741344;
05679     x[197] =  0.82215625436498040737;
05680     x[198] =  0.82952219463740140018;
05681     x[199] =  0.83672593816886873550;
05682     x[200] =  0.84376688267270860104;
05683     x[201] =  0.85064449476835027976;
05684     x[202] =  0.85735831088623215653;
05685     x[203] =  0.86390793819369047715;
05686     x[204] =  0.87029305554811390585;
05687     x[205] =  0.87651341448470526974;
05688     x[206] =  0.88256884024734190684;
05689     x[207] =  0.88845923287225699889;
05690     x[208] =  0.89418456833555902286;
05691     x[209] =  0.89974489977694003664;
05692     x[210] =  0.90514035881326159519;
05693     x[211] =  0.91037115695700429250;
05694     x[212] =  0.91543758715576504064;
05695     x[213] =  0.92034002547001242073;
05696     x[214] =  0.92507893290707565236;
05697     x[215] =  0.92965485742974005667;
05698     x[216] =  0.93406843615772578800;
05699     x[217] =  0.93832039777959288365;
05700     x[218] =  0.94241156519108305981;
05701     x[219] =  0.94634285837340290515;
05702     x[220] =  0.95011529752129487656;
05703     x[221] =  0.95373000642576113641;
05704     x[222] =  0.95718821610986096274;
05705     x[223] =  0.96049126870802028342;
05706     x[224] =  0.96364062156981213252;
05707     x[225] =  0.96663785155841656709;
05708     x[226] =  0.96948465950245923177;
05709     x[227] =  0.97218287474858179658;
05710     x[228] =  0.97473445975240266776;
05711     x[229] =  0.97714151463970571416;
05712     x[230] =  0.97940628167086268381;
05713     x[231] =  0.98153114955374010687;
05714     x[232] =  0.98351865757863272876;
05715     x[233] =  0.98537149959852037111;
05716     x[234] =  0.98709252795403406719;
05717     x[235] =  0.98868475754742947994;
05718     x[236] =  0.99015137040077015918;
05719     x[237] =  0.99149572117810613240;
05720     x[238] =  0.99272134428278861533;
05721     x[239] =  0.99383196321275502221;
05722     x[240] =  0.99483150280062100052;
05723     x[241] =  0.99572410469840718851;
05724     x[242] =  0.99651414591489027385;
05725     x[243] =  0.99720625937222195908;
05726     x[244] =  0.99780535449595727456;
05727     x[245] =  0.99831663531840739253;
05728     x[246] =  0.99874561446809511470;
05729     x[247] =  0.99909812496766759766;
05730     x[248] =  0.99938033802502358193;
05731     x[249] =  0.99959879967191068325;
05732     x[250] =  0.99976049092443204733;
05733     x[251] =  0.99987288812035761194;
05734     x[252] =  0.99994399620705437576;
05735     x[253] =  0.99998243035489159858;
05736     x[254] =  0.99999759637974846462;
05737   }
05738   else {
05739     std::cerr << "\n";
05740     std::cerr << "PATTERSON_LOOKUP_POINTS - Fatal error!\n";
05741     std::cerr << "  Unexpected value of N = " << n << "\n";
05742     std::exit(1);
05743   }
05744   return;
05745 }
05746 
05747 //****************************************************************************
05748 template<class Scalar> 
05749 void IntrepidBurkardtRules::patterson_lookup_weights ( int n, Scalar w[] )
05750 //****************************************************************************
05751 //
05752 //  Purpose:
05753 //
05754 //    PATTERSON_LOOKUP_WEIGHTS looks up Patterson quadrature weights.
05755 //
05756 //  Discussion:
05757 //
05758 //    The allowed orders are 1, 3, 7, 15, 31, 63, 127 and 255.
05759 //
05760 //    The weights are positive, symmetric and should sum to 2.
05761 //
05762 //    The user must preallocate space for the output array W.
05763 //
05764 //  Licensing:
05765 //
05766 //    This code is distributed under the GNU LGPL license.
05767 //
05768 //  Modified:
05769 //
05770 //    17 December 2009
05771 //
05772 //  Author:
05773 //
05774 //    John Burkardt
05775 //
05776 //  Reference:
05777 //
05778 //    Milton Abramowitz, Irene Stegun,
05779 //    Handbook of Mathematical Functions,
05780 //    National Bureau of Standards, 1964,
05781 //    ISBN: 0-486-61272-4,
05782 //    LC: QA47.A34.
05783 //
05784 //    Arthur Stroud, Don Secrest,
05785 //    Gaussian Quadrature Formulas,
05786 //    Prentice Hall, 1966,
05787 //    LC: QA299.4G3S7.
05788 //
05789 //  Parameters:
05790 //
05791 //    Input, int N, the order.
05792 //    Legal values are 1, 3, 7, 15, 31, 63, 127 or 255.
05793 //
05794 //    Output, Scalar W[N], the weights.
05795 //
05796 {
05797   if (n==1) {
05798     w[  0] = 2.0;
05799   }
05800   else if (n==3) {
05801     w[  0] = 0.555555555555555555556;
05802     w[  1] = 0.888888888888888888889;
05803     w[  2] = 0.555555555555555555556;
05804   }
05805   else if (n==7) {
05806     w[  0] = 0.104656226026467265194;
05807     w[  1] = 0.268488089868333440729;
05808     w[  2] = 0.401397414775962222905;
05809     w[  3] = 0.450916538658474142345;
05810     w[  4] = 0.401397414775962222905;
05811     w[  5] = 0.268488089868333440729;
05812     w[  6] = 0.104656226026467265194;
05813   }
05814   else if (n==15) {
05815     w[  0] = 0.0170017196299402603390;
05816     w[  1] = 0.0516032829970797396969;
05817     w[  2] = 0.0929271953151245376859;
05818     w[  3] = 0.134415255243784220360;
05819     w[  4] = 0.171511909136391380787;
05820     w[  5] = 0.200628529376989021034;
05821     w[  6] = 0.219156858401587496404;
05822     w[  7] = 0.225510499798206687386;
05823     w[  8] = 0.219156858401587496404;
05824     w[  9] = 0.200628529376989021034;
05825     w[ 10] = 0.171511909136391380787;
05826     w[ 11] = 0.134415255243784220360;
05827     w[ 12] = 0.0929271953151245376859;
05828     w[ 13] = 0.0516032829970797396969;
05829     w[ 14] = 0.0170017196299402603390;
05830   }
05831   else if (n==31) {
05832     w[  0] = 0.00254478079156187441540;
05833     w[  1] = 0.00843456573932110624631;
05834     w[  2] = 0.0164460498543878109338;
05835     w[  3] = 0.0258075980961766535646;
05836     w[  4] = 0.0359571033071293220968;
05837     w[  5] = 0.0464628932617579865414;
05838     w[  6] = 0.0569795094941233574122;
05839     w[  7] = 0.0672077542959907035404;
05840     w[  8] = 0.0768796204990035310427;
05841     w[  9] = 0.0857559200499903511542;
05842     w[ 10] = 0.0936271099812644736167;
05843     w[ 11] = 0.100314278611795578771;
05844     w[ 12] = 0.105669893580234809744;
05845     w[ 13] = 0.109578421055924638237;
05846     w[ 14] = 0.111956873020953456880;
05847     w[ 15] = 0.112755256720768691607;
05848     w[ 16] = 0.111956873020953456880;
05849     w[ 17] = 0.109578421055924638237;
05850     w[ 18] = 0.105669893580234809744;
05851     w[ 19] = 0.100314278611795578771;
05852     w[ 20] = 0.0936271099812644736167;
05853     w[ 21] = 0.0857559200499903511542;
05854     w[ 22] = 0.0768796204990035310427;
05855     w[ 23] = 0.0672077542959907035404;
05856     w[ 24] = 0.0569795094941233574122;
05857     w[ 25] = 0.0464628932617579865414;
05858     w[ 26] = 0.0359571033071293220968;
05859     w[ 27] = 0.0258075980961766535646;
05860     w[ 28] = 0.0164460498543878109338;
05861     w[ 29] = 0.00843456573932110624631;
05862     w[ 30] = 0.00254478079156187441540;
05863   }
05864   else if (n==63) {
05865     w[  0] = 0.000363221481845530659694;
05866     w[  1] = 0.00126515655623006801137;
05867     w[  2] = 0.00257904979468568827243;
05868     w[  3] = 0.00421763044155885483908;
05869     w[  4] = 0.00611550682211724633968;
05870     w[  5] = 0.00822300795723592966926;
05871     w[  6] = 0.0104982469096213218983;
05872     w[  7] = 0.0129038001003512656260;
05873     w[  8] = 0.0154067504665594978021;
05874     w[  9] = 0.0179785515681282703329;
05875     w[ 10] = 0.0205942339159127111492;
05876     w[ 11] = 0.0232314466399102694433;
05877     w[ 12] = 0.0258696793272147469108;
05878     w[ 13] = 0.0284897547458335486125;
05879     w[ 14] = 0.0310735511116879648799;
05880     w[ 15] = 0.0336038771482077305417;
05881     w[ 16] = 0.0360644327807825726401;
05882     w[ 17] = 0.0384398102494555320386;
05883     w[ 18] = 0.0407155101169443189339;
05884     w[ 19] = 0.0428779600250077344929;
05885     w[ 20] = 0.0449145316536321974143;
05886     w[ 21] = 0.0468135549906280124026;
05887     w[ 22] = 0.0485643304066731987159;
05888     w[ 23] = 0.0501571393058995374137;
05889     w[ 24] = 0.0515832539520484587768;
05890     w[ 25] = 0.0528349467901165198621;
05891     w[ 26] = 0.0539054993352660639269;
05892     w[ 27] = 0.0547892105279628650322;
05893     w[ 28] = 0.0554814043565593639878;
05894     w[ 29] = 0.0559784365104763194076;
05895     w[ 30] = 0.0562776998312543012726;
05896     w[ 31] = 0.0563776283603847173877;
05897     w[ 32] = 0.0562776998312543012726;
05898     w[ 33] = 0.0559784365104763194076;
05899     w[ 34] = 0.0554814043565593639878;
05900     w[ 35] = 0.0547892105279628650322;
05901     w[ 36] = 0.0539054993352660639269;
05902     w[ 37] = 0.0528349467901165198621;
05903     w[ 38] = 0.0515832539520484587768;
05904     w[ 39] = 0.0501571393058995374137;
05905     w[ 40] = 0.0485643304066731987159;
05906     w[ 41] = 0.0468135549906280124026;
05907     w[ 42] = 0.0449145316536321974143;
05908     w[ 43] = 0.0428779600250077344929;
05909     w[ 44] = 0.0407155101169443189339;
05910     w[ 45] = 0.0384398102494555320386;
05911     w[ 46] = 0.0360644327807825726401;
05912     w[ 47] = 0.0336038771482077305417;
05913     w[ 48] = 0.0310735511116879648799;
05914     w[ 49] = 0.0284897547458335486125;
05915     w[ 50] = 0.0258696793272147469108;
05916     w[ 51] = 0.0232314466399102694433;
05917     w[ 52] = 0.0205942339159127111492;
05918     w[ 53] = 0.0179785515681282703329;
05919     w[ 54] = 0.0154067504665594978021;
05920     w[ 55] = 0.0129038001003512656260;
05921     w[ 56] = 0.0104982469096213218983;
05922     w[ 57] = 0.00822300795723592966926;
05923     w[ 58] = 0.00611550682211724633968;
05924     w[ 59] = 0.00421763044155885483908;
05925     w[ 60] = 0.00257904979468568827243;
05926     w[ 61] = 0.00126515655623006801137;
05927     w[ 62] = 0.000363221481845530659694;
05928   }
05929   else if (n==127) {
05930     w[  0] = 0.0000505360952078625176247;
05931     w[  1] = 0.000180739564445388357820;
05932     w[  2] = 0.000377746646326984660274;
05933     w[  3] = 0.000632607319362633544219;
05934     w[  4] = 0.000938369848542381500794;
05935     w[  5] = 0.00128952408261041739210;
05936     w[  6] = 0.00168114286542146990631;
05937     w[  7] = 0.00210881524572663287933;
05938     w[  8] = 0.00256876494379402037313;
05939     w[  9] = 0.00305775341017553113613;
05940     w[ 10] = 0.00357289278351729964938;
05941     w[ 11] = 0.00411150397865469304717;
05942     w[ 12] = 0.00467105037211432174741;
05943     w[ 13] = 0.00524912345480885912513;
05944     w[ 14] = 0.00584344987583563950756;
05945     w[ 15] = 0.00645190005017573692280;
05946     w[ 16] = 0.00707248999543355546805;
05947     w[ 17] = 0.00770337523327974184817;
05948     w[ 18] = 0.00834283875396815770558;
05949     w[ 19] = 0.00898927578406413572328;
05950     w[ 20] = 0.00964117772970253669530;
05951     w[ 21] = 0.0102971169579563555237;
05952     w[ 22] = 0.0109557333878379016480;
05953     w[ 23] = 0.0116157233199551347270;
05954     w[ 24] = 0.0122758305600827700870;
05955     w[ 25] = 0.0129348396636073734547;
05956     w[ 26] = 0.0135915710097655467896;
05957     w[ 27] = 0.0142448773729167743063;
05958     w[ 28] = 0.0148936416648151820348;
05959     w[ 29] = 0.0155367755558439824399;
05960     w[ 30] = 0.0161732187295777199419;
05961     w[ 31] = 0.0168019385741038652709;
05962     w[ 32] = 0.0174219301594641737472;
05963     w[ 33] = 0.0180322163903912863201;
05964     w[ 34] = 0.0186318482561387901863;
05965     w[ 35] = 0.0192199051247277660193;
05966     w[ 36] = 0.0197954950480974994880;
05967     w[ 37] = 0.0203577550584721594669;
05968     w[ 38] = 0.0209058514458120238522;
05969     w[ 39] = 0.0214389800125038672465;
05970     w[ 40] = 0.0219563663053178249393;
05971     w[ 41] = 0.0224572658268160987071;
05972     w[ 42] = 0.0229409642293877487608;
05973     w[ 43] = 0.0234067774953140062013;
05974     w[ 44] = 0.0238540521060385400804;
05975     w[ 45] = 0.0242821652033365993580;
05976     w[ 46] = 0.0246905247444876769091;
05977     w[ 47] = 0.0250785696529497687068;
05978     w[ 48] = 0.0254457699654647658126;
05979     w[ 49] = 0.0257916269760242293884;
05980     w[ 50] = 0.0261156733767060976805;
05981     w[ 51] = 0.0264174733950582599310;
05982     w[ 52] = 0.0266966229274503599062;
05983     w[ 53] = 0.0269527496676330319634;
05984     w[ 54] = 0.0271855132296247918192;
05985     w[ 55] = 0.0273946052639814325161;
05986     w[ 56] = 0.0275797495664818730349;
05987     w[ 57] = 0.0277407021782796819939;
05988     w[ 58] = 0.0278772514766137016085;
05989     w[ 59] = 0.0279892182552381597038;
05990     w[ 60] = 0.0280764557938172466068;
05991     w[ 61] = 0.0281388499156271506363;
05992     w[ 62] = 0.0281763190330166021307;
05993     w[ 63] = 0.0281888141801923586938;
05994     w[ 64] = 0.0281763190330166021307;
05995     w[ 65] = 0.0281388499156271506363;
05996     w[ 66] = 0.0280764557938172466068;
05997     w[ 67] = 0.0279892182552381597038;
05998     w[ 68] = 0.0278772514766137016085;
05999     w[ 69] = 0.0277407021782796819939;
06000     w[ 70] = 0.0275797495664818730349;
06001     w[ 71] = 0.0273946052639814325161;
06002     w[ 72] = 0.0271855132296247918192;
06003     w[ 73] = 0.0269527496676330319634;
06004     w[ 74] = 0.0266966229274503599062;
06005     w[ 75] = 0.0264174733950582599310;
06006     w[ 76] = 0.0261156733767060976805;
06007     w[ 77] = 0.0257916269760242293884;
06008     w[ 78] = 0.0254457699654647658126;
06009     w[ 79] = 0.0250785696529497687068;
06010     w[ 80] = 0.0246905247444876769091;
06011     w[ 81] = 0.0242821652033365993580;
06012     w[ 82] = 0.0238540521060385400804;
06013     w[ 83] = 0.0234067774953140062013;
06014     w[ 84] = 0.0229409642293877487608;
06015     w[ 85] = 0.0224572658268160987071;
06016     w[ 86] = 0.0219563663053178249393;
06017     w[ 87] = 0.0214389800125038672465;
06018     w[ 88] = 0.0209058514458120238522;
06019     w[ 89] = 0.0203577550584721594669;
06020     w[ 90] = 0.0197954950480974994880;
06021     w[ 91] = 0.0192199051247277660193;
06022     w[ 92] = 0.0186318482561387901863;
06023     w[ 93] = 0.0180322163903912863201;
06024     w[ 94] = 0.0174219301594641737472;
06025     w[ 95] = 0.0168019385741038652709;
06026     w[ 96] = 0.0161732187295777199419;
06027     w[ 97] = 0.0155367755558439824399;
06028     w[ 98] = 0.0148936416648151820348;
06029     w[ 99] = 0.0142448773729167743063;
06030     w[100] = 0.0135915710097655467896;
06031     w[101] = 0.0129348396636073734547;
06032     w[102] = 0.0122758305600827700870;
06033     w[103] = 0.0116157233199551347270;
06034     w[104] = 0.0109557333878379016480;
06035     w[105] = 0.0102971169579563555237;
06036     w[106] = 0.00964117772970253669530;
06037     w[107] = 0.00898927578406413572328;
06038     w[108] = 0.00834283875396815770558;
06039     w[109] = 0.00770337523327974184817;
06040     w[110] = 0.00707248999543355546805;
06041     w[111] = 0.00645190005017573692280;
06042     w[112] = 0.00584344987583563950756;
06043     w[113] = 0.00524912345480885912513;
06044     w[114] = 0.00467105037211432174741;
06045     w[115] = 0.00411150397865469304717;
06046     w[116] = 0.00357289278351729964938;
06047     w[117] = 0.00305775341017553113613;
06048     w[118] = 0.00256876494379402037313;
06049     w[119] = 0.00210881524572663287933;
06050     w[120] = 0.00168114286542146990631;
06051     w[121] = 0.00128952408261041739210;
06052     w[122] = 0.000938369848542381500794;
06053     w[123] = 0.000632607319362633544219;
06054     w[124] = 0.000377746646326984660274;
06055     w[125] = 0.000180739564445388357820;
06056     w[126] = 0.0000505360952078625176247;
06057   }
06058   else if (n==255) {
06059     w[  0] = 0.69379364324108267170E-05;
06060     w[  1] = 0.25157870384280661489E-04;
06061     w[  2] = 0.53275293669780613125E-04;
06062     w[  3] = 0.90372734658751149261E-04;
06063     w[  4] = 0.13575491094922871973E-03;
06064     w[  5] = 0.18887326450650491366E-03;
06065     w[  6] = 0.24921240048299729402E-03;
06066     w[  7] = 0.31630366082226447689E-03;
06067     w[  8] = 0.38974528447328229322E-03;
06068     w[  9] = 0.46918492424785040975E-03;
06069     w[ 10] = 0.55429531493037471492E-03;
06070     w[ 11] = 0.64476204130572477933E-03;
06071     w[ 12] = 0.74028280424450333046E-03;
06072     w[ 13] = 0.84057143271072246365E-03;
06073     w[ 14] = 0.94536151685852538246E-03;
06074     w[ 15] = 0.10544076228633167722E-02;
06075     w[ 16] = 0.11674841174299594077E-02;
06076     w[ 17] = 0.12843824718970101768E-02;
06077     w[ 18] = 0.14049079956551446427E-02;
06078     w[ 19] = 0.15288767050877655684E-02;
06079     w[ 20] = 0.16561127281544526052E-02;
06080     w[ 21] = 0.17864463917586498247E-02;
06081     w[ 22] = 0.19197129710138724125E-02;
06082     w[ 23] = 0.20557519893273465236E-02;
06083     w[ 24] = 0.21944069253638388388E-02;
06084     w[ 25] = 0.23355251860571608737E-02;
06085     w[ 26] = 0.24789582266575679307E-02;
06086     w[ 27] = 0.26245617274044295626E-02;
06087     w[ 28] = 0.27721957645934509940E-02;
06088     w[ 29] = 0.29217249379178197538E-02;
06089     w[ 30] = 0.30730184347025783234E-02;
06090     w[ 31] = 0.32259500250878684614E-02;
06091     w[ 32] = 0.33803979910869203823E-02;
06092     w[ 33] = 0.35362449977167777340E-02;
06093     w[ 34] = 0.36933779170256508183E-02;
06094     w[ 35] = 0.38516876166398709241E-02;
06095     w[ 36] = 0.40110687240750233989E-02;
06096     w[ 37] = 0.41714193769840788528E-02;
06097     w[ 38] = 0.43326409680929828545E-02;
06098     w[ 39] = 0.44946378920320678616E-02;
06099     w[ 40] = 0.46573172997568547773E-02;
06100     w[ 41] = 0.48205888648512683476E-02;
06101     w[ 42] = 0.49843645647655386012E-02;
06102     w[ 43] = 0.51485584789781777618E-02;
06103     w[ 44] = 0.53130866051870565663E-02;
06104     w[ 45] = 0.54778666939189508240E-02;
06105     w[ 46] = 0.56428181013844441585E-02;
06106     w[ 47] = 0.58078616599775673635E-02;
06107     w[ 48] = 0.59729195655081658049E-02;
06108     w[ 49] = 0.61379152800413850435E-02;
06109     w[ 50] = 0.63027734490857587172E-02;
06110     w[ 51] = 0.64674198318036867274E-02;
06111     w[ 52] = 0.66317812429018878941E-02;
06112     w[ 53] = 0.67957855048827733948E-02;
06113     w[ 54] = 0.69593614093904229394E-02;
06114     w[ 55] = 0.71224386864583871532E-02;
06115     w[ 56] = 0.72849479805538070639E-02;
06116     w[ 57] = 0.74468208324075910174E-02;
06117     w[ 58] = 0.76079896657190565832E-02;
06118     w[ 59] = 0.77683877779219912200E-02;
06119     w[ 60] = 0.79279493342948491103E-02;
06120     w[ 61] = 0.80866093647888599710E-02;
06121     w[ 62] = 0.82443037630328680306E-02;
06122     w[ 63] = 0.84009692870519326354E-02;
06123     w[ 64] = 0.85565435613076896192E-02;
06124     w[ 65] = 0.87109650797320868736E-02;
06125     w[ 66] = 0.88641732094824942641E-02;
06126     w[ 67] = 0.90161081951956431600E-02;
06127     w[ 68] = 0.91667111635607884067E-02;
06128     w[ 69] = 0.93159241280693950932E-02;
06129     w[ 70] = 0.94636899938300652943E-02;
06130     w[ 71] = 0.96099525623638830097E-02;
06131     w[ 72] = 0.97546565363174114611E-02;
06132     w[ 73] = 0.98977475240487497440E-02;
06133     w[ 74] = 0.10039172044056840798E-01;
06134     w[ 75] = 0.10178877529236079733E-01;
06135     w[ 76] = 0.10316812330947621682E-01;
06136     w[ 77] = 0.10452925722906011926E-01;
06137     w[ 78] = 0.10587167904885197931E-01;
06138     w[ 79] = 0.10719490006251933623E-01;
06139     w[ 80] = 0.10849844089337314099E-01;
06140     w[ 81] = 0.10978183152658912470E-01;
06141     w[ 82] = 0.11104461134006926537E-01;
06142     w[ 83] = 0.11228632913408049354E-01;
06143     w[ 84] = 0.11350654315980596602E-01;
06144     w[ 85] = 0.11470482114693874380E-01;
06145     w[ 86] = 0.11588074033043952568E-01;
06146     w[ 87] = 0.11703388747657003101E-01;
06147     w[ 88] = 0.11816385890830235763E-01;
06148     w[ 89] = 0.11927026053019270040E-01;
06149     w[ 90] = 0.12035270785279562630E-01;
06150     w[ 91] = 0.12141082601668299679E-01;
06151     w[ 92] = 0.12244424981611985899E-01;
06152     w[ 93] = 0.12345262372243838455E-01;
06153     w[ 94] = 0.12443560190714035263E-01;
06154     w[ 95] = 0.12539284826474884353E-01;
06155     w[ 96] = 0.12632403643542078765E-01;
06156     w[ 97] = 0.12722884982732382906E-01;
06157     w[ 98] = 0.12810698163877361967E-01;
06158     w[ 99] = 0.12895813488012114694E-01;
06159     w[100] = 0.12978202239537399286E-01;
06160     w[101] = 0.13057836688353048840E-01;
06161     w[102] = 0.13134690091960152836E-01;
06162     w[103] = 0.13208736697529129966E-01;
06163     w[104] = 0.13279951743930530650E-01;
06164     w[105] = 0.13348311463725179953E-01;
06165     w[106] = 0.13413793085110098513E-01;
06166     w[107] = 0.13476374833816515982E-01;
06167     w[108] = 0.13536035934956213614E-01;
06168     w[109] = 0.13592756614812395910E-01;
06169     w[110] = 0.13646518102571291428E-01;
06170     w[111] = 0.13697302631990716258E-01;
06171     w[112] = 0.13745093443001896632E-01;
06172     w[113] = 0.13789874783240936517E-01;
06173     w[114] = 0.13831631909506428676E-01;
06174     w[115] = 0.13870351089139840997E-01;
06175     w[116] = 0.13906019601325461264E-01;
06176     w[117] = 0.13938625738306850804E-01;
06177     w[118] = 0.13968158806516938516E-01;
06178     w[119] = 0.13994609127619079852E-01;
06179     w[120] = 0.14017968039456608810E-01;
06180     w[121] = 0.14038227896908623303E-01;
06181     w[122] = 0.14055382072649964277E-01;
06182     w[123] = 0.14069424957813575318E-01;
06183     w[124] = 0.14080351962553661325E-01;
06184     w[125] = 0.14088159516508301065E-01;
06185     w[126] = 0.14092845069160408355E-01;
06186     w[127] = 0.14094407090096179347E-01;
06187     w[128] = 0.14092845069160408355E-01;
06188     w[129] = 0.14088159516508301065E-01;
06189     w[130] = 0.14080351962553661325E-01;
06190     w[131] = 0.14069424957813575318E-01;
06191     w[132] = 0.14055382072649964277E-01;
06192     w[133] = 0.14038227896908623303E-01;
06193     w[134] = 0.14017968039456608810E-01;
06194     w[135] = 0.13994609127619079852E-01;
06195     w[136] = 0.13968158806516938516E-01;
06196     w[137] = 0.13938625738306850804E-01;
06197     w[138] = 0.13906019601325461264E-01;
06198     w[139] = 0.13870351089139840997E-01;
06199     w[140] = 0.13831631909506428676E-01;
06200     w[141] = 0.13789874783240936517E-01;
06201     w[142] = 0.13745093443001896632E-01;
06202     w[143] = 0.13697302631990716258E-01;
06203     w[144] = 0.13646518102571291428E-01;
06204     w[145] = 0.13592756614812395910E-01;
06205     w[146] = 0.13536035934956213614E-01;
06206     w[147] = 0.13476374833816515982E-01;
06207     w[148] = 0.13413793085110098513E-01;
06208     w[149] = 0.13348311463725179953E-01;
06209     w[150] = 0.13279951743930530650E-01;
06210     w[151] = 0.13208736697529129966E-01;
06211     w[152] = 0.13134690091960152836E-01;
06212     w[153] = 0.13057836688353048840E-01;
06213     w[154] = 0.12978202239537399286E-01;
06214     w[155] = 0.12895813488012114694E-01;
06215     w[156] = 0.12810698163877361967E-01;
06216     w[157] = 0.12722884982732382906E-01;
06217     w[158] = 0.12632403643542078765E-01;
06218     w[159] = 0.12539284826474884353E-01;
06219     w[160] = 0.12443560190714035263E-01;
06220     w[161] = 0.12345262372243838455E-01;
06221     w[162] = 0.12244424981611985899E-01;
06222     w[163] = 0.12141082601668299679E-01;
06223     w[164] = 0.12035270785279562630E-01;
06224     w[165] = 0.11927026053019270040E-01;
06225     w[166] = 0.11816385890830235763E-01;
06226     w[167] = 0.11703388747657003101E-01;
06227     w[168] = 0.11588074033043952568E-01;
06228     w[169] = 0.11470482114693874380E-01;
06229     w[170] = 0.11350654315980596602E-01;
06230     w[171] = 0.11228632913408049354E-01;
06231     w[172] = 0.11104461134006926537E-01;
06232     w[173] = 0.10978183152658912470E-01;
06233     w[174] = 0.10849844089337314099E-01;
06234     w[175] = 0.10719490006251933623E-01;
06235     w[176] = 0.10587167904885197931E-01;
06236     w[177] = 0.10452925722906011926E-01;
06237     w[178] = 0.10316812330947621682E-01;
06238     w[179] = 0.10178877529236079733E-01;
06239     w[180] = 0.10039172044056840798E-01;
06240     w[181] = 0.98977475240487497440E-02;
06241     w[182] = 0.97546565363174114611E-02;
06242     w[183] = 0.96099525623638830097E-02;
06243     w[184] = 0.94636899938300652943E-02;
06244     w[185] = 0.93159241280693950932E-02;
06245     w[186] = 0.91667111635607884067E-02;
06246     w[187] = 0.90161081951956431600E-02;
06247     w[188] = 0.88641732094824942641E-02;
06248     w[189] = 0.87109650797320868736E-02;
06249     w[190] = 0.85565435613076896192E-02;
06250     w[191] = 0.84009692870519326354E-02;
06251     w[192] = 0.82443037630328680306E-02;
06252     w[193] = 0.80866093647888599710E-02;
06253     w[194] = 0.79279493342948491103E-02;
06254     w[195] = 0.77683877779219912200E-02;
06255     w[196] = 0.76079896657190565832E-02;
06256     w[197] = 0.74468208324075910174E-02;
06257     w[198] = 0.72849479805538070639E-02;
06258     w[199] = 0.71224386864583871532E-02;
06259     w[200] = 0.69593614093904229394E-02;
06260     w[201] = 0.67957855048827733948E-02;
06261     w[202] = 0.66317812429018878941E-02;
06262     w[203] = 0.64674198318036867274E-02;
06263     w[204] = 0.63027734490857587172E-02;
06264     w[205] = 0.61379152800413850435E-02;
06265     w[206] = 0.59729195655081658049E-02;
06266     w[207] = 0.58078616599775673635E-02;
06267     w[208] = 0.56428181013844441585E-02;
06268     w[209] = 0.54778666939189508240E-02;
06269     w[210] = 0.53130866051870565663E-02;
06270     w[211] = 0.51485584789781777618E-02;
06271     w[212] = 0.49843645647655386012E-02;
06272     w[213] = 0.48205888648512683476E-02;
06273     w[214] = 0.46573172997568547773E-02;
06274     w[215] = 0.44946378920320678616E-02;
06275     w[216] = 0.43326409680929828545E-02;
06276     w[217] = 0.41714193769840788528E-02;
06277     w[218] = 0.40110687240750233989E-02;
06278     w[219] = 0.38516876166398709241E-02;
06279     w[220] = 0.36933779170256508183E-02;
06280     w[221] = 0.35362449977167777340E-02;
06281     w[222] = 0.33803979910869203823E-02;
06282     w[223] = 0.32259500250878684614E-02;
06283     w[224] = 0.30730184347025783234E-02;
06284     w[225] = 0.29217249379178197538E-02;
06285     w[226] = 0.27721957645934509940E-02;
06286     w[227] = 0.26245617274044295626E-02;
06287     w[228] = 0.24789582266575679307E-02;
06288     w[229] = 0.23355251860571608737E-02;
06289     w[230] = 0.21944069253638388388E-02;
06290     w[231] = 0.20557519893273465236E-02;
06291     w[232] = 0.19197129710138724125E-02;
06292     w[233] = 0.17864463917586498247E-02;
06293     w[234] = 0.16561127281544526052E-02;
06294     w[235] = 0.15288767050877655684E-02;
06295     w[236] = 0.14049079956551446427E-02;
06296     w[237] = 0.12843824718970101768E-02;
06297     w[238] = 0.11674841174299594077E-02;
06298     w[239] = 0.10544076228633167722E-02;
06299     w[240] = 0.94536151685852538246E-03;
06300     w[241] = 0.84057143271072246365E-03;
06301     w[242] = 0.74028280424450333046E-03;
06302     w[243] = 0.64476204130572477933E-03;
06303     w[244] = 0.55429531493037471492E-03;
06304     w[245] = 0.46918492424785040975E-03;
06305     w[246] = 0.38974528447328229322E-03;
06306     w[247] = 0.31630366082226447689E-03;
06307     w[248] = 0.24921240048299729402E-03;
06308     w[249] = 0.18887326450650491366E-03;
06309     w[250] = 0.13575491094922871973E-03;
06310     w[251] = 0.90372734658751149261E-04;
06311     w[252] = 0.53275293669780613125E-04;
06312     w[253] = 0.25157870384280661489E-04;
06313     w[254] = 0.69379364324108267170E-05;
06314   }
06315   else {
06316     std::cerr << "\n";
06317     std::cerr << "PATTERSON_LOOKUP_WEIGHTS - Fatal error!\n";
06318     std::cerr << "  Unexpected value of N = " << n << ".\n";
06319     std::exit(1);
06320   }
06321   return;
06322 }
06323 
06324 //***************************************************************************
06325 template<class Scalar>
06326 void IntrepidBurkardtRules::trapezoidal_compute ( int n, Scalar x[], Scalar w[] ) 
06327 //***************************************************************************
06328 {
06329   if (n==1) {
06330     x[0] = 0.0;
06331     w[0] = 2.0;
06332   }
06333   else {
06334     Scalar h = 1.0/((Scalar)n-1.0);
06335     for (int i=0; i<n; i++) {
06336       x[i] = -1.0 + (Scalar)i*h*2.0;
06337       if (i==0||i==n-1) {
06338         w[i] = h;
06339       }
06340       else {
06341         w[i] = 2.0*h;
06342       }
06343     }
06344   }
06345   return;
06346 }
06347 
06348 //***************************************************************************
06349 template<class Scalar>
06350 void IntrepidBurkardtRules::trapezoidal_compute_points ( int n, Scalar x[] ) 
06351 //***************************************************************************
06352 {
06353   if (n==1) {
06354     x[0] = 0.0;
06355   }
06356   else {
06357     Scalar h = 1.0/((Scalar)n-1.0);
06358     for (int i=0; i<n; i++) {
06359       x[i] = -1.0 + (Scalar)i*h*2.0;
06360     }
06361   }
06362   return;
06363 }
06364 
06365 //***************************************************************************
06366 template<class Scalar>
06367 void IntrepidBurkardtRules::trapezoidal_compute_weights ( int n, Scalar w[] ) 
06368 //***************************************************************************
06369 {
06370   if (n==1) {
06371     w[0] = 2.0;
06372   }
06373   else {
06374     Scalar h = 1.0/((Scalar)n-1.0);
06375     for (int i=0; i<n; i++) {
06376       if (i==0||i==n-1) {
06377         w[i] = h;
06378       }
06379       else {
06380         w[i] = 2.0*h;
06381       }
06382     }
06383   }
06384   return;
06385 }
06386 
06387 //****************************************************************************
06388 template<class Scalar> 
06389 Scalar IntrepidBurkardtRules::r8_epsilon(Scalar one)
06390 //****************************************************************************
06391 //
06392 //  Purpose:
06393 //
06394 //    R8_EPSILON returns the R8 roundoff unit.
06395 //
06396 //  Discussion:
06397 //
06398 //    The roundoff unit is a number R which is a power of 2 with the
06399 //    property that, to the precision of the computer's arithmetic,
06400 //      1 < 1 + R
06401 //    but
06402 //      1 = ( 1 + R / 2 )
06403 //
06404 //  Licensing:
06405 //
06406 //    This code is distributed under the GNU LGPL license.
06407 //
06408 //  Modified:
06409 //
06410 //    18 February 2008
06411 //
06412 //  Author:
06413 //
06414 //    John Burkardt
06415 //
06416 //  Parameters:
06417 //
06418 //    Output, Scalar R8_EPSILON, the R8 round-off unit.
06419 //
06420 {
06421   Scalar value; value = 1.0;
06422 
06423   while (1.0<(Scalar)(1.0+value)) {
06424     value = value / 2.0;
06425   }
06426 
06427   value = 2.0 * value;
06428 
06429   return value;
06430 }
06431 
06432 //****************************************************************************
06433 template<class Scalar> 
06434 Scalar IntrepidBurkardtRules::r8_sign ( Scalar x )
06435 //****************************************************************************
06436 //
06437 //  Purpose:
06438 //
06439 //    R8_SIGN returns the sign of an R8.
06440 //
06441 //  Licensing:
06442 //
06443 //    This code is distributed under the GNU LGPL license.
06444 //
06445 //  Modified:
06446 //
06447 //    18 October 2004
06448 //
06449 //  Author:
06450 //
06451 //    John Burkardt
06452 //
06453 //  Parameters:
06454 //
06455 //    Input, Scalar X, the number whose sign is desired.
06456 //
06457 //    Output, Scalar R8_SIGN, the sign of X.
06458 //
06459 {
06460   Scalar value;
06461 
06462   if (x<0.0) {
06463     value = -1.0;
06464   }
06465   else {
06466     value = 1.0;
06467   }
06468   return value;
06469 }
06470 
06471 } // end of namespace Intrepid
06472