ROL
ROL_BurkardtRulesDef.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Rapid Optimization Library (ROL) Package
5 // Copyright (2014) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact lead developers:
38 // Drew Kouri (dpkouri@sandia.gov) and
39 // Denis Ridzal (dridzal@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
44 
52 #ifdef _MSC_VER
53 #include "winmath.h"
54 #endif
55 
56 //# include <cstdlib>
57 //# include <iomanip>
58 //# include <iostream>
59 //# include <cmath>
60 //# include <ctime>
61 //# include <Teuchos_RealTraitsDecl.hpp>
62 
63 namespace ROL {
64 
65 //****************************************************************************
66 template<class Real>
67 void ROLBurkardtRules::chebyshev1_compute ( int n, Real x[], Real w[] )
68 //****************************************************************************
69 //
70 // Purpose:
71 //
72 // CHEBYSHEV1_COMPUTE computes a Chebyshev type 1 quadrature rule.
73 //
74 // Discussion:
75 //
76 // The integral:
77 //
78 // Integral ( -1 <= X <= 1 ) F(X) / sqrt ( 1 - x^2 ) dX
79 //
80 // The quadrature rule:
81 //
82 // Sum ( 1 <= I <= N ) W(I) * F ( X(I) )
83 //
84 // Licensing:
85 //
86 // This code is distributed under the GNU LGPL license.
87 //
88 // Modified:
89 //
90 // 13 June 2009
91 //
92 // Author:
93 //
94 // John Burkardt
95 //
96 // Reference:
97 //
98 // Philip Davis, Philip Rabinowitz,
99 // Methods of Numerical Integration,
100 // Second Edition,
101 // Dover, 2007,
102 // ISBN: 0486453391,
103 // LC: QA299.3.D28.
104 //
105 // Parameters:
106 //
107 // Input, int N, the order.
108 // 1 <= N.
109 //
110 // Output, Real X[N], the abscissas.
111 //
112 // Output, Real W[N], the weights.
113 //
114 {
115  if (n<1) {
116  std::cerr << "\n";
117  std::cerr << "CHEBYSHEV1_COMPUTE - Fatal error!\n";
118  std::cerr << " Illegal value of N = " << n << "\n";
119  std::exit (1);
120  }
121 
122  for (int i=0;i<n;i++) {
123  w[i] = M_PI/(Real)(n);
124  }
125  for (int i=0;i<n;i++) {
126  x[i] = std::cos(M_PI*(Real)(2*n-1-2*i)/(Real)(2*n));
127  }
128  if ((n%2)==1) {
129  x[(n-1)/2] = 0.0;
130  }
131 
132  return;
133 }
134 
135 //****************************************************************************
136 template<class Real>
138 //****************************************************************************
139 //
140 // Purpose:
141 //
142 // CHEBYSHEV1_COMPUTE_POINTS computes Chebyshev type 1 quadrature points.
143 //
144 // Licensing:
145 //
146 // This code is distributed under the GNU LGPL license.
147 //
148 // Modified:
149 //
150 // 13 June 2009
151 //
152 // Author:
153 //
154 // John Burkardt
155 //
156 // Reference:
157 //
158 // Philip Davis, Philip Rabinowitz,
159 // Methods of Numerical Integration,
160 // Second Edition,
161 // Dover, 2007,
162 // ISBN: 0486453391,
163 // LC: QA299.3.D28.
164 //
165 // Parameters:
166 //
167 // Input, int N, the order.
168 // 1 <= N.
169 //
170 // Output, Real X[N], the abscissas.
171 //
172 {
173  if (n<1) {
174  std::cerr << "\n";
175  std::cerr << "CHEBYSHEV1_COMPUTE_POINTS - Fatal error!\n";
176  std::cerr << " Illegal value of N = " << n << "\n";
177  std::exit(1);
178  }
179 
180  for (int i=0;i<n;i++) {
181  x[i] = std::cos(M_PI*(Real)(2*n-1-2*i)/(Real)(2*n));
182  }
183  if ((n%2)==1) {
184  x[(n-1)/2] = 0.0;
185  }
186 
187  return;
188 }
189 
190 //****************************************************************************
191 template<class Real>
193 //****************************************************************************
194 //
195 // Purpose:
196 //
197 // CHEBYSHEV1_COMPUTE_WEIGHTS computes Chebyshev type 1 quadrature weights.
198 //
199 // Licensing:
200 //
201 // This code is distributed under the GNU LGPL license.
202 //
203 // Modified:
204 //
205 // 13 June 2009
206 //
207 // Author:
208 //
209 // John Burkardt
210 //
211 // Reference:
212 //
213 // Philip Davis, Philip Rabinowitz,
214 // Methods of Numerical Integration,
215 // Second Edition,
216 // Dover, 2007,
217 // ISBN: 0486453391,
218 // LC: QA299.3.D28.
219 //
220 // Parameters:
221 //
222 // Input, int N, the order.
223 // 1 <= N.
224 //
225 // Output, Real W[N], the weights.
226 //
227 {
228  if (n<1) {
229  std::cerr << "\n";
230  std::cerr << "CHEBYSHEV1_COMPUTE_WEIGHTS - Fatal error!\n";
231  std::cerr << " Illegal value of N = " << n << "\n";
232  std::exit(1);
233  }
234 
235  for (int i=0;i<n;i++) {
236  w[i] = M_PI/(Real)n;
237  }
238 
239  return;
240 }
241 
242 //****************************************************************************
243 template<class Real>
244 void ROLBurkardtRules::chebyshev2_compute ( int n, Real x[], Real w[] )
245 //****************************************************************************
246 //
247 // Purpose:
248 //
249 // CHEBYSHEV2_COMPUTE computes a Chebyshev type 2 quadrature rule.
250 //
251 // Discussion:
252 //
253 // The integral:
254 //
255 // integral ( -1 <= x <= 1 ) f(x) sqrt ( 1 - x^2 ) dx
256 //
257 // The quadrature rule:
258 //
259 // sum ( 1 <= i <= n ) w(i) * f ( x(i) )
260 //
261 // Licensing:
262 //
263 // This code is distributed under the GNU LGPL license.
264 //
265 // Modified:
266 //
267 // 13 June 2009
268 //
269 // Author:
270 //
271 // John Burkardt
272 //
273 // Reference:
274 //
275 // Philip Davis, Philip Rabinowitz,
276 // Methods of Numerical Integration,
277 // Second Edition,
278 // Dover, 2007,
279 // ISBN: 0486453391,
280 // LC: QA299.3.D28.
281 //
282 // Parameters:
283 //
284 // Input, int N, the order.
285 // 1 <= N.
286 //
287 // Output, Real X[N], the abscissas.
288 //
289 // Output, Real W[N], the weights.
290 //
291 {
292  Real angle;
293 
294  if (n<1) {
295  std::cerr << "\n";
296  std::cerr << "CHEBYSHEV2_COMPUTE - Fatal error!\n";
297  std::cerr << " Illegal value of N = " << n << "\n";
298  std::exit(1);
299  }
300 
301  for (int i=0;i<n;i++) {
302  angle = M_PI*(Real)(n-i)/(Real)(n+1);
303  w[i] = M_PI/(Real)(n+1)*std::pow(std::sin(angle),2);
304  x[i] = std::cos(angle);
305  }
306 
307  if ((n%2)==1) {
308  x[(n-1)/2] = 0.0;
309  }
310 
311  return;
312 }
313 
314 //****************************************************************************
315 template<class Real>
317 //****************************************************************************
318 //
319 // Purpose:
320 //
321 // CHEBYSHEV2_COMPUTE_POINTS computes Chebyshev type 2 quadrature points.
322 //
323 // Licensing:
324 //
325 // This code is distributed under the GNU LGPL license.
326 //
327 // Modified:
328 //
329 // 13 June 2009
330 //
331 // Author:
332 //
333 // John Burkardt
334 //
335 // Reference:
336 //
337 // Philip Davis, Philip Rabinowitz,
338 // Methods of Numerical Integration,
339 // Second Edition,
340 // Dover, 2007,
341 // ISBN: 0486453391,
342 // LC: QA299.3.D28.
343 //
344 // Parameters:
345 //
346 // Input, int N, the order.
347 // 1 <= N.
348 //
349 // Output, Real X[N], the abscissas.
350 //
351 {
352  Real angle;
353 
354  if (n<1) {
355  std::cerr << "\n";
356  std::cerr << "CHEBYSHEV2_COMPUTE_POINTS - Fatal error!\n";
357  std::cerr << " Illegal value of N = " << n << "\n";
358  std::exit(1);
359  }
360 
361  for (int i=0;i<n;i++) {
362  angle = M_PI*(Real)(n-i)/(Real)(n+1);
363  x[i] = std::cos(angle);
364  }
365 
366  if ((n%2)==1) {
367  x[(n-1)/2] = 0.0;
368  }
369 
370  return;
371 }
372 
373 //****************************************************************************
374 template<class Real>
376 //****************************************************************************
377 //
378 // Purpose:
379 //
380 // CHEBYSHEV2_COMPUTE_WEIGHTS computes Chebyshev type 2 quadrature weights.
381 //
382 // Licensing:
383 //
384 // This code is distributed under the GNU LGPL license.
385 //
386 // Modified:
387 //
388 // 13 June 2009
389 //
390 // Author:
391 //
392 // John Burkardt
393 //
394 // Reference:
395 //
396 // Philip Davis, Philip Rabinowitz,
397 // Methods of Numerical Integration,
398 // Second Edition,
399 // Dover, 2007,
400 // ISBN: 0486453391,
401 // LC: QA299.3.D28.
402 //
403 // Parameters:
404 //
405 // Input, int N, the order.
406 // 1 <= N.
407 //
408 // Output, Real W[N], the weights.
409 //
410 {
411  Real angle;
412 
413  if (n<1) {
414  std::cerr << "\n";
415  std::cerr << "CHEBYSHEV2_COMPUTE_WEIGHTS - Fatal error!\n";
416  std::cerr << " Illegal value of N = " << n << "\n";
417  std::exit(1);
418  }
419 
420  for (int i=0;i<n;i++) {
421  angle = M_PI*(Real)(n-i)/(Real)(n+1);
422  w[i] = M_PI/(Real)(n+1)*std::pow(std::sin(angle),2);
423  }
424 
425  return;
426 }
427 
428 //****************************************************************************
429 template<class Real>
430 void ROLBurkardtRules::clenshaw_curtis_compute ( int n, Real x[], Real w[] )
431 //****************************************************************************
432 //
433 // Purpose:
434 //
435 // CLENSHAW_CURTIS_COMPUTE computes a Clenshaw Curtis quadrature rule.
436 //
437 // Discussion:
438 //
439 // The integral:
440 //
441 // Integral ( -1 <= X <= 1 ) F(X) dX
442 //
443 // The quadrature rule:
444 //
445 // Sum ( 1 <= I <= N ) W(I) * F ( X(I) )
446 //
447 // Licensing:
448 //
449 // This code is distributed under the GNU LGPL license.
450 //
451 // Modified:
452 //
453 // 19 March 2009
454 //
455 // Author:
456 //
457 // John Burkardt
458 //
459 // Parameters:
460 //
461 // Input, int N, the order.
462 // 1 <= N.
463 //
464 // Output, Real X[N], the abscissas.
465 //
466 // Output, Real W[N], the weights.
467 //
468 {
469  Real b, theta;
470  int i, j;
471 
472  if (n<1) {
473  std::cerr << "\n";
474  std::cerr << "CLENSHAW_CURTIS_COMPUTE - Fatal error!\n";
475  std::cerr << " Illegal value of N = " << n << "\n";
476  std::exit(1);
477  }
478  else if (n==1) {
479  x[0] = 0.0;
480  w[0] = 2.0;
481  }
482  else {
483  for (i=0;i<n;i++) {
484  x[i] = std::cos((Real)(n-1-i)*M_PI/(Real)(n-1));
485  }
486  x[0] = -1.0;
487  if ((n%2)==1) {
488  x[(n-1)/2] = 0.0;
489  }
490  x[n-1] = +1.0;
491 
492  for (i=0;i<n;i++) {
493  theta = (Real)i*M_PI/(Real)(n-1);
494 
495  w[i] = 1.0;
496 
497  for (j=1;j<=(n-1)/2;j++) {
498  if (2*j==(n-1)) {
499  b = 1.0;
500  }
501  else {
502  b = 2.0;
503  }
504 
505  w[i] = w[i]-b*std::cos(2.0*(Real)(j)*theta)/(Real)(4*j*j-1);
506  }
507  }
508 
509  w[0] = w[0]/(Real)(n-1);
510  for (i=1;i<n-1;i++) {
511  w[i] = 2.0*w[i]/(Real)(n-1);
512  }
513  w[n-1] = w[n-1]/(Real)(n-1);
514  }
515 
516  return;
517 }
518 
519 //****************************************************************************
520 template<class Real>
522 //****************************************************************************
523 //
524 // Purpose:
525 //
526 // CLENSHAW_CURTIS_COMPUTE_POINTS computes Clenshaw Curtis quadrature points.
527 //
528 // Discussion:
529 //
530 // Our convention is that the abscissas are numbered from left to right.
531 //
532 // This rule is defined on [-1,1].
533 //
534 // Licensing:
535 //
536 // This code is distributed under the GNU LGPL license.
537 //
538 // Modified:
539 //
540 // 13 June 2009
541 //
542 // Author:
543 //
544 // John Burkardt
545 //
546 // Parameters:
547 //
548 // Input, int N, the order.
549 //
550 // Output, Real X[N], the abscissas.
551 //
552 {
553  int index;
554 
555  if (n<1) {
556  std::cerr << "\n";
557  std::cerr << "CLENSHAW_CURTIS_COMPUTE_POINTS - Fatal error!\n";
558  std::cerr << " N < 1.\n";
559  std::exit(1);
560  }
561  else if (n==1) {
562  x[0] = 0.0;
563  }
564  else {
565  for (index=1;index<=n;index++) {
566  x[index-1] = std::cos((Real)(n-index)*M_PI/(Real)(n-1));
567  }
568  x[0] = -1.0;
569  if ((n%2)==1) {
570  x[(n-1)/2] = 0.0;
571  }
572  x[n-1] = +1.0;
573  }
574  return;
575 }
576 
577 //****************************************************************************
578 template<class Real>
580 //****************************************************************************
581 //
582 // Purpose:
583 //
584 // CLENSHAW_CURTIS_COMPUTE_WEIGHTS computes Clenshaw Curtis quadrature weights.
585 //
586 // Discussion:
587 //
588 // The user must preallocate space for the output array W.
589 //
590 // Licensing:
591 //
592 // This code is distributed under the GNU LGPL license.
593 //
594 // Modified:
595 //
596 // 13 June 2009
597 //
598 // Author:
599 //
600 // John Burkardt
601 //
602 // Reference:
603 //
604 // Charles Clenshaw, Alan Curtis,
605 // A Method for Numerical Integration on an Automatic Computer,
606 // Numerische Mathematik,
607 // Volume 2, Number 1, December 1960, pages 197-205.
608 //
609 // Parameters:
610 //
611 // Input, int N, the order.
612 //
613 // Output, Real W[N], the weights.
614 //
615 {
616  Real b, theta;
617  int i, j;
618 
619  if (n<1) {
620  std::cerr << "\n";
621  std::cerr << "CLENSHAW_CURTIS_COMPUTE_WEIGHTS - Fatal error!\n";
622  std::cerr << " N < 1.\n";
623  std::exit(1);
624  }
625  else if (n==1) {
626  w[0] = 2.0;
627  return;
628  }
629 
630  for (i=1;i<=n;i++) {
631  theta = (Real)(i-1)*M_PI/(Real)(n-1);
632 
633  w[i-1] = 1.0;
634 
635  for (j=1;j<=(n-1)/2;j++) {
636  if (2*j==(n-1)) {
637  b = 1.0;
638  }
639  else {
640  b = 2.0;
641  }
642 
643  w[i-1] = w[i-1]-b*std::cos(2.0*(Real)j*theta)/(Real)(4*j*j-1);
644  }
645  }
646 
647  w[0] = w[0]/(Real)(n-1);
648  for (i=1;i<n-1;i++) {
649  w[i] = 2.0*w[i]/(Real)(n-1);
650  }
651  w[n-1] = w[n-1]/(Real)(n-1);
652 
653  return;
654 }
655 
656 //****************************************************************************
657 template<class Real>
658 void ROLBurkardtRules::fejer2_compute ( int n, Real x[], Real w[] )
659 //****************************************************************************
660 //
661 // Purpose:
662 //
663 // FEJER2_COMPUTE computes a Fejer type 2 rule.
664 //
665 // Discussion:
666 //
667 // Our convention is that the abscissas are numbered from left to right.
668 //
669 // The rule is defined on [-1,1].
670 //
671 // Licensing:
672 //
673 // This code is distributed under the GNU LGPL license.
674 //
675 // Modified:
676 //
677 // 13 June 2009
678 //
679 // Author:
680 //
681 // John Burkardt
682 //
683 // Parameters:
684 //
685 // Input, int N, the order.
686 // 1 <= N.
687 //
688 // Output, Real X[N], the abscissas.
689 //
690 // Output, Real W[N], the weights.
691 //
692 {
693  Real p, theta;
694 
695  if (n<1) {
696  std::cerr << "\n";
697  std::cerr << "FEJER2_COMPUTE - Fatal error!\n";
698  std::cerr << " Illegal value of N = " << n << "\n";
699  std::exit(1);
700  }
701  else if (n==1) {
702  x[0] = 0.0;
703  w[0] = 2.0;
704  return;
705  }
706 
707  for (int i=0;i<n;i++) {
708  x[i] = std::cos((Real)(n-i)*M_PI/(Real)(n+1));
709  }
710  if ((n%2)==1) {
711  x[(n-1)/2] = 0.0;
712  }
713 
714  if (n==2) {
715  w[0] = 1.0;
716  w[1] = 1.0;
717  }
718  else {
719  for (int i=0;i<n;i++) {
720  theta = (Real)(n-i)*M_PI/(Real)(n+1);
721 
722  w[i] = 1.0;
723 
724  for (int j=1;j<=((n-1)/2);j++) {
725  w[i] = w[i]-2.0*std::cos(2.0*(Real)j*theta)/(Real)(4*j*j-1);
726  }
727  p = 2.0*(Real)(((n+1)/2))-1.0;
728  w[i] = w[i]-std::cos((p+1.0)*theta)/p;
729  }
730  for (int i=0;i<n;i++) {
731  w[i] = 2.0*w[i]/(Real)(n+1);
732  }
733  }
734  return;
735 }
736 
737 //****************************************************************************
738 template<class Real>
740 //****************************************************************************
741 //
742 // Purpose:
743 //
744 // FEJER2_COMPUTE_POINTS computes Fejer type 2 quadrature points.
745 //
746 // Discussion:
747 //
748 // Our convention is that the abscissas are numbered from left to right.
749 //
750 // The rule is defined on [-1,1].
751 //
752 // Licensing:
753 //
754 // This code is distributed under the GNU LGPL license.
755 //
756 // Modified:
757 //
758 // 13 June 2009
759 //
760 // Author:
761 //
762 // John Burkardt
763 //
764 // Parameters:
765 //
766 // Input, int N, the order.
767 // 1 <= N.
768 //
769 // Output, Real X[N], the abscissas.
770 //
771 {
772  int i;
773 
774  if (n<1) {
775  std::cerr << "\n";
776  std::cerr << "FEJER2_COMPUTE_POINTS - Fatal error!\n";
777  std::cerr << " N < 1.\n";
778  std::exit(1);
779  }
780  else if (n==1) {
781  x[0] = 0.0;
782  }
783  else {
784  for (i=1;i<=n;i++) {
785  x[i-1] = std::cos((Real)(n+1-i)*M_PI/(Real)(n+1));
786  }
787  if ((n%2)==1) {
788  x[(n-1)/2] = 0.0;
789  }
790  }
791  return;
792 }
793 
794 //****************************************************************************
795 template<class Real>
797 //****************************************************************************
798 //
799 // Purpose:
800 //
801 // FEJER2_COMPUTE_WEIGHTS computes Fejer type 2 quadrature weights.
802 //
803 // Discussion:
804 //
805 // The user must preallocate space for the output array W.
806 //
807 // Licensing:
808 //
809 // This code is distributed under the GNU LGPL license.
810 //
811 // Modified:
812 //
813 // 13 June 2009
814 //
815 // Author:
816 //
817 // John Burkardt
818 //
819 // Reference:
820 //
821 // Philip Davis, Philip Rabinowitz,
822 // Methods of Numerical Integration,
823 // Second Edition,
824 // Dover, 2007,
825 // ISBN: 0486453391,
826 // LC: QA299.3.D28.
827 //
828 // Walter Gautschi,
829 // Numerical Quadrature in the Presence of a Singularity,
830 // SIAM Journal on Numerical Analysis,
831 // Volume 4, Number 3, 1967, pages 357-362.
832 //
833 // Joerg Waldvogel,
834 // Fast Construction of the Fejer and Clenshaw-Curtis Quadrature Rules,
835 // BIT Numerical Mathematics,
836 // Volume 43, Number 1, 2003, pages 1-18.
837 //
838 // Parameters:
839 //
840 // Input, int N, the order.
841 //
842 // Output, Real W[N], the weights.
843 //
844 {
845  int i, j;
846  Real p, theta;
847 
848  if (n<1) {
849  std::cerr << "\n";
850  std::cerr << "FEJER2_COMPUTE_WEIGHTS - Fatal error!\n";
851  std::cerr << " N < 1.\n";
852  std::exit(1);
853  }
854  else if (n==1) {
855  w[0] = 2.0;
856  }
857  else if (n==2) {
858  w[0] = 1.0;
859  w[1] = 1.0;
860  }
861  else {
862  for (i=1;i<=n;i++) {
863  theta = (Real)(n+1-i)*M_PI/(Real)(n+1);
864 
865  w[i-1] = 1.0;
866 
867  for (j=1;j<=((n-1)/2);j++) {
868  w[i-1] = w[i-1]-2.0*std::cos(2.0*(Real)j*theta)/(Real)(4*j*j-1);
869  }
870  p = 2.0*(Real)(((n+1)/2))-1.0;
871  w[i-1] = w[i-1]-std::cos((p+1.0)*theta)/p;
872  }
873  for (i=0;i<n;i++) {
874  w[i] = 2.0*w[i]/(Real)(n+1);
875  }
876  }
877  return;
878 }
879 
880 //****************************************************************************
881 template<class Real>
882 void ROLBurkardtRules::hermite_compute ( int n, Real x[], Real w[] )
883 //****************************************************************************
884 //
885 // Purpose:
886 //
887 // HERMITE_COMPUTE computes a Gauss-Hermite quadrature rule.
888 //
889 // Discussion:
890 //
891 // The code uses an algorithm by Elhay and Kautsky.
892 //
893 // The abscissas are the zeros of the N-th order Hermite polynomial.
894 //
895 // The integral:
896 //
897 // integral ( -oo < x < +oo ) exp ( - x * x ) * f(x) dx
898 //
899 // The quadrature rule:
900 //
901 // sum ( 1 <= i <= n ) w(i) * f ( x(i) )
902 //
903 // Licensing:
904 //
905 // This code is distributed under the GNU LGPL license.
906 //
907 // Modified:
908 //
909 // 19 April 2011
910 //
911 // Author:
912 //
913 // Original FORTRAN77 version by Sylvan Elhay, Jaroslav Kautsky.
914 // C++ version by John Burkardt.
915 //
916 // Reference:
917 //
918 // Sylvan Elhay, Jaroslav Kautsky,
919 // Algorithm 655: IQPACK, FORTRAN Subroutines for the Weights of
920 // Interpolatory Quadrature,
921 // ACM Transactions on Mathematical Software,
922 // Volume 13, Number 4, December 1987, pages 399-415.
923 //
924 // Parameters:
925 //
926 // Input, int N, the number of abscissas.
927 //
928 // Output, Real X[N], the abscissas.
929 //
930 // Output, Real W[N], the weights.
931 //
932 {
933  Real* bj;
934 //
935 // Define the zero-th moment.
936 //
937  Real zemu = std::sqrt(M_PI);
938 //
939 // Define the Jacobi matrix.
940 //
941  bj = new Real[n];
942 
943  for (int i=0;i<n;i++) {
944  bj[i] = std::sqrt((Real)(i+1)/2.0);
945  }
946 
947  for (int i=0;i<n;i++) {
948  x[i] = 0.0;
949  }
950 
951  w[0] = std::sqrt (zemu);
952  for (int i=1;i<n;i++) {
953  w[i] = 0.0;
954  }
955 //
956 // Diagonalize the Jacobi matrix.
957 //
958  ROLBurkardtRules::imtqlx ( n, x, bj, w );
959 
960  for (int i=0;i<n;i++) {
961  w[i] = w[i]*w[i];
962  }
963 
964  // Ensure that zero is actually zero.
965  if (n%2) {
966  int ind = (int)((Real)n/2.0);
967  x[ind] = 0.0;
968  }
969 
970  delete [] bj;
971 
972  return;
973 }
974 
975 //****************************************************************************
976 template<class Real>
977 void ROLBurkardtRules::hermite_compute_points ( int order, Real x[] )
978 //****************************************************************************
979 //
980 // Purpose:
981 //
982 // HERMITE_COMPUTE_POINTS computes Hermite quadrature points.
983 //
984 // Licensing:
985 //
986 // This code is distributed under the GNU LGPL license.
987 //
988 // Modified:
989 //
990 // 13 June 2009
991 //
992 // Author:
993 //
994 // John Burkardt
995 //
996 // Parameters:
997 //
998 // Input, int ORDER, the order.
999 //
1000 // Output, Real X[ORDER], the abscissas.
1001 //
1002 {
1003  Real *w; w = new Real[order];
1004  ROLBurkardtRules::hermite_compute ( order, x, w );
1005  delete [] w;
1006 
1007  return;
1008 }
1009 
1010 //****************************************************************************
1011 template<class Real>
1012 void ROLBurkardtRules::hermite_compute_weights ( int order, Real w[] )
1013 //****************************************************************************
1014 //
1015 // Purpose:
1016 //
1017 // HERMITE_COMPUTE_WEIGHTS computes Hermite quadrature weights.
1018 //
1019 // Licensing:
1020 //
1021 // This code is distributed under the GNU LGPL license.
1022 //
1023 // Modified:
1024 //
1025 // 13 June 2009
1026 //
1027 // Author:
1028 //
1029 // John Burkardt
1030 //
1031 // Parameters:
1032 //
1033 // Input, int ORDER, the order.
1034 //
1035 // Output, Real W[ORDER], the weights.
1036 //
1037 {
1038  Real *x; x = new Real[order];
1039  ROLBurkardtRules::hermite_compute ( order, x, w );
1040  delete [] x;
1041 
1042  return;
1043 }
1044 
1045 //****************************************************************************
1046 template<class Real>
1047 void ROLBurkardtRules::hermite_genz_keister_lookup ( int n, Real x[], Real w[] )
1048 //****************************************************************************
1049 //
1050 // Purpose:
1051 //
1052 // HERMITE_GENZ_KEISTER_LOOKUP looks up a Genz-Keister Hermite rule.
1053 //
1054 // Discussion:
1055 //
1056 // The integral:
1057 //
1058 // integral ( -oo <= x <= +oo ) f(x) exp ( - x * x ) dx
1059 //
1060 // The quadrature rule:
1061 //
1062 // sum ( 1 <= i <= n ) w(i) * f ( x(i) )
1063 //
1064 // A nested family of rules for the Hermite integration problem
1065 // was produced by Genz and Keister. The structure of the nested
1066 // family was denoted by 1+2+6+10+16, that is, it comprised rules
1067 // of successive orders O = 1, 3, 9, 19, and 35.
1068 //
1069 // The precisions of these rules are P = 1, 5, 15, 29, and 51.
1070 //
1071 // Licensing:
1072 //
1073 // This code is distributed under the GNU LGPL license.
1074 //
1075 // Modified:
1076 //
1077 // 07 June 2010
1078 //
1079 // Author:
1080 //
1081 // John Burkardt
1082 //
1083 // Reference:
1084 //
1085 // Alan Genz, Bradley Keister,
1086 // Fully symmetric interpolatory rules for multiple integrals
1087 // over infinite regions with Gaussian weight,
1088 // Journal of Computational and Applied Mathematics,
1089 // Volume 71, 1996, pages 299-309
1090 //
1091 // Florian Heiss, Viktor Winschel,
1092 // Likelihood approximation by numerical integration on sparse grids,
1093 // Journal of Econometrics,
1094 // Volume 144, 2008, pages 62-80.
1095 //
1096 // Thomas Patterson,
1097 // The Optimal Addition of Points to Quadrature Formulae,
1098 // Mathematics of Computation,
1099 // Volume 22, Number 104, October 1968, pages 847-856.
1100 //
1101 // Parameters:
1102 //
1103 // Input, int N, the order.
1104 // N must be 1, 3, 9, 19, or 35.
1105 //
1106 // Output, Real X[N], the abscissas.
1107 //
1108 // Output, Real W[N], the weights.
1109 //
1110 {
1113 
1114  return;
1115 }
1116 
1117 //****************************************************************************
1118 template<class Real>
1120 //****************************************************************************
1121 //
1122 // Purpose:
1123 //
1124 // HERMITE_GENZ_KEISTER_LOOKUP_POINTS looks up Genz-Keister Hermite abscissas.
1125 //
1126 // Discussion:
1127 //
1128 // The integral:
1129 //
1130 // integral ( -oo <= x <= +oo ) f(x) exp ( - x * x ) dx
1131 //
1132 // The quadrature rule:
1133 //
1134 // sum ( 1 <= i <= n ) w(i) * f ( x(i) )
1135 //
1136 // A nested family of rules for the Hermite integration problem
1137 // was produced by Genz and Keister. The structure of the nested
1138 // family was denoted by 1+2+6+10+16, that is, it comprised rules
1139 // of successive orders O = 1, 3, 9, 19, and 35.
1140 //
1141 // The precisions of these rules are P = 1, 5, 15, 29, and 51.
1142 //
1143 // Three related families begin the same way, but end with a different final
1144 // rule. As a convenience, this function includes these final rules as well:
1145 //
1146 // Designation Orders Precisions
1147 //
1148 // 1+2+6+10+16, 1,3,9,19,35 1,5,15,29,51
1149 // 1+2+6+10+18 1,3,9,19,37 1,5,15,29,55
1150 // 1+2+6+10+22 1,3,9,19,41 1,5,15,29,63
1151 // 1+2+6+10+24 1,3,9,19,43 1,5,15,29,67
1152 //
1153 // Some of the data in this function was kindly supplied directly by
1154 // Alan Genz on 24 April 2011.
1155 //
1156 // Licensing:
1157 //
1158 // This code is distributed under the GNU LGPL license.
1159 //
1160 // Modified:
1161 //
1162 // 18 May 2011
1163 //
1164 // Author:
1165 //
1166 // John Burkardt
1167 //
1168 // Reference:
1169 //
1170 // Alan Genz, Bradley Keister,
1171 // Fully symmetric interpolatory rules for multiple integrals
1172 // over infinite regions with Gaussian weight,
1173 // Journal of Computational and Applied Mathematics,
1174 // Volume 71, 1996, pages 299-309
1175 //
1176 // Florian Heiss, Viktor Winschel,
1177 // Likelihood approximation by numerical integration on sparse grids,
1178 // Journal of Econometrics,
1179 // Volume 144, 2008, pages 62-80.
1180 //
1181 // Thomas Patterson,
1182 // The Optimal Addition of Points to Quadrature Formulae,
1183 // Mathematics of Computation,
1184 // Volume 22, Number 104, October 1968, pages 847-856.
1185 //
1186 // Parameters:
1187 //
1188 // Input, int N, the order.
1189 // N must be 1, 3, 9, 19, 35, 27, 41, or 43.
1190 //
1191 // Output, Real X[N], the abscissas.
1192 //
1193 {
1194  if (n==1) {
1195  x[ 0] = 0.0000000000000000E+00;
1196  }
1197  else if (n==3) {
1198  x[ 0] = -1.2247448713915889E+00;
1199  x[ 1] = 0.0000000000000000E+00;
1200  x[ 2] = 1.2247448713915889E+00;
1201  }
1202  else if (n==9) {
1203  x[ 0] = -2.9592107790638380E+00;
1204  x[ 1] = -2.0232301911005157E+00;
1205  x[ 2] = -1.2247448713915889E+00;
1206  x[ 3] = -5.2403354748695763E-01;
1207  x[ 4] = 0.0000000000000000E+00;
1208  x[ 5] = 5.2403354748695763E-01;
1209  x[ 6] = 1.2247448713915889E+00;
1210  x[ 7] = 2.0232301911005157E+00;
1211  x[ 8] = 2.9592107790638380E+00;
1212  }
1213  else if (n==19) {
1214  x[ 0] = -4.4995993983103881E+00;
1215  x[ 1] = -3.6677742159463378E+00;
1216  x[ 2] = -2.9592107790638380E+00;
1217  x[ 3] = -2.2665132620567876E+00;
1218  x[ 4] = -2.0232301911005157E+00;
1219  x[ 5] = -1.8357079751751868E+00;
1220  x[ 6] = -1.2247448713915889E+00;
1221  x[ 7] = -8.7004089535290285E-01;
1222  x[ 8] = -5.2403354748695763E-01;
1223  x[ 9] = 0.0000000000000000E+00;
1224  x[10] = 5.2403354748695763E-01;
1225  x[11] = 8.7004089535290285E-01;
1226  x[12] = 1.2247448713915889E+00;
1227  x[13] = 1.8357079751751868E+00;
1228  x[14] = 2.0232301911005157E+00;
1229  x[15] = 2.2665132620567876E+00;
1230  x[16] = 2.9592107790638380E+00;
1231  x[17] = 3.6677742159463378E+00;
1232  x[18] = 4.4995993983103881E+00;
1233  }
1234  else if (n==35) {
1235  x[ 0] = -6.3759392709822356E+00;
1236  x[ 1] = -5.6432578578857449E+00;
1237  x[ 2] = -5.0360899444730940E+00;
1238  x[ 3] = -4.4995993983103881E+00;
1239  x[ 4] = -4.0292201405043713E+00;
1240  x[ 5] = -3.6677742159463378E+00;
1241  x[ 6] = -3.3491639537131945E+00;
1242  x[ 7] = -2.9592107790638380E+00;
1243  x[ 8] = -2.5705583765842968E+00;
1244  x[ 9] = -2.2665132620567876E+00;
1245  x[10] = -2.0232301911005157E+00;
1246  x[11] = -1.8357079751751868E+00;
1247  x[12] = -1.5794121348467671E+00;
1248  x[13] = -1.2247448713915889E+00;
1249  x[14] = -8.7004089535290285E-01;
1250  x[15] = -5.2403354748695763E-01;
1251  x[16] = -1.7606414208200893E-01;
1252  x[17] = 0.0000000000000000E+00;
1253  x[18] = 1.7606414208200893E-01;
1254  x[19] = 5.2403354748695763E-01;
1255  x[20] = 8.7004089535290285E-01;
1256  x[21] = 1.2247448713915889E+00;
1257  x[22] = 1.5794121348467671E+00;
1258  x[23] = 1.8357079751751868E+00;
1259  x[24] = 2.0232301911005157E+00;
1260  x[25] = 2.2665132620567876E+00;
1261  x[26] = 2.5705583765842968E+00;
1262  x[27] = 2.9592107790638380E+00;
1263  x[28] = 3.3491639537131945E+00;
1264  x[29] = 3.6677742159463378E+00;
1265  x[30] = 4.0292201405043713E+00;
1266  x[31] = 4.4995993983103881E+00;
1267  x[32] = 5.0360899444730940E+00;
1268  x[33] = 5.6432578578857449E+00;
1269  x[34] = 6.3759392709822356E+00;
1270  }
1271  else if (n==37) {
1272  x[ 0] = -6.853200069757519;
1273  x[ 1] = -6.124527854622158;
1274  x[ 2] = -5.521865209868350;
1275  x[ 3] = -4.986551454150765;
1276  x[ 4] = -4.499599398310388;
1277  x[ 5] = -4.057956316089741;
1278  x[ 6] = -3.667774215946338;
1279  x[ 7] = -3.315584617593290;
1280  x[ 8] = -2.959210779063838;
1281  x[ 9] = -2.597288631188366;
1282  x[10] = -2.266513262056788;
1283  x[11] = -2.023230191100516;
1284  x[12] = -1.835707975175187;
1285  x[13] = -1.561553427651873;
1286  x[14] = -1.224744871391589;
1287  x[15] = -0.870040895352903;
1288  x[16] = -0.524033547486958;
1289  x[17] = -0.214618180588171;
1290  x[18] = 0.000000000000000;
1291  x[19] = 0.214618180588171;
1292  x[20] = 0.524033547486958;
1293  x[21] = 0.870040895352903;
1294  x[22] = 1.224744871391589;
1295  x[23] = 1.561553427651873;
1296  x[24] = 1.835707975175187;
1297  x[25] = 2.023230191100516;
1298  x[26] = 2.266513262056788;
1299  x[27] = 2.597288631188366;
1300  x[28] = 2.959210779063838;
1301  x[29] = 3.315584617593290;
1302  x[30] = 3.667774215946338;
1303  x[31] = 4.057956316089741;
1304  x[32] = 4.499599398310388;
1305  x[33] = 4.986551454150765;
1306  x[34] = 5.521865209868350;
1307  x[35] = 6.124527854622158;
1308  x[36] = 6.853200069757519;
1309  }
1310  else if (n==41) {
1311  x[ 0] = -7.251792998192644;
1312  x[ 1] = -6.547083258397540;
1313  x[ 2] = -5.961461043404500;
1314  x[ 3] = -5.437443360177798;
1315  x[ 4] = -4.953574342912980;
1316  x[ 5] = -4.4995993983103881;
1317  x[ 6] = -4.070919267883068;
1318  x[ 7] = -3.6677742159463378;
1319  x[ 8] = -3.296114596212218;
1320  x[ 9] = -2.9592107790638380;
1321  x[10] = -2.630415236459871;
1322  x[11] = -2.2665132620567876;
1323  x[12] = -2.043834754429505;
1324  x[13] = -2.0232301911005157;
1325  x[14] = -1.8357079751751868;
1326  x[15] = -1.585873011819188;
1327  x[16] = -1.2247448713915889;
1328  x[17] = -0.87004089535290285;
1329  x[18] = -0.52403354748695763;
1330  x[19] = -0.195324784415805;
1331  x[20] = 0.0000000000000000;
1332  x[21] = 0.195324784415805;
1333  x[22] = 0.52403354748695763;
1334  x[23] = 0.87004089535290285;
1335  x[24] = 1.2247448713915889;
1336  x[25] = 1.585873011819188;
1337  x[26] = 1.8357079751751868;
1338  x[27] = 2.0232301911005157;
1339  x[28] = 2.043834754429505;
1340  x[29] = 2.2665132620567876;
1341  x[30] = 2.630415236459871;
1342  x[31] = 2.9592107790638380;
1343  x[32] = 3.296114596212218;
1344  x[33] = 3.6677742159463378;
1345  x[34] = 4.070919267883068;
1346  x[35] = 4.4995993983103881;
1347  x[36] = 4.953574342912980;
1348  x[37] = 5.437443360177798;
1349  x[38] = 5.961461043404500;
1350  x[39] = 6.547083258397540;
1351  x[40] = 7.251792998192644;
1352  }
1353  else if (n==43) {
1354  x[ 0] = -10.167574994881873;
1355  x[ 1] = -7.231746029072501;
1356  x[ 2] = -6.535398426382995;
1357  x[ 3] = -5.954781975039809;
1358  x[ 4] = -5.434053000365068;
1359  x[ 5] = -4.952329763008589;
1360  x[ 6] = -4.4995993983103881;
1361  x[ 7] = -4.071335874253583;
1362  x[ 8] = -3.6677742159463378;
1363  x[ 9] = -3.295265921534226;
1364  x[10] = -2.9592107790638380;
1365  x[11] = -2.633356763661946;
1366  x[12] = -2.2665132620567876;
1367  x[13] = -2.089340389294661;
1368  x[14] = -2.0232301911005157;
1369  x[15] = -1.8357079751751868;
1370  x[16] = -1.583643465293944;
1371  x[17] = -1.2247448713915889;
1372  x[18] = -0.87004089535290285;
1373  x[19] = -0.52403354748695763;
1374  x[20] = -0.196029453662011;
1375  x[21] = 0.0000000000000000;
1376  x[22] = 0.196029453662011;
1377  x[23] = 0.52403354748695763;
1378  x[24] = 0.87004089535290285;
1379  x[25] = 1.2247448713915889;
1380  x[26] = 1.583643465293944;
1381  x[27] = 1.8357079751751868;
1382  x[28] = 2.0232301911005157;
1383  x[29] = 2.089340389294661;
1384  x[30] = 2.2665132620567876;
1385  x[31] = 2.633356763661946;
1386  x[32] = 2.9592107790638380;
1387  x[33] = 3.295265921534226;
1388  x[34] = 3.6677742159463378;
1389  x[35] = 4.071335874253583;
1390  x[36] = 4.4995993983103881;
1391  x[37] = 4.952329763008589;
1392  x[38] = 5.434053000365068;
1393  x[39] = 5.954781975039809;
1394  x[40] = 6.535398426382995;
1395  x[41] = 7.231746029072501;
1396  x[42] = 10.167574994881873;
1397  }
1398  else {
1399  std::cerr << "\n";
1400  std::cerr << "HERMITE_GENZ_KEISTER_LOOKUP_POINTS - Fatal error!\n";
1401  std::cerr << " Illegal input value of N.\n";
1402  std::cerr << " N must be 1, 3, 9, 19, 35, 37, 41 or 43.\n";
1403  std::exit(1);
1404  }
1405  return;
1406 }
1407 
1408 //****************************************************************************
1409 template<class Real>
1411 //****************************************************************************
1412 //
1413 // Purpose:
1414 //
1415 // HERMITE_GENZ_KEISTER_LOOKUP_WEIGHTS looks up Genz-Keister Hermite weights.
1416 //
1417 // Discussion:
1418 //
1419 // The integral:
1420 //
1421 // integral ( -oo <= x <= +oo ) f(x) exp ( - x * x ) dx
1422 //
1423 // The quadrature rule:
1424 //
1425 // sum ( 1 <= i <= n ) w(i) * f ( x(i) )
1426 //
1427 // A nested family of rules for the Hermite integration problem
1428 // was produced by Genz and Keister. The structure of the nested
1429 // family was denoted by 1+2+6+10+16, that is, it comprised rules
1430 // of successive orders O = 1, 3, 9, 19, and 35.
1431 //
1432 // The precisions of these rules are P = 1, 5, 15, 29, and 51.
1433 //
1434 // Three related families begin the same way, but end with a different final
1435 // rule. As a convenience, this function includes these final rules as well:
1436 //
1437 // Designation Orders Precisions
1438 //
1439 // 1+2+6+10+16, 1,3,9,19,35 1,5,15,29,51
1440 // 1+2+6+10+18 1,3,9,19,37 1,5,15,29,55
1441 // 1+2+6+10+22 1,3,9,19,41 1,5,15,29,63
1442 // 1+2+6+10+24 1,3,9,19,43 1,5,15,29,67
1443 //
1444 // Some of the data in this function was kindly supplied directly by
1445 // Alan Genz on 24 April 2011.
1446 //
1447 // Licensing:
1448 //
1449 // This code is distributed under the GNU LGPL license.
1450 //
1451 // Modified:
1452 //
1453 // 18 May 2011
1454 //
1455 // Author:
1456 //
1457 // John Burkardt
1458 //
1459 // Reference:
1460 //
1461 // Alan Genz, Bradley Keister,
1462 // Fully symmetric interpolatory rules for multiple integrals
1463 // over infinite regions with Gaussian weight,
1464 // Journal of Computational and Applied Mathematics,
1465 // Volume 71, 1996, pages 299-309
1466 //
1467 // Florian Heiss, Viktor Winschel,
1468 // Likelihood approximation by numerical integration on sparse grids,
1469 // Journal of Econometrics,
1470 // Volume 144, 2008, pages 62-80.
1471 //
1472 // Thomas Patterson,
1473 // The Optimal Addition of Points to Quadrature Formulae,
1474 // Mathematics of Computation,
1475 // Volume 22, Number 104, October 1968, pages 847-856.
1476 //
1477 // Parameters:
1478 //
1479 // Input, int N, the order.
1480 // N must be 1, 3, 9, 19, 35, 37, 41, or 43.
1481 //
1482 // Output, Real W[N], the weights.
1483 //
1484 {
1485  if (n==1) {
1486  w[ 0] = 1.7724538509055159E+00;
1487  }
1488  else if (n==3) {
1489  w[ 0] = 2.9540897515091930E-01;
1490  w[ 1] = 1.1816359006036772E+00;
1491  w[ 2] = 2.9540897515091930E-01;
1492  }
1493  else if (n==9) {
1494  w[ 0] = 1.6708826306882348E-04;
1495  w[ 1] = 1.4173117873979098E-02;
1496  w[ 2] = 1.6811892894767771E-01;
1497  w[ 3] = 4.7869428549114124E-01;
1498  w[ 4] = 4.5014700975378197E-01;
1499  w[ 5] = 4.7869428549114124E-01;
1500  w[ 6] = 1.6811892894767771E-01;
1501  w[ 7] = 1.4173117873979098E-02;
1502  w[ 8] = 1.6708826306882348E-04;
1503  }
1504  else if (n==19) {
1505  w[ 0] = 1.5295717705322357E-09;
1506  w[ 1] = 1.0802767206624762E-06;
1507  w[ 2] = 1.0656589772852267E-04;
1508  w[ 3] = 5.1133174390883855E-03;
1509  w[ 4] = -1.1232438489069229E-02;
1510  w[ 5] = 3.2055243099445879E-02;
1511  w[ 6] = 1.1360729895748269E-01;
1512  w[ 7] = 1.0838861955003017E-01;
1513  w[ 8] = 3.6924643368920851E-01;
1514  w[ 9] = 5.3788160700510168E-01;
1515  w[10] = 3.6924643368920851E-01;
1516  w[11] = 1.0838861955003017E-01;
1517  w[12] = 1.1360729895748269E-01;
1518  w[13] = 3.2055243099445879E-02;
1519  w[14] = -1.1232438489069229E-02;
1520  w[15] = 5.1133174390883855E-03;
1521  w[16] = 1.0656589772852267E-04;
1522  w[17] = 1.0802767206624762E-06;
1523  w[18] = 1.5295717705322357E-09;
1524  }
1525  else if (n==35) {
1526  w[ 0] = 1.8684014894510604E-18;
1527  w[ 1] = 9.6599466278563243E-15;
1528  w[ 2] = 5.4896836948499462E-12;
1529  w[ 3] = 8.1553721816916897E-10;
1530  w[ 4] = 3.7920222392319532E-08;
1531  w[ 5] = 4.3737818040926989E-07;
1532  w[ 6] = 4.8462799737020461E-06;
1533  w[ 7] = 6.3328620805617891E-05;
1534  w[ 8] = 4.8785399304443770E-04;
1535  w[ 9] = 1.4515580425155904E-03;
1536  w[10] = 4.0967527720344047E-03;
1537  w[11] = 5.5928828911469180E-03;
1538  w[12] = 2.7780508908535097E-02;
1539  w[13] = 8.0245518147390893E-02;
1540  w[14] = 1.6371221555735804E-01;
1541  w[15] = 2.6244871488784277E-01;
1542  w[16] = 3.3988595585585218E-01;
1543  w[17] = 9.1262675363737921E-04;
1544  w[18] = 3.3988595585585218E-01;
1545  w[19] = 2.6244871488784277E-01;
1546  w[20] = 1.6371221555735804E-01;
1547  w[21] = 8.0245518147390893E-02;
1548  w[22] = 2.7780508908535097E-02;
1549  w[23] = 5.5928828911469180E-03;
1550  w[24] = 4.0967527720344047E-03;
1551  w[25] = 1.4515580425155904E-03;
1552  w[26] = 4.8785399304443770E-04;
1553  w[27] = 6.3328620805617891E-05;
1554  w[28] = 4.8462799737020461E-06;
1555  w[29] = 4.3737818040926989E-07;
1556  w[30] = 3.7920222392319532E-08;
1557  w[31] = 8.1553721816916897E-10;
1558  w[32] = 5.4896836948499462E-12;
1559  w[33] = 9.6599466278563243E-15;
1560  w[34] = 1.8684014894510604E-18;
1561  }
1562  else if (n==37) {
1563  w[ 0] = 0.19030350940130498E-20;
1564  w[ 1] = 0.187781893143728947E-16;
1565  w[ 2] = 0.182242751549129356E-13;
1566  w[ 3] = 0.45661763676186859E-11;
1567  w[ 4] = 0.422525843963111041E-09;
1568  w[ 5] = 0.16595448809389819E-07;
1569  w[ 6] = 0.295907520230744049E-06;
1570  w[ 7] = 0.330975870979203419E-05;
1571  w[ 8] = 0.32265185983739747E-04;
1572  w[ 9] = 0.234940366465975222E-03;
1573  w[10] = 0.985827582996483824E-03;
1574  w[11] = 0.176802225818295443E-02;
1575  w[12] = 0.43334988122723492E-02;
1576  w[13] = 0.15513109874859354E-01;
1577  w[14] = 0.442116442189845444E-01;
1578  w[15] = 0.937208280655245902E-01;
1579  w[16] = 0.143099302896833389E+00;
1580  w[17] = 0.147655710402686249E+00;
1581  w[18] = 0.968824552928425499E-01;
1582  w[19] = 0.147655710402686249E+00;
1583  w[20] = 0.143099302896833389E+00;
1584  w[21] = 0.937208280655245902E-01;
1585  w[22] = 0.442116442189845444E-01;
1586  w[23] = 0.15513109874859354E-01;
1587  w[24] = 0.43334988122723492E-02;
1588  w[25] = 0.176802225818295443E-02;
1589  w[26] = 0.985827582996483824E-03;
1590  w[27] = 0.234940366465975222E-03;
1591  w[28] = 0.32265185983739747E-04;
1592  w[29] = 0.330975870979203419E-05;
1593  w[30] = 0.295907520230744049E-06;
1594  w[31] = 0.16595448809389819E-07;
1595  w[32] = 0.422525843963111041E-09;
1596  w[33] = 0.45661763676186859E-11;
1597  w[34] = 0.182242751549129356E-13;
1598  w[35] = 0.187781893143728947E-16;
1599  w[36] = 0.19030350940130498E-20;
1600  }
1601  else if (n==41) {
1602  w[ 0] = 0.664195893812757801E-23;
1603  w[ 1] = 0.860427172512207236E-19;
1604  w[ 2] = 0.1140700785308509E-15;
1605  w[ 3] = 0.408820161202505983E-13;
1606  w[ 4] = 0.581803393170320419E-11;
1607  w[ 5] = 0.400784141604834759E-09;
1608  w[ 6] = 0.149158210417831408E-07;
1609  w[ 7] = 0.315372265852264871E-06;
1610  w[ 8] = 0.381182791749177506E-05;
1611  w[ 9] = 0.288976780274478689E-04;
1612  w[10] = 0.189010909805097887E-03;
1613  w[11] = 0.140697424065246825E-02;
1614  w[12] = - 0.144528422206988237E-01;
1615  w[13] = 0.178852543033699732E-01;
1616  w[14] = 0.705471110122962612E-03;
1617  w[15] = 0.165445526705860772E-01;
1618  w[16] = 0.45109010335859128E-01;
1619  w[17] = 0.928338228510111845E-01;
1620  w[18] = 0.145966293895926429E+00;
1621  w[19] = 0.165639740400529554E+00;
1622  w[20] = 0.562793426043218877E-01;
1623  w[21] = 0.165639740400529554E+00;
1624  w[22] = 0.145966293895926429E+00;
1625  w[23] = 0.928338228510111845E-01;
1626  w[24] = 0.45109010335859128E-01;
1627  w[25] = 0.165445526705860772E-01;
1628  w[26] = 0.705471110122962612E-03;
1629  w[27] = 0.178852543033699732E-01;
1630  w[28] = - 0.144528422206988237E-01;
1631  w[29] = 0.140697424065246825E-02;
1632  w[30] = 0.189010909805097887E-03;
1633  w[31] = 0.288976780274478689E-04;
1634  w[32] = 0.381182791749177506E-05;
1635  w[33] = 0.315372265852264871E-06;
1636  w[34] = 0.149158210417831408E-07;
1637  w[35] = 0.400784141604834759E-09;
1638  w[36] = 0.581803393170320419E-11;
1639  w[37] = 0.408820161202505983E-13;
1640  w[38] = 0.1140700785308509E-15;
1641  w[39] = 0.860427172512207236E-19;
1642  w[40] = 0.664195893812757801E-23;
1643  }
1644  else if (n==43) {
1645  w[ 0] = 0.546191947478318097E-37;
1646  w[ 1] = 0.87544909871323873E-23;
1647  w[ 2] = 0.992619971560149097E-19;
1648  w[ 3] = 0.122619614947864357E-15;
1649  w[ 4] = 0.421921851448196032E-13;
1650  w[ 5] = 0.586915885251734856E-11;
1651  w[ 6] = 0.400030575425776948E-09;
1652  w[ 7] = 0.148653643571796457E-07;
1653  w[ 8] = 0.316018363221289247E-06;
1654  w[ 9] = 0.383880761947398577E-05;
1655  w[10] = 0.286802318064777813E-04;
1656  w[11] = 0.184789465688357423E-03;
1657  w[12] = 0.150909333211638847E-02;
1658  w[13] = - 0.38799558623877157E-02;
1659  w[14] = 0.67354758901013295E-02;
1660  w[15] = 0.139966252291568061E-02;
1661  w[16] = 0.163616873493832402E-01;
1662  w[17] = 0.450612329041864976E-01;
1663  w[18] = 0.928711584442575456E-01;
1664  w[19] = 0.145863292632147353E+00;
1665  w[20] = 0.164880913687436689E+00;
1666  w[21] = 0.579595986101181095E-01;
1667  w[22] = 0.164880913687436689E+00;
1668  w[23] = 0.145863292632147353E+00;
1669  w[24] = 0.928711584442575456E-01;
1670  w[25] = 0.450612329041864976E-01;
1671  w[26] = 0.163616873493832402E-01;
1672  w[27] = 0.139966252291568061E-02;
1673  w[28] = 0.67354758901013295E-02;
1674  w[29] = - 0.38799558623877157E-02;
1675  w[30] = 0.150909333211638847E-02;
1676  w[31] = 0.184789465688357423E-03;
1677  w[32] = 0.286802318064777813E-04;
1678  w[33] = 0.383880761947398577E-05;
1679  w[34] = 0.316018363221289247E-06;
1680  w[35] = 0.148653643571796457E-07;
1681  w[36] = 0.400030575425776948E-09;
1682  w[37] = 0.586915885251734856E-11;
1683  w[38] = 0.421921851448196032E-13;
1684  w[39] = 0.122619614947864357E-15;
1685  w[40] = 0.992619971560149097E-19;
1686  w[41] = 0.87544909871323873E-23;
1687  w[42] = 0.546191947478318097E-37;
1688  }
1689  else {
1690  std::cerr << "\n";
1691  std::cerr << "HERMITE_GENZ_KEISTER_LOOKUP_WEIGHTS - Fatal error!\n";
1692  std::cerr << " Illegal input value of N.\n";
1693  std::cerr << " N must be 1, 3, 9, 19, 35, 37, 41 or 43.\n";
1694  std::exit(1);
1695  }
1696  return;
1697 }
1698 
1699 //****************************************************************************
1700 template<class Real>
1701 void ROLBurkardtRules::hermite_lookup ( int n, Real x[], Real w[] )
1702 //****************************************************************************
1703 //
1704 // Purpose:
1705 //
1706 // HERMITE_LOOKUP looks up abscissas and weights for Gauss-Hermite quadrature.
1707 //
1708 // Licensing:
1709 //
1710 // This code is distributed under the GNU LGPL license.
1711 //
1712 // Modified:
1713 //
1714 // 27 April 2010
1715 //
1716 // Author:
1717 //
1718 // John Burkardt
1719 //
1720 // Reference:
1721 //
1722 // Milton Abramowitz, Irene Stegun,
1723 // Handbook of Mathematical Functions,
1724 // National Bureau of Standards, 1964,
1725 // ISBN: 0-486-61272-4,
1726 // LC: QA47.A34.
1727 //
1728 // Vladimir Krylov,
1729 // Approximate Calculation of Integrals,
1730 // Dover, 2006,
1731 // ISBN: 0486445798.
1732 // LC: QA311.K713.
1733 //
1734 // Arthur Stroud, Don Secrest,
1735 // Gaussian Quadrature Formulas,
1736 // Prentice Hall, 1966,
1737 // LC: QA299.4G3S7.
1738 //
1739 // Stephen Wolfram,
1740 // The Mathematica Book,
1741 // Fourth Edition,
1742 // Cambridge University Press, 1999,
1743 // ISBN: 0-521-64314-7,
1744 // LC: QA76.95.W65.
1745 //
1746 // Daniel Zwillinger, editor,
1747 // CRC Standard Mathematical Tables and Formulae,
1748 // 30th Edition,
1749 // CRC Press, 1996,
1750 // ISBN: 0-8493-2479-3,
1751 // LC: QA47.M315.
1752 //
1753 // Parameters:
1754 //
1755 // Input, int N, the order.
1756 // N must be between 1 and 20.
1757 //
1758 // Output, Real X[N], the abscissas.
1759 //
1760 // Output, Real W[N], the weights.
1761 //
1762 {
1765 
1766  return;
1767 }
1768 
1769 //****************************************************************************
1770 template<class Real>
1772 //****************************************************************************
1773 //
1774 // Purpose:
1775 //
1776 // HERMITE_LOOKUP_POINTS looks up abscissas for Hermite quadrature.
1777 //
1778 // Discussion:
1779 //
1780 // The integral:
1781 //
1782 // integral ( -oo < x < +oo ) exp ( - x * x ) * f(x) dx
1783 //
1784 // The quadrature rule:
1785 //
1786 // sum ( 1 <= i <= n ) w(i) * f ( x(i) ).
1787 //
1788 // Mathematica can numerically estimate the abscissas
1789 // of order N to P digits by the command:
1790 //
1791 // NSolve [ HermiteH [ n, x ] == 0, x, p ]
1792 //
1793 // Licensing:
1794 //
1795 // This code is distributed under the GNU LGPL license.
1796 //
1797 // Modified:
1798 //
1799 // 27 April 2010
1800 //
1801 // Author:
1802 //
1803 // John Burkardt
1804 //
1805 // Reference:
1806 //
1807 // Milton Abramowitz, Irene Stegun,
1808 // Handbook of Mathematical Functions,
1809 // National Bureau of Standards, 1964,
1810 // ISBN: 0-486-61272-4,
1811 // LC: QA47.A34.
1812 //
1813 // Vladimir Krylov,
1814 // Approximate Calculation of Integrals,
1815 // Dover, 2006,
1816 // ISBN: 0486445798,
1817 // LC: QA311.K713.
1818 //
1819 // Arthur Stroud, Don Secrest,
1820 // Gaussian Quadrature Formulas,
1821 // Prentice Hall, 1966,
1822 // LC: QA299.4G3S7.
1823 //
1824 // Stephen Wolfram,
1825 // The Mathematica Book,
1826 // Fourth Edition,
1827 // Cambridge University Press, 1999,
1828 // ISBN: 0-521-64314-7,
1829 // LC: QA76.95.W65.
1830 //
1831 // Daniel Zwillinger, editor,
1832 // CRC Standard Mathematical Tables and Formulae,
1833 // 30th Edition,
1834 // CRC Press, 1996,
1835 // ISBN: 0-8493-2479-3,
1836 // LC: QA47.M315.
1837 //
1838 // Parameters:
1839 //
1840 // Input, int N, the order.
1841 // N must be between 1 and 20.
1842 //
1843 // Output, Real X[N], the abscissas.
1844 //
1845 {
1846  if (n==1) {
1847  x[ 0] = 0.0;
1848  }
1849  else if(n==2) {
1850  x[ 0] = - 0.707106781186547524400844362105E+00;
1851  x[ 1] = 0.707106781186547524400844362105E+00;
1852  }
1853  else if (n==3) {
1854  x[ 0] = - 0.122474487139158904909864203735E+01;
1855  x[ 1] = 0.0E+00;
1856  x[ 2] = 0.122474487139158904909864203735E+01;
1857  }
1858  else if (n==4) {
1859  x[ 0] = - 0.165068012388578455588334111112E+01;
1860  x[ 1] = - 0.524647623275290317884060253835E+00;
1861  x[ 2] = 0.524647623275290317884060253835E+00;
1862  x[ 3] = 0.165068012388578455588334111112E+01;
1863  }
1864  else if (n==5) {
1865  x[ 0] = - 0.202018287045608563292872408814E+01;
1866  x[ 1] = - 0.958572464613818507112770593893E+00;
1867  x[ 2] = 0.0E+00;
1868  x[ 3] = 0.958572464613818507112770593893E+00;
1869  x[ 4] = 0.202018287045608563292872408814E+01;
1870  }
1871  else if (n==6) {
1872  x[ 0] = - 0.235060497367449222283392198706E+01;
1873  x[ 1] = - 0.133584907401369694971489528297E+01;
1874  x[ 2] = - 0.436077411927616508679215948251E+00;
1875  x[ 3] = 0.436077411927616508679215948251E+00;
1876  x[ 4] = 0.133584907401369694971489528297E+01;
1877  x[ 5] = 0.235060497367449222283392198706E+01;
1878  }
1879  else if (n==7) {
1880  x[ 0] = - 0.265196135683523349244708200652E+01;
1881  x[ 1] = - 0.167355162876747144503180139830E+01;
1882  x[ 2] = - 0.816287882858964663038710959027E+00;
1883  x[ 3] = 0.0E+00;
1884  x[ 4] = 0.816287882858964663038710959027E+00;
1885  x[ 5] = 0.167355162876747144503180139830E+01;
1886  x[ 6] = 0.265196135683523349244708200652E+01;
1887  }
1888  else if (n==8) {
1889  x[ 0] = - 0.293063742025724401922350270524E+01;
1890  x[ 1] = - 0.198165675669584292585463063977E+01;
1891  x[ 2] = - 0.115719371244678019472076577906E+01;
1892  x[ 3] = - 0.381186990207322116854718885584E+00;
1893  x[ 4] = 0.381186990207322116854718885584E+00;
1894  x[ 5] = 0.115719371244678019472076577906E+01;
1895  x[ 6] = 0.198165675669584292585463063977E+01;
1896  x[ 7] = 0.293063742025724401922350270524E+01;
1897  }
1898  else if (n==9) {
1899  x[ 0] = - 0.319099320178152760723004779538E+01;
1900  x[ 1] = - 0.226658058453184311180209693284E+01;
1901  x[ 2] = - 0.146855328921666793166701573925E+01;
1902  x[ 3] = - 0.723551018752837573322639864579E+00;
1903  x[ 4] = 0.0E+00;
1904  x[ 5] = 0.723551018752837573322639864579E+00;
1905  x[ 6] = 0.146855328921666793166701573925E+01;
1906  x[ 7] = 0.226658058453184311180209693284E+01;
1907  x[ 8] = 0.319099320178152760723004779538E+01;
1908  }
1909  else if (n==10) {
1910  x[ 0] = - 0.343615911883773760332672549432E+01;
1911  x[ 1] = - 0.253273167423278979640896079775E+01;
1912  x[ 2] = - 0.175668364929988177345140122011E+01;
1913  x[ 3] = - 0.103661082978951365417749191676E+01;
1914  x[ 4] = - 0.342901327223704608789165025557E+00;
1915  x[ 5] = 0.342901327223704608789165025557E+00;
1916  x[ 6] = 0.103661082978951365417749191676E+01;
1917  x[ 7] = 0.175668364929988177345140122011E+01;
1918  x[ 8] = 0.253273167423278979640896079775E+01;
1919  x[ 9] = 0.343615911883773760332672549432E+01;
1920  }
1921  else if (n==11) {
1922  x[ 0] = - 0.366847084655958251845837146485E+01;
1923  x[ 1] = - 0.278329009978165177083671870152E+01;
1924  x[ 2] = - 0.202594801582575533516591283121E+01;
1925  x[ 3] = - 0.132655708449493285594973473558E+01;
1926  x[ 4] = - 0.656809566882099765024611575383E+00;
1927  x[ 5] = 0.0E+00;
1928  x[ 6] = 0.656809566882099765024611575383E+00;
1929  x[ 7] = 0.132655708449493285594973473558E+01;
1930  x[ 8] = 0.202594801582575533516591283121E+01;
1931  x[ 9] = 0.278329009978165177083671870152E+01;
1932  x[10] = 0.366847084655958251845837146485E+01;
1933  }
1934  else if (n==12) {
1935  x[ 0] = - 0.388972489786978191927164274724E+01;
1936  x[ 1] = - 0.302063702512088977171067937518E+01;
1937  x[ 2] = - 0.227950708050105990018772856942E+01;
1938  x[ 3] = - 0.159768263515260479670966277090E+01;
1939  x[ 4] = - 0.947788391240163743704578131060E+00;
1940  x[ 5] = - 0.314240376254359111276611634095E+00;
1941  x[ 6] = 0.314240376254359111276611634095E+00;
1942  x[ 7] = 0.947788391240163743704578131060E+00;
1943  x[ 8] = 0.159768263515260479670966277090E+01;
1944  x[ 9] = 0.227950708050105990018772856942E+01;
1945  x[10] = 0.302063702512088977171067937518E+01;
1946  x[11] = 0.388972489786978191927164274724E+01;
1947  }
1948  else if (n==13) {
1949  x[ 0] = - 0.410133759617863964117891508007E+01;
1950  x[ 1] = - 0.324660897837240998812205115236E+01;
1951  x[ 2] = - 0.251973568567823788343040913628E+01;
1952  x[ 3] = - 0.185310765160151214200350644316E+01;
1953  x[ 4] = - 0.122005503659074842622205526637E+01;
1954  x[ 5] = - 0.605763879171060113080537108602E+00;
1955  x[ 6] = 0.0E+00;
1956  x[ 7] = 0.605763879171060113080537108602E+00;
1957  x[ 8] = 0.122005503659074842622205526637E+01;
1958  x[ 9] = 0.185310765160151214200350644316E+01;
1959  x[10] = 0.251973568567823788343040913628E+01;
1960  x[11] = 0.324660897837240998812205115236E+01;
1961  x[12] = 0.410133759617863964117891508007E+01;
1962  }
1963  else if (n==14) {
1964  x[ 0] = - 0.430444857047363181262129810037E+01;
1965  x[ 1] = - 0.346265693360227055020891736115E+01;
1966  x[ 2] = - 0.274847072498540256862499852415E+01;
1967  x[ 3] = - 0.209518325850771681573497272630E+01;
1968  x[ 4] = - 0.147668273114114087058350654421E+01;
1969  x[ 5] = - 0.878713787329399416114679311861E+00;
1970  x[ 6] = - 0.291745510672562078446113075799E+00;
1971  x[ 7] = 0.291745510672562078446113075799E+00;
1972  x[ 8] = 0.878713787329399416114679311861E+00;
1973  x[ 9] = 0.147668273114114087058350654421E+01;
1974  x[10] = 0.209518325850771681573497272630E+01;
1975  x[11] = 0.274847072498540256862499852415E+01;
1976  x[12] = 0.346265693360227055020891736115E+01;
1977  x[13] = 0.430444857047363181262129810037E+01;
1978  }
1979  else if (n==15) {
1980  x[ 0] = - 0.449999070730939155366438053053E+01;
1981  x[ 1] = - 0.366995037340445253472922383312E+01;
1982  x[ 2] = - 0.296716692790560324848896036355E+01;
1983  x[ 3] = - 0.232573248617385774545404479449E+01;
1984  x[ 4] = - 0.171999257518648893241583152515E+01;
1985  x[ 5] = - 0.113611558521092066631913490556E+01;
1986  x[ 6] = - 0.565069583255575748526020337198E+00;
1987  x[ 7] = 0.0E+00;
1988  x[ 8] = 0.565069583255575748526020337198E+00;
1989  x[ 9] = 0.113611558521092066631913490556E+01;
1990  x[10] = 0.171999257518648893241583152515E+01;
1991  x[11] = 0.232573248617385774545404479449E+01;
1992  x[12] = 0.296716692790560324848896036355E+01;
1993  x[13] = 0.366995037340445253472922383312E+01;
1994  x[14] = 0.449999070730939155366438053053E+01;
1995  }
1996  else if (n==16) {
1997  x[ 0] = - 0.468873893930581836468849864875E+01;
1998  x[ 1] = - 0.386944790486012269871942409801E+01;
1999  x[ 2] = - 0.317699916197995602681399455926E+01;
2000  x[ 3] = - 0.254620215784748136215932870545E+01;
2001  x[ 4] = - 0.195178799091625397743465541496E+01;
2002  x[ 5] = - 0.138025853919888079637208966969E+01;
2003  x[ 6] = - 0.822951449144655892582454496734E+00;
2004  x[ 7] = - 0.273481046138152452158280401965E+00;
2005  x[ 8] = 0.273481046138152452158280401965E+00;
2006  x[ 9] = 0.822951449144655892582454496734E+00;
2007  x[10] = 0.138025853919888079637208966969E+01;
2008  x[11] = 0.195178799091625397743465541496E+01;
2009  x[12] = 0.254620215784748136215932870545E+01;
2010  x[13] = 0.317699916197995602681399455926E+01;
2011  x[14] = 0.386944790486012269871942409801E+01;
2012  x[15] = 0.468873893930581836468849864875E+01;
2013  }
2014  else if (n==17) {
2015  x[ 0] = - 0.487134519367440308834927655662E+01;
2016  x[ 1] = - 0.406194667587547430689245559698E+01;
2017  x[ 2] = - 0.337893209114149408338327069289E+01;
2018  x[ 3] = - 0.275776291570388873092640349574E+01;
2019  x[ 4] = - 0.217350282666662081927537907149E+01;
2020  x[ 5] = - 0.161292431422123133311288254454E+01;
2021  x[ 6] = - 0.106764872574345055363045773799E+01;
2022  x[ 7] = - 0.531633001342654731349086553718E+00;
2023  x[ 8] = 0.0E+00;
2024  x[ 9] = 0.531633001342654731349086553718E+00;
2025  x[10] = 0.106764872574345055363045773799E+01;
2026  x[11] = 0.161292431422123133311288254454E+01;
2027  x[12] = 0.217350282666662081927537907149E+01;
2028  x[13] = 0.275776291570388873092640349574E+01;
2029  x[14] = 0.337893209114149408338327069289E+01;
2030  x[15] = 0.406194667587547430689245559698E+01;
2031  x[16] = 0.487134519367440308834927655662E+01;
2032  }
2033  else if (n==18) {
2034  x[ 0] = - 0.504836400887446676837203757885E+01;
2035  x[ 1] = - 0.424811787356812646302342016090E+01;
2036  x[ 2] = - 0.357376906848626607950067599377E+01;
2037  x[ 3] = - 0.296137750553160684477863254906E+01;
2038  x[ 4] = - 0.238629908916668600026459301424E+01;
2039  x[ 5] = - 0.183553160426162889225383944409E+01;
2040  x[ 6] = - 0.130092085838961736566626555439E+01;
2041  x[ 7] = - 0.776682919267411661316659462284E+00;
2042  x[ 8] = - 0.258267750519096759258116098711E+00;
2043  x[ 9] = 0.258267750519096759258116098711E+00;
2044  x[10] = 0.776682919267411661316659462284E+00;
2045  x[11] = 0.130092085838961736566626555439E+01;
2046  x[12] = 0.183553160426162889225383944409E+01;
2047  x[13] = 0.238629908916668600026459301424E+01;
2048  x[14] = 0.296137750553160684477863254906E+01;
2049  x[15] = 0.357376906848626607950067599377E+01;
2050  x[16] = 0.424811787356812646302342016090E+01;
2051  x[17] = 0.504836400887446676837203757885E+01;
2052  }
2053  else if (n==19) {
2054  x[ 0] = - 0.522027169053748216460967142500E+01;
2055  x[ 1] = - 0.442853280660377943723498532226E+01;
2056  x[ 2] = - 0.376218735196402009751489394104E+01;
2057  x[ 3] = - 0.315784881834760228184318034120E+01;
2058  x[ 4] = - 0.259113378979454256492128084112E+01;
2059  x[ 5] = - 0.204923170985061937575050838669E+01;
2060  x[ 6] = - 0.152417061939353303183354859367E+01;
2061  x[ 7] = - 0.101036838713431135136859873726E+01;
2062  x[ 8] = - 0.503520163423888209373811765050E+00;
2063  x[ 9] = 0.0E+00;
2064  x[10] = 0.503520163423888209373811765050E+00;
2065  x[11] = 0.101036838713431135136859873726E+01;
2066  x[12] = 0.152417061939353303183354859367E+01;
2067  x[13] = 0.204923170985061937575050838669E+01;
2068  x[14] = 0.259113378979454256492128084112E+01;
2069  x[15] = 0.315784881834760228184318034120E+01;
2070  x[16] = 0.376218735196402009751489394104E+01;
2071  x[17] = 0.442853280660377943723498532226E+01;
2072  x[18] = 0.522027169053748216460967142500E+01;
2073  }
2074  else if (n==20) {
2075  x[ 0] = - 0.538748089001123286201690041068E+01;
2076  x[ 1] = - 0.460368244955074427307767524898E+01;
2077  x[ 2] = - 0.394476404011562521037562880052E+01;
2078  x[ 3] = - 0.334785456738321632691492452300E+01;
2079  x[ 4] = - 0.278880605842813048052503375640E+01;
2080  x[ 5] = - 0.225497400208927552308233334473E+01;
2081  x[ 6] = - 0.173853771211658620678086566214E+01;
2082  x[ 7] = - 0.123407621539532300788581834696E+01;
2083  x[ 8] = - 0.737473728545394358705605144252E+00;
2084  x[ 9] = - 0.245340708300901249903836530634E+00;
2085  x[10] = 0.245340708300901249903836530634E+00;
2086  x[11] = 0.737473728545394358705605144252E+00;
2087  x[12] = 0.123407621539532300788581834696E+01;
2088  x[13] = 0.173853771211658620678086566214E+01;
2089  x[14] = 0.225497400208927552308233334473E+01;
2090  x[15] = 0.278880605842813048052503375640E+01;
2091  x[16] = 0.334785456738321632691492452300E+01;
2092  x[17] = 0.394476404011562521037562880052E+01;
2093  x[18] = 0.460368244955074427307767524898E+01;
2094  x[19] = 0.538748089001123286201690041068E+01;
2095  }
2096  else {
2097  std::cerr << "\n";
2098  std::cerr << "HERMITE_LOOKUP_POINTS - Fatal error!\n";
2099  std::cerr << " Illegal value of N = " << n << "\n";
2100  std::cerr << " Legal values are 1 through 20.\n";
2101  std::exit(1);
2102  }
2103 
2104  return;
2105 }
2106 
2107 //****************************************************************************
2108 template<class Real>
2110 //****************************************************************************
2111 //
2112 // Purpose:
2113 //
2114 // HERMITE_LOOKUP_WEIGHTS looks up weights for Hermite quadrature.
2115 //
2116 // Discussion:
2117 //
2118 // The integral:
2119 //
2120 // integral ( -oo < x < +oo ) exp ( - x * x ) * f(x) dx
2121 //
2122 // The quadrature rule:
2123 //
2124 // sum ( 1 <= i <= n ) w(i) * f ( x(i) ).
2125 //
2126 // Mathematica can numerically estimate the abscissas
2127 // of order N to P digits by the command:
2128 //
2129 // NSolve [ HermiteH [ n, x ] == 0, x, p ]
2130 //
2131 // Licensing:
2132 //
2133 // This code is distributed under the GNU LGPL license.
2134 //
2135 // Modified:
2136 //
2137 // 27 April 2010
2138 //
2139 // Author:
2140 //
2141 // John Burkardt
2142 //
2143 // Reference:
2144 //
2145 // Milton Abramowitz, Irene Stegun,
2146 // Handbook of Mathematical Functions,
2147 // National Bureau of Standards, 1964,
2148 // ISBN: 0-486-61272-4,
2149 // LC: QA47.A34.
2150 //
2151 // Vladimir Krylov,
2152 // Approximate Calculation of Integrals,
2153 // Dover, 2006,
2154 // ISBN: 0486445798,
2155 // LC: QA311.K713.
2156 //
2157 // Arthur Stroud, Don Secrest,
2158 // Gaussian Quadrature Formulas,
2159 // Prentice Hall, 1966,
2160 // LC: QA299.4G3S7.
2161 //
2162 // Stephen Wolfram,
2163 // The Mathematica Book,
2164 // Fourth Edition,
2165 // Cambridge University Press, 1999,
2166 // ISBN: 0-521-64314-7,
2167 // LC: QA76.95.W65.
2168 //
2169 // Daniel Zwillinger, editor,
2170 // CRC Standard Mathematical Tables and Formulae,
2171 // 30th Edition,
2172 // CRC Press, 1996,
2173 // ISBN: 0-8493-2479-3,
2174 // LC: QA47.M315.
2175 //
2176 // Parameters:
2177 //
2178 // Input, int N, the order.
2179 // N must be between 1 and 20.
2180 //
2181 // Output, Real W[N], the weights.
2182 //
2183 {
2184  if (n==1) {
2185  w[ 0] = 1.77245385090551602729816748334;
2186  }
2187  else if (n==2) {
2188  w[ 0] = 0.886226925452758013649083741671E+00;
2189  w[ 1] = 0.886226925452758013649083741671E+00;
2190  }
2191  else if (n==3) {
2192  w[ 0] = 0.295408975150919337883027913890E+00;
2193  w[ 1] = 0.118163590060367735153211165556E+01;
2194  w[ 2] = 0.295408975150919337883027913890E+00;
2195  }
2196  else if (n==4) {
2197  w[ 0] = 0.813128354472451771430345571899E-01;
2198  w[ 1] = 0.804914090005512836506049184481E+00;
2199  w[ 2] = 0.804914090005512836506049184481E+00;
2200  w[ 3] = 0.813128354472451771430345571899E-01;
2201  }
2202  else if (n==5) {
2203  w[ 0] = 0.199532420590459132077434585942E-01;
2204  w[ 1] = 0.393619323152241159828495620852E+00;
2205  w[ 2] = 0.945308720482941881225689324449E+00;
2206  w[ 3] = 0.393619323152241159828495620852E+00;
2207  w[ 4] = 0.199532420590459132077434585942E-01;
2208  }
2209  else if (n==6) {
2210  w[ 0] = 0.453000990550884564085747256463E-02;
2211  w[ 1] = 0.157067320322856643916311563508E+00;
2212  w[ 2] = 0.724629595224392524091914705598E+00;
2213  w[ 3] = 0.724629595224392524091914705598E+00;
2214  w[ 4] = 0.157067320322856643916311563508E+00;
2215  w[ 5] = 0.453000990550884564085747256463E-02;
2216  }
2217  else if (n==7) {
2218  w[ 0] = 0.971781245099519154149424255939E-03;
2219  w[ 1] = 0.545155828191270305921785688417E-01;
2220  w[ 2] = 0.425607252610127800520317466666E+00;
2221  w[ 3] = 0.810264617556807326764876563813E+00;
2222  w[ 4] = 0.425607252610127800520317466666E+00;
2223  w[ 5] = 0.545155828191270305921785688417E-01;
2224  w[ 6] = 0.971781245099519154149424255939E-03;
2225  }
2226  else if (n==8) {
2227  w[ 0] = 0.199604072211367619206090452544E-03;
2228  w[ 1] = 0.170779830074134754562030564364E-01;
2229  w[ 2] = 0.207802325814891879543258620286E+00;
2230  w[ 3] = 0.661147012558241291030415974496E+00;
2231  w[ 4] = 0.661147012558241291030415974496E+00;
2232  w[ 5] = 0.207802325814891879543258620286E+00;
2233  w[ 6] = 0.170779830074134754562030564364E-01;
2234  w[ 7] = 0.199604072211367619206090452544E-03;
2235  }
2236  else if (n==9) {
2237  w[ 0] = 0.396069772632643819045862946425E-04;
2238  w[ 1] = 0.494362427553694721722456597763E-02;
2239  w[ 2] = 0.884745273943765732879751147476E-01;
2240  w[ 3] = 0.432651559002555750199812112956E+00;
2241  w[ 4] = 0.720235215606050957124334723389E+00;
2242  w[ 5] = 0.432651559002555750199812112956E+00;
2243  w[ 6] = 0.884745273943765732879751147476E-01;
2244  w[ 7] = 0.494362427553694721722456597763E-02;
2245  w[ 8] = 0.396069772632643819045862946425E-04;
2246  }
2247  else if (n==10) {
2248  w[ 0] = 0.764043285523262062915936785960E-05;
2249  w[ 1] = 0.134364574678123269220156558585E-02;
2250  w[ 2] = 0.338743944554810631361647312776E-01;
2251  w[ 3] = 0.240138611082314686416523295006E+00;
2252  w[ 4] = 0.610862633735325798783564990433E+00;
2253  w[ 5] = 0.610862633735325798783564990433E+00;
2254  w[ 6] = 0.240138611082314686416523295006E+00;
2255  w[ 7] = 0.338743944554810631361647312776E-01;
2256  w[ 8] = 0.134364574678123269220156558585E-02;
2257  w[ 9] = 0.764043285523262062915936785960E-05;
2258  }
2259  else if (n==11) {
2260  w[ 0] = 0.143956039371425822033088366032E-05;
2261  w[ 1] = 0.346819466323345510643413772940E-03;
2262  w[ 2] = 0.119113954449115324503874202916E-01;
2263  w[ 3] = 0.117227875167708503381788649308E+00;
2264  w[ 4] = 0.429359752356125028446073598601E+00;
2265  w[ 5] = 0.654759286914591779203940657627E+00;
2266  w[ 6] = 0.429359752356125028446073598601E+00;
2267  w[ 7] = 0.117227875167708503381788649308E+00;
2268  w[ 8] = 0.119113954449115324503874202916E-01;
2269  w[ 9] = 0.346819466323345510643413772940E-03;
2270  w[10] = 0.143956039371425822033088366032E-05;
2271  }
2272  else if (n==12) {
2273  w[ 0] = 0.265855168435630160602311400877E-06;
2274  w[ 1] = 0.857368704358785865456906323153E-04;
2275  w[ 2] = 0.390539058462906185999438432620E-02;
2276  w[ 3] = 0.516079856158839299918734423606E-01;
2277  w[ 4] = 0.260492310264161129233396139765E+00;
2278  w[ 5] = 0.570135236262479578347113482275E+00;
2279  w[ 6] = 0.570135236262479578347113482275E+00;
2280  w[ 7] = 0.260492310264161129233396139765E+00;
2281  w[ 8] = 0.516079856158839299918734423606E-01;
2282  w[ 9] = 0.390539058462906185999438432620E-02;
2283  w[10] = 0.857368704358785865456906323153E-04;
2284  w[11] = 0.265855168435630160602311400877E-06;
2285  }
2286  else if (n==13) {
2287  w[ 0] = 0.482573185007313108834997332342E-07;
2288  w[ 1] = 0.204303604027070731248669432937E-04;
2289  w[ 2] = 0.120745999271938594730924899224E-02;
2290  w[ 3] = 0.208627752961699392166033805050E-01;
2291  w[ 4] = 0.140323320687023437762792268873E+00;
2292  w[ 5] = 0.421616296898543221746893558568E+00;
2293  w[ 6] = 0.604393187921161642342099068579E+00;
2294  w[ 7] = 0.421616296898543221746893558568E+00;
2295  w[ 8] = 0.140323320687023437762792268873E+00;
2296  w[ 9] = 0.208627752961699392166033805050E-01;
2297  w[10] = 0.120745999271938594730924899224E-02;
2298  w[11] = 0.204303604027070731248669432937E-04;
2299  w[12] = 0.482573185007313108834997332342E-07;
2300  }
2301  else if (n==14) {
2302  w[ 0] = 0.862859116812515794532041783429E-08;
2303  w[ 1] = 0.471648435501891674887688950105E-05;
2304  w[ 2] = 0.355092613551923610483661076691E-03;
2305  w[ 3] = 0.785005472645794431048644334608E-02;
2306  w[ 4] = 0.685055342234652055387163312367E-01;
2307  w[ 5] = 0.273105609064246603352569187026E+00;
2308  w[ 6] = 0.536405909712090149794921296776E+00;
2309  w[ 7] = 0.536405909712090149794921296776E+00;
2310  w[ 8] = 0.273105609064246603352569187026E+00;
2311  w[ 9] = 0.685055342234652055387163312367E-01;
2312  w[10] = 0.785005472645794431048644334608E-02;
2313  w[11] = 0.355092613551923610483661076691E-03;
2314  w[12] = 0.471648435501891674887688950105E-05;
2315  w[13] = 0.862859116812515794532041783429E-08;
2316  }
2317  else if (n==15) {
2318  w[ 0] = 0.152247580425351702016062666965E-08;
2319  w[ 1] = 0.105911554771106663577520791055E-05;
2320  w[ 2] = 0.100004441232499868127296736177E-03;
2321  w[ 3] = 0.277806884291277589607887049229E-02;
2322  w[ 4] = 0.307800338725460822286814158758E-01;
2323  w[ 5] = 0.158488915795935746883839384960E+00;
2324  w[ 6] = 0.412028687498898627025891079568E+00;
2325  w[ 7] = 0.564100308726417532852625797340E+00;
2326  w[ 8] = 0.412028687498898627025891079568E+00;
2327  w[ 9] = 0.158488915795935746883839384960E+00;
2328  w[10] = 0.307800338725460822286814158758E-01;
2329  w[11] = 0.277806884291277589607887049229E-02;
2330  w[12] = 0.100004441232499868127296736177E-03;
2331  w[13] = 0.105911554771106663577520791055E-05;
2332  w[14] = 0.152247580425351702016062666965E-08;
2333  }
2334  else if (n==16) {
2335  w[ 0] = 0.265480747401118224470926366050E-09;
2336  w[ 1] = 0.232098084486521065338749423185E-06;
2337  w[ 2] = 0.271186009253788151201891432244E-04;
2338  w[ 3] = 0.932284008624180529914277305537E-03;
2339  w[ 4] = 0.128803115355099736834642999312E-01;
2340  w[ 5] = 0.838100413989858294154207349001E-01;
2341  w[ 6] = 0.280647458528533675369463335380E+00;
2342  w[ 7] = 0.507929479016613741913517341791E+00;
2343  w[ 8] = 0.507929479016613741913517341791E+00;
2344  w[ 9] = 0.280647458528533675369463335380E+00;
2345  w[10] = 0.838100413989858294154207349001E-01;
2346  w[11] = 0.128803115355099736834642999312E-01;
2347  w[12] = 0.932284008624180529914277305537E-03;
2348  w[13] = 0.271186009253788151201891432244E-04;
2349  w[14] = 0.232098084486521065338749423185E-06;
2350  w[15] = 0.265480747401118224470926366050E-09;
2351  }
2352  else if (n==17) {
2353  w[ 0] = 0.458057893079863330580889281222E-10;
2354  w[ 1] = 0.497707898163079405227863353715E-07;
2355  w[ 2] = 0.711228914002130958353327376218E-05;
2356  w[ 3] = 0.298643286697753041151336643059E-03;
2357  w[ 4] = 0.506734995762753791170069495879E-02;
2358  w[ 5] = 0.409200341495762798094994877854E-01;
2359  w[ 6] = 0.172648297670097079217645196219E+00;
2360  w[ 7] = 0.401826469470411956577635085257E+00;
2361  w[ 8] = 0.530917937624863560331883103379E+00;
2362  w[ 9] = 0.401826469470411956577635085257E+00;
2363  w[10] = 0.172648297670097079217645196219E+00;
2364  w[11] = 0.409200341495762798094994877854E-01;
2365  w[12] = 0.506734995762753791170069495879E-02;
2366  w[13] = 0.298643286697753041151336643059E-03;
2367  w[14] = 0.711228914002130958353327376218E-05;
2368  w[15] = 0.497707898163079405227863353715E-07;
2369  w[16] = 0.458057893079863330580889281222E-10;
2370  }
2371  else if (n==18) {
2372  w[ 0] = 0.782819977211589102925147471012E-11;
2373  w[ 1] = 0.104672057957920824443559608435E-07;
2374  w[ 2] = 0.181065448109343040959702385911E-05;
2375  w[ 3] = 0.918112686792940352914675407371E-04;
2376  w[ 4] = 0.188852263026841789438175325426E-02;
2377  w[ 5] = 0.186400423875446519219315221973E-01;
2378  w[ 6] = 0.973017476413154293308537234155E-01;
2379  w[ 7] = 0.284807285669979578595606820713E+00;
2380  w[ 8] = 0.483495694725455552876410522141E+00;
2381  w[ 9] = 0.483495694725455552876410522141E+00;
2382  w[10] = 0.284807285669979578595606820713E+00;
2383  w[11] = 0.973017476413154293308537234155E-01;
2384  w[12] = 0.186400423875446519219315221973E-01;
2385  w[13] = 0.188852263026841789438175325426E-02;
2386  w[14] = 0.918112686792940352914675407371E-04;
2387  w[15] = 0.181065448109343040959702385911E-05;
2388  w[16] = 0.104672057957920824443559608435E-07;
2389  w[17] = 0.782819977211589102925147471012E-11;
2390  }
2391  else if (n==19) {
2392  w[ 0] = 0.132629709449851575185289154385E-11;
2393  w[ 1] = 0.216305100986355475019693077221E-08;
2394  w[ 2] = 0.448824314722312295179447915594E-06;
2395  w[ 3] = 0.272091977631616257711941025214E-04;
2396  w[ 4] = 0.670877521407181106194696282100E-03;
2397  w[ 5] = 0.798886677772299020922211491861E-02;
2398  w[ 6] = 0.508103869090520673569908110358E-01;
2399  w[ 7] = 0.183632701306997074156148485766E+00;
2400  w[ 8] = 0.391608988613030244504042313621E+00;
2401  w[ 9] = 0.502974888276186530840731361096E+00;
2402  w[10] = 0.391608988613030244504042313621E+00;
2403  w[11] = 0.183632701306997074156148485766E+00;
2404  w[12] = 0.508103869090520673569908110358E-01;
2405  w[13] = 0.798886677772299020922211491861E-02;
2406  w[14] = 0.670877521407181106194696282100E-03;
2407  w[15] = 0.272091977631616257711941025214E-04;
2408  w[16] = 0.448824314722312295179447915594E-06;
2409  w[17] = 0.216305100986355475019693077221E-08;
2410  w[18] = 0.132629709449851575185289154385E-11;
2411  }
2412  else if (n==20) {
2413  w[ 0] = 0.222939364553415129252250061603E-12;
2414  w[ 1] = 0.439934099227318055362885145547E-09;
2415  w[ 2] = 0.108606937076928169399952456345E-06;
2416  w[ 3] = 0.780255647853206369414599199965E-05;
2417  w[ 4] = 0.228338636016353967257145917963E-03;
2418  w[ 5] = 0.324377334223786183218324713235E-02;
2419  w[ 6] = 0.248105208874636108821649525589E-01;
2420  w[ 7] = 0.109017206020023320013755033535E+00;
2421  w[ 8] = 0.286675505362834129719659706228E+00;
2422  w[ 9] = 0.462243669600610089650328639861E+00;
2423  w[10] = 0.462243669600610089650328639861E+00;
2424  w[11] = 0.286675505362834129719659706228E+00;
2425  w[12] = 0.109017206020023320013755033535E+00;
2426  w[13] = 0.248105208874636108821649525589E-01;
2427  w[14] = 0.324377334223786183218324713235E-02;
2428  w[15] = 0.228338636016353967257145917963E-03;
2429  w[16] = 0.780255647853206369414599199965E-05;
2430  w[17] = 0.108606937076928169399952456345E-06;
2431  w[18] = 0.439934099227318055362885145547E-09;
2432  w[19] = 0.222939364553415129252250061603E-12;
2433  }
2434  else {
2435  std::cerr << "\n";
2436  std::cerr << "HERMITE_LOOKUP_WEIGHTS - Fatal error!\n";
2437  std::cerr << " Illegal value of N = " << n << "\n";
2438  std::cerr << " Legal values are 1 through 20.\n";
2439  std::exit(1);
2440  }
2441 
2442  return;
2443 }
2444 
2445 //****************************************************************************
2446 template<class Real>
2447 void ROLBurkardtRules::imtqlx ( int n, Real d[], Real e[], Real z[] )
2448 //****************************************************************************
2449 //
2450 // Purpose:
2451 //
2452 // IMTQLX diagonalizes a symmetric tridiagonal matrix.
2453 //
2454 // Discussion:
2455 //
2456 // This routine is a slightly modified version of the EISPACK routine to
2457 // perform the implicit QL algorithm on a symmetric tridiagonal matrix.
2458 //
2459 // The authors thank the authors of EISPACK for permission to use this
2460 // routine.
2461 //
2462 // It has been modified to produce the product Q' * Z, where Z is an input
2463 // vector and Q is the orthogonal matrix diagonalizing the input matrix.
2464 // The changes consist (essentially) of applying the orthogonal transformations
2465 // directly to Z as they are generated.
2466 //
2467 // Licensing:
2468 //
2469 // This code is distributed under the GNU LGPL license.
2470 //
2471 // Modified:
2472 //
2473 // 08 January 2010
2474 //
2475 // Author:
2476 //
2477 // Original FORTRAN77 version by Sylvan Elhay, Jaroslav Kautsky.
2478 // C++ version by John Burkardt.
2479 //
2480 // Reference:
2481 //
2482 // Sylvan Elhay, Jaroslav Kautsky,
2483 // Algorithm 655: IQPACK, FORTRAN Subroutines for the Weights of
2484 // Interpolatory Quadrature,
2485 // ACM Transactions on Mathematical Software,
2486 // Volume 13, Number 4, December 1987, pages 399-415.
2487 //
2488 // Roger Martin, James Wilkinson,
2489 // The Implicit QL Algorithm,
2490 // Numerische Mathematik,
2491 // Volume 12, Number 5, December 1968, pages 377-383.
2492 //
2493 // Parameters:
2494 //
2495 // Input, int N, the order of the matrix.
2496 //
2497 // Input/output, Real D(N), the diagonal entries of the matrix.
2498 // On output, the information in D has been overwritten.
2499 //
2500 // Input/output, Real E(N), the subdiagonal entries of the
2501 // matrix, in entries E(1) through E(N-1). On output, the information in
2502 // E has been overwritten.
2503 //
2504 // Input/output, Real Z(N). On input, a vector. On output,
2505 // the value of Q' * Z, where Q is the matrix that diagonalizes the
2506 // input symmetric tridiagonal matrix.
2507 //
2508 {
2509  Real b = 0, c = 0, f = 0, g = 0, p = 0, r = 0, s = 0;
2510  int i = 0, ii = 0, j = 0, k = 0, l = 0, mml = 0, m = 0, itn = 30;
2511  Real prec = ROLBurkardtRules::r8_epsilon(1.0); //2.22E-16;
2512 
2513  if (n==1) {
2514  return;
2515  }
2516 
2517  e[n-1] = 0.0;
2518 
2519  for (l=1;l<=n;l++) {
2520  j = 0;
2521  for ( ; ; ) {
2522  for (m=l;m<=n;m++) {
2523  if (m==n) {
2524  break;
2525  }
2526  if (std::abs(e[m-1])<=prec*(std::abs(d[m-1])+std::abs(d[m]))) {
2527  break;
2528  }
2529  }
2530  p = d[l-1];
2531  if (m==l) {
2532  break;
2533  }
2534  if (itn<=j) {
2535  std::cerr << "\n";
2536  std::cerr << "IMTQLX - Fatal error!\n";
2537  std::cerr << " Iteration limit exceeded\n";
2538  std::exit(1);
2539  }
2540  j = j+1;
2541  g = (d[l]-p)/(2.0*e[l-1]);
2542  r = std::sqrt(g*g+1.0);
2543  g = d[m-1]-p+e[l-1]/(g+std::abs(r)*ROLBurkardtRules::r8_sign(g));
2544  s = 1.0;
2545  c = 1.0;
2546  p = 0.0;
2547  mml = m-l;
2548 
2549  for (ii=1;ii<=mml;ii++) {
2550  i = m-ii;
2551  f = s*e[i-1];
2552  b = c*e[i-1];
2553 
2554  if (std::abs(g)<=std::abs(f)) {
2555  c = g/f;
2556  r = std::sqrt(c*c+1.0);
2557  e[i] = f*r;
2558  s = 1.0/r;
2559  c = c*s;
2560  }
2561  else {
2562  s = f/g;
2563  r = std::sqrt(s*s+1.0);
2564  e[i] = g*r;
2565  c = 1.0/r;
2566  s = s*c;
2567  }
2568  g = d[i]-p;
2569  r = (d[i-1]-g)*s+2.0*c*b;
2570  p = s*r;
2571  d[i] = g+p;
2572  g = c*r-b;
2573  f = z[i];
2574  z[i] = s*z[i-1]+c*f;
2575  z[i-1] = c*z[i-1]-s*f;
2576  }
2577  d[l-1] = d[l-1]-p;
2578  e[l-1] = g;
2579  e[m-1] = 0.0;
2580  }
2581  }
2582 //
2583 // Sorting.
2584 //
2585  for (ii=2;ii<=m;ii++) {
2586  i = ii-1;
2587  k = i;
2588  p = d[i-1];
2589 
2590  for (j=ii;j<=n;j++) {
2591  if (d[j-1]<p) {
2592  k = j;
2593  p = d[j-1];
2594  }
2595  }
2596 
2597  if (k!=i) {
2598  d[k-1] = d[i-1];
2599  d[i-1] = p;
2600  p = z[i-1];
2601  z[i-1] = z[k-1];
2602  z[k-1] = p;
2603  }
2604  }
2605  return;
2606 }
2607 
2608 //****************************************************************************
2609 template<class Real>
2610 void ROLBurkardtRules::laguerre_compute ( int n, Real x[], Real w[] )
2611 //****************************************************************************
2612 //
2613 // Purpose:
2614 //
2615 // LAGUERRE_COMPUTE: Laguerre quadrature rule by the Elhay-Kautsky method.
2616 //
2617 // Licensing:
2618 //
2619 // This code is distributed under the GNU LGPL license.
2620 //
2621 // Modified:
2622 //
2623 // 23 April 2011
2624 //
2625 // Author:
2626 //
2627 // Original FORTRAN77 version by Sylvan Elhay, Jaroslav Kautsky.
2628 // C++ version by John Burkardt.
2629 //
2630 // Reference:
2631 //
2632 // Sylvan Elhay, Jaroslav Kautsky,
2633 // Algorithm 655: IQPACK, FORTRAN Subroutines for the Weights of
2634 // Interpolatory Quadrature,
2635 // ACM Transactions on Mathematical Software,
2636 // Volume 13, Number 4, December 1987, pages 399-415.
2637 //
2638 // Parameters:
2639 //
2640 // Input, int N, the order.
2641 //
2642 // Output, Real X[N], the abscissas.
2643 //
2644 // Output, Real W[N], the weights.
2645 //
2646 {
2647  Real *bj;
2648  int i;
2649  Real zemu;
2650 //
2651 // Define the zero-th moment.
2652 //
2653  zemu = 1.0;
2654 //
2655 // Define the Jacobi matrix.
2656 //
2657  bj = new Real[n];
2658 
2659  for (i=0;i<n;i++) {
2660  bj[i] = (Real)(i+1);
2661  }
2662 
2663  for (i=0;i<n;i++) {
2664  x[i] = (Real)(2*i+1);
2665  }
2666 
2667  w[0] = std::sqrt(zemu);
2668 
2669  for (i=1;i<n;i++) {
2670  w[i] = 0.0;
2671  }
2672 //
2673 // Diagonalize the Jacobi matrix.
2674 //
2675  ROLBurkardtRules::imtqlx(n,x,bj,w);
2676 
2677  for (i=0;i<n;i++) {
2678  w[i] = w[i]*w[i];
2679  }
2680 
2681  delete [] bj;
2682 
2683  return;
2684 }
2685 
2686 //****************************************************************************
2687 template<class Real>
2688 void ROLBurkardtRules::laguerre_compute_points ( int order, Real x[] )
2689 //****************************************************************************
2690 //
2691 // Purpose:
2692 //
2693 // LAGUERRE_COMPUTE_POINTS computes Laguerre quadrature points.
2694 //
2695 // Licensing:
2696 //
2697 // This code is distributed under the GNU LGPL license.
2698 //
2699 // Modified:
2700 //
2701 // 13 June 2009
2702 //
2703 // Author:
2704 //
2705 // John Burkardt
2706 //
2707 // Parameters:
2708 //
2709 // Input, int ORDER, the order.
2710 //
2711 // Output, Real X[ORDER], the abscissas.
2712 //
2713 {
2714  Real *w; w = new Real[order];
2715  ROLBurkardtRules::laguerre_compute ( order, x, w );
2716  delete [] w;
2717 
2718  return;
2719 }
2720 
2721 //****************************************************************************
2722 template<class Real>
2724 //****************************************************************************
2725 //
2726 // Purpose:
2727 //
2728 // LAGUERRE_COMPUTE_WEIGHTS computes Laguerre quadrature weights.
2729 //
2730 // Licensing:
2731 //
2732 // This code is distributed under the GNU LGPL license.
2733 //
2734 // Modified:
2735 //
2736 // 13 June 2009
2737 //
2738 // Author:
2739 //
2740 // John Burkardt
2741 //
2742 // Parameters:
2743 //
2744 // Input, int ORDER, the order.
2745 //
2746 // Output, Real W[ORDER], the weights.
2747 //
2748 {
2749  Real *x; x = new Real[order];
2750  ROLBurkardtRules::laguerre_compute ( order, x, w );
2751  delete [] x;
2752 
2753  return;
2754 }
2755 
2756 //****************************************************************************
2757 template<class Real>
2758 void ROLBurkardtRules::laguerre_lookup ( int n, Real x[], Real w[] )
2759 //****************************************************************************
2760 //
2761 // Purpose:
2762 //
2763 // LAGUERRE_LOOKUP looks up abscissas and weights for Laguerre quadrature.
2764 //
2765 // Discussion:
2766 //
2767 // The abscissas are the zeroes of the Laguerre polynomial L(N)(X).
2768 //
2769 // The integral:
2770 //
2771 // Integral ( 0 <= X < +oo ) exp ( -X ) * F(X) dX
2772 //
2773 // The quadrature rule:
2774 //
2775 // Sum ( 1 <= I <= N ) W(I) * f ( X(I) )
2776 //
2777 // The integral:
2778 //
2779 // Integral ( 0 <= X < +oo ) F(X) dX
2780 //
2781 // The quadrature rule:
2782 //
2783 // Sum ( 1 <= I <= N ) W(I) * exp ( X(I) ) * f ( X(I) )
2784 //
2785 // Mathematica can numerically estimate the abscissas for the
2786 // n-th order polynomial to p digits of precision by the command:
2787 //
2788 // NSolve [ LaguerreL[n,x] == 0, x, p ]
2789 //
2790 // Licensing:
2791 //
2792 // This code is distributed under the GNU LGPL license.
2793 //
2794 // Modified:
2795 //
2796 // 27 April 2010
2797 //
2798 // Author:
2799 //
2800 // John Burkardt
2801 //
2802 // Reference:
2803 //
2804 // Milton Abramowitz, Irene Stegun,
2805 // Handbook of Mathematical Functions,
2806 // National Bureau of Standards, 1964,
2807 // ISBN: 0-486-61272-4,
2808 // LC: QA47.A34.
2809 //
2810 // Vladimir Krylov,
2811 // Approximate Calculation of Integrals,
2812 // Dover, 2006,
2813 // ISBN: 0486445798,
2814 // LC: QA311.K713.
2815 //
2816 // Arthur Stroud, Don Secrest,
2817 // Gaussian Quadrature Formulas,
2818 // Prentice Hall, 1966,
2819 // LC: QA299.4G3S7.
2820 //
2821 // Stephen Wolfram,
2822 // The Mathematica Book,
2823 // Fourth Edition,
2824 // Cambridge University Press, 1999,
2825 // ISBN: 0-521-64314-7,
2826 // LC: QA76.95.W65.
2827 //
2828 // Daniel Zwillinger, editor,
2829 // CRC Standard Mathematical Tables and Formulae,
2830 // 30th Edition,
2831 // CRC Press, 1996,
2832 // ISBN: 0-8493-2479-3.
2833 //
2834 // Parameters:
2835 //
2836 // Input, int N, the order.
2837 // N must be between 1 and 20.
2838 //
2839 // Output, Real X[N], the abscissas.
2840 //
2841 // Output, Real W[N], the weights.
2842 //
2843 {
2846 
2847  return;
2848 }
2849 
2850 //****************************************************************************
2851 template<class Real>
2853 //****************************************************************************
2854 //
2855 // Purpose:
2856 //
2857 // LAGUERRE_LOOKUP_POINTS looks up abscissas for Laguerre quadrature.
2858 //
2859 // Licensing:
2860 //
2861 // This code is distributed under the GNU LGPL license.
2862 //
2863 // Modified:
2864 //
2865 // 27 April 2010
2866 //
2867 // Author:
2868 //
2869 // John Burkardt
2870 //
2871 // Reference:
2872 //
2873 // Milton Abramowitz, Irene Stegun,
2874 // Handbook of Mathematical Functions,
2875 // National Bureau of Standards, 1964,
2876 // ISBN: 0-486-61272-4,
2877 // LC: QA47.A34.
2878 //
2879 // Vladimir Krylov,
2880 // Approximate Calculation of Integrals,
2881 // Dover, 2006,
2882 // ISBN: 0486445798,
2883 // LC: QA311.K713.
2884 //
2885 // Arthur Stroud, Don Secrest,
2886 // Gaussian Quadrature Formulas,
2887 // Prentice Hall, 1966,
2888 // LC: QA299.4G3S7.
2889 //
2890 // Stephen Wolfram,
2891 // The Mathematica Book,
2892 // Fourth Edition,
2893 // Cambridge University Press, 1999,
2894 // ISBN: 0-521-64314-7,
2895 // LC: QA76.95.W65.
2896 //
2897 // Daniel Zwillinger, editor,
2898 // CRC Standard Mathematical Tables and Formulae,
2899 // 30th Edition,
2900 // CRC Press, 1996,
2901 // ISBN: 0-8493-2479-3.
2902 //
2903 // Parameters:
2904 //
2905 // Input, int N, the order.
2906 // N must be between 1 and 20.
2907 //
2908 // Output, Real X[N], the abscissas.
2909 //
2910 {
2911  if (n==1) {
2912  x[ 0] = 1.00000000000000000000000000000E+00;
2913  }
2914  else if (n==2) {
2915  x[ 0] = 0.585786437626904951198311275790E+00;
2916  x[ 1] = 3.41421356237309504880168872421E+00;
2917  }
2918  else if (n==3) {
2919  x[ 0] = 0.415774556783479083311533873128E+00;
2920  x[ 1] = 2.29428036027904171982205036136E+00;
2921  x[ 2] = 6.28994508293747919686641576551E+00;
2922  }
2923  else if (n==4) {
2924  x[ 0] = 0.322547689619392311800361459104E+00;
2925  x[ 1] = 1.74576110115834657568681671252E+00;
2926  x[ 2] = 4.53662029692112798327928538496E+00;
2927  x[ 3] = 9.39507091230113312923353644342E+00;
2928  }
2929  else if (n==5) {
2930  x[ 0] = 0.263560319718140910203061943361E+00;
2931  x[ 1] = 1.41340305910651679221840798019E+00;
2932  x[ 2] = 3.59642577104072208122318658878E+00;
2933  x[ 3] = 7.08581000585883755692212418111E+00;
2934  x[ 4] = 12.6408008442757826594332193066E+00;
2935  }
2936  else if (n==6) {
2937  x[ 0] = 0.222846604179260689464354826787E+00;
2938  x[ 1] = 1.18893210167262303074315092194E+00;
2939  x[ 2] = 2.99273632605931407769132528451E+00;
2940  x[ 3] = 5.77514356910451050183983036943E+00;
2941  x[ 4] = 9.83746741838258991771554702994E+00;
2942  x[ 5] = 15.9828739806017017825457915674E+00;
2943  }
2944  else if (n==7) {
2945  x[ 0] = 0.193043676560362413838247885004E+00;
2946  x[ 1] = 1.02666489533919195034519944317E+00;
2947  x[ 2] = 2.56787674495074620690778622666E+00;
2948  x[ 3] = 4.90035308452648456810171437810E+00;
2949  x[ 4] = 8.18215344456286079108182755123E+00;
2950  x[ 5] = 12.7341802917978137580126424582E+00;
2951  x[ 6] = 19.3957278622625403117125820576E+00;
2952  }
2953  else if (n==8) {
2954  x[ 0] = 0.170279632305100999788861856608E+00;
2955  x[ 1] = 0.903701776799379912186020223555E+00;
2956  x[ 2] = 2.25108662986613068930711836697E+00;
2957  x[ 3] = 4.26670017028765879364942182690E+00;
2958  x[ 4] = 7.04590540239346569727932548212E+00;
2959  x[ 5] = 10.7585160101809952240599567880E+00;
2960  x[ 6] = 15.7406786412780045780287611584E+00;
2961  x[ 7] = 22.8631317368892641057005342974E+00;
2962  }
2963  else if (n==9) {
2964  x[ 0] = 0.152322227731808247428107073127E+00;
2965  x[ 1] = 0.807220022742255847741419210952E+00;
2966  x[ 2] = 2.00513515561934712298303324701E+00;
2967  x[ 3] = 3.78347397333123299167540609364E+00;
2968  x[ 4] = 6.20495677787661260697353521006E+00;
2969  x[ 5] = 9.37298525168757620180971073215E+00;
2970  x[ 6] = 13.4662369110920935710978818397E+00;
2971  x[ 7] = 18.8335977889916966141498992996E+00;
2972  x[ 8] = 26.3740718909273767961410072937E+00;
2973  }
2974  else if (n==10) {
2975  x[ 0] = 0.137793470540492430830772505653E+00;
2976  x[ 1] = 0.729454549503170498160373121676E+00;
2977  x[ 2] = 1.80834290174031604823292007575E+00;
2978  x[ 3] = 3.40143369785489951448253222141E+00;
2979  x[ 4] = 5.55249614006380363241755848687E+00;
2980  x[ 5] = 8.33015274676449670023876719727E+00;
2981  x[ 6] = 11.8437858379000655649185389191E+00;
2982  x[ 7] = 16.2792578313781020995326539358E+00;
2983  x[ 8] = 21.9965858119807619512770901956E+00;
2984  x[ 9] = 29.9206970122738915599087933408E+00;
2985  }
2986  else if (n==11) {
2987  x[ 0] = 0.125796442187967522675794577516E+00;
2988  x[ 1] = 0.665418255839227841678127839420E+00;
2989  x[ 2] = 1.64715054587216930958700321365E+00;
2990  x[ 3] = 3.09113814303525495330195934259E+00;
2991  x[ 4] = 5.02928440157983321236999508366E+00;
2992  x[ 5] = 7.50988786380661681941099714450E+00;
2993  x[ 6] = 10.6059509995469677805559216457E+00;
2994  x[ 7] = 14.4316137580641855353200450349E+00;
2995  x[ 8] = 19.1788574032146786478174853989E+00;
2996  x[ 9] = 25.2177093396775611040909447797E+00;
2997  x[10] = 33.4971928471755372731917259395E+00;
2998  }
2999  else if (n==12) {
3000  x[ 0] = 0.115722117358020675267196428240E+00;
3001  x[ 1] = 0.611757484515130665391630053042E+00;
3002  x[ 2] = 1.51261026977641878678173792687E+00;
3003  x[ 3] = 2.83375133774350722862747177657E+00;
3004  x[ 4] = 4.59922763941834848460572922485E+00;
3005  x[ 5] = 6.84452545311517734775433041849E+00;
3006  x[ 6] = 9.62131684245686704391238234923E+00;
3007  x[ 7] = 13.0060549933063477203460524294E+00;
3008  x[ 8] = 17.1168551874622557281840528008E+00;
3009  x[ 9] = 22.1510903793970056699218950837E+00;
3010  x[10] = 28.4879672509840003125686072325E+00;
3011  x[11] = 37.0991210444669203366389142764E+00;
3012  }
3013  else if (n==13) {
3014  x[ 0] = 0.107142388472252310648493376977E+00;
3015  x[ 1] = 0.566131899040401853406036347177E+00;
3016  x[ 2] = 1.39856433645101971792750259921E+00;
3017  x[ 3] = 2.61659710840641129808364008472E+00;
3018  x[ 4] = 4.23884592901703327937303389926E+00;
3019  x[ 5] = 6.29225627114007378039376523025E+00;
3020  x[ 6] = 8.81500194118697804733348868036E+00;
3021  x[ 7] = 11.8614035888112425762212021880E+00;
3022  x[ 8] = 15.5107620377037527818478532958E+00;
3023  x[ 9] = 19.8846356638802283332036594634E+00;
3024  x[10] = 25.1852638646777580842970297823E+00;
3025  x[11] = 31.8003863019472683713663283526E+00;
3026  x[12] = 40.7230086692655795658979667001E+00;
3027  }
3028  else if (n==14) {
3029  x[ 0] = 0.0997475070325975745736829452514E+00;
3030  x[ 1] = 0.526857648851902896404583451502E+00;
3031  x[ 2] = 1.30062912125149648170842022116E+00;
3032  x[ 3] = 2.43080107873084463616999751038E+00;
3033  x[ 4] = 3.93210282229321888213134366778E+00;
3034  x[ 5] = 5.82553621830170841933899983898E+00;
3035  x[ 6] = 8.14024014156514503005978046052E+00;
3036  x[ 7] = 10.9164995073660188408130510904E+00;
3037  x[ 8] = 14.2108050111612886831059780825E+00;
3038  x[ 9] = 18.1048922202180984125546272083E+00;
3039  x[10] = 22.7233816282696248232280886985E+00;
3040  x[11] = 28.2729817232482056954158923218E+00;
3041  x[12] = 35.1494436605924265828643121364E+00;
3042  x[13] = 44.3660817111174230416312423666E+00;
3043  }
3044  else if (n==15) {
3045  x[ 0] = 0.0933078120172818047629030383672E+00;
3046  x[ 1] = 0.492691740301883908960101791412E+00;
3047  x[ 2] = 1.21559541207094946372992716488E+00;
3048  x[ 3] = 2.26994952620374320247421741375E+00;
3049  x[ 4] = 3.66762272175143727724905959436E+00;
3050  x[ 5] = 5.42533662741355316534358132596E+00;
3051  x[ 6] = 7.56591622661306786049739555812E+00;
3052  x[ 7] = 10.1202285680191127347927394568E+00;
3053  x[ 8] = 13.1302824821757235640991204176E+00;
3054  x[ 9] = 16.6544077083299578225202408430E+00;
3055  x[10] = 20.7764788994487667729157175676E+00;
3056  x[11] = 25.6238942267287801445868285977E+00;
3057  x[12] = 31.4075191697539385152432196202E+00;
3058  x[13] = 38.5306833064860094162515167595E+00;
3059  x[14] = 48.0260855726857943465734308508E+00;
3060  }
3061  else if (n==16) {
3062  x[ 0] = 0.0876494104789278403601980973401E+00;
3063  x[ 1] = 0.462696328915080831880838260664E+00;
3064  x[ 2] = 1.14105777483122685687794501811E+00;
3065  x[ 3] = 2.12928364509838061632615907066E+00;
3066  x[ 4] = 3.43708663389320664523510701675E+00;
3067  x[ 5] = 5.07801861454976791292305830814E+00;
3068  x[ 6] = 7.07033853504823413039598947080E+00;
3069  x[ 7] = 9.43831433639193878394724672911E+00;
3070  x[ 8] = 12.2142233688661587369391246088E+00;
3071  x[ 9] = 15.4415273687816170767647741622E+00;
3072  x[10] = 19.1801568567531348546631409497E+00;
3073  x[11] = 23.5159056939919085318231872752E+00;
3074  x[12] = 28.5787297428821403675206137099E+00;
3075  x[13] = 34.5833987022866258145276871778E+00;
3076  x[14] = 41.9404526476883326354722330252E+00;
3077  x[15] = 51.7011603395433183643426971197E+00;
3078  }
3079  else if (n==17) {
3080  x[ 0] = 0.0826382147089476690543986151980E+00;
3081  x[ 1] = 0.436150323558710436375959029847E+00;
3082  x[ 2] = 1.07517657751142857732980316755E+00;
3083  x[ 3] = 2.00519353164923224070293371933E+00;
3084  x[ 4] = 3.23425612404744376157380120696E+00;
3085  x[ 5] = 4.77351351370019726480932076262E+00;
3086  x[ 6] = 6.63782920536495266541643929703E+00;
3087  x[ 7] = 8.84668551116980005369470571184E+00;
3088  x[ 8] = 11.4255293193733525869726151469E+00;
3089  x[ 9] = 14.4078230374813180021982874959E+00;
3090  x[10] = 17.8382847307011409290658752412E+00;
3091  x[11] = 21.7782682577222653261749080522E+00;
3092  x[12] = 26.3153178112487997766149598369E+00;
3093  x[13] = 31.5817716804567331343908517497E+00;
3094  x[14] = 37.7960938374771007286092846663E+00;
3095  x[15] = 45.3757165339889661829258363215E+00;
3096  x[16] = 55.3897517898396106640900199790E+00;
3097  }
3098  else if (n==18) {
3099  x[ 0] = 0.0781691666697054712986747615334E+00;
3100  x[ 1] = 0.412490085259129291039101536536E+00;
3101  x[ 2] = 1.01652017962353968919093686187E+00;
3102  x[ 3] = 1.89488850996976091426727831954E+00;
3103  x[ 4] = 3.05435311320265975115241130719E+00;
3104  x[ 5] = 4.50420553888989282633795571455E+00;
3105  x[ 6] = 6.25672507394911145274209116326E+00;
3106  x[ 7] = 8.32782515660563002170470261564E+00;
3107  x[ 8] = 10.7379900477576093352179033397E+00;
3108  x[ 9] = 13.5136562075550898190863812108E+00;
3109  x[10] = 16.6893062819301059378183984163E+00;
3110  x[11] = 20.3107676262677428561313764553E+00;
3111  x[12] = 24.4406813592837027656442257980E+00;
3112  x[13] = 29.1682086625796161312980677805E+00;
3113  x[14] = 34.6279270656601721454012429438E+00;
3114  x[15] = 41.0418167728087581392948614284E+00;
3115  x[16] = 48.8339227160865227486586093290E+00;
3116  x[17] = 59.0905464359012507037157810181E+00;
3117  }
3118  else if (n==19) {
3119  x[ 0] = 0.0741587837572050877131369916024E+00;
3120  x[ 1] = 0.391268613319994607337648350299E+00;
3121  x[ 2] = 0.963957343997958058624878377130E+00;
3122  x[ 3] = 1.79617558206832812557725825252E+00;
3123  x[ 4] = 2.89365138187378399116494713237E+00;
3124  x[ 5] = 4.26421553962776647436040018167E+00;
3125  x[ 6] = 5.91814156164404855815360191408E+00;
3126  x[ 7] = 7.86861891533473373105668358176E+00;
3127  x[ 8] = 10.1324237168152659251627415800E+00;
3128  x[ 9] = 12.7308814638423980045092979656E+00;
3129  x[10] = 15.6912783398358885454136069861E+00;
3130  x[11] = 19.0489932098235501532136429732E+00;
3131  x[12] = 22.8508497608294829323930586693E+00;
3132  x[13] = 27.1606693274114488789963947149E+00;
3133  x[14] = 32.0691222518622423224362865906E+00;
3134  x[15] = 37.7129058012196494770647508283E+00;
3135  x[16] = 44.3173627958314961196067736013E+00;
3136  x[17] = 52.3129024574043831658644222420E+00;
3137  x[18] = 62.8024231535003758413504690673E+00;
3138  }
3139  else if (n==20) {
3140  x[ 0] = 0.0705398896919887533666890045842E+00;
3141  x[ 1] = 0.372126818001611443794241388761E+00;
3142  x[ 2] = 0.916582102483273564667716277074E+00;
3143  x[ 3] = 1.70730653102834388068768966741E+00;
3144  x[ 4] = 2.74919925530943212964503046049E+00;
3145  x[ 5] = 4.04892531385088692237495336913E+00;
3146  x[ 6] = 5.61517497086161651410453988565E+00;
3147  x[ 7] = 7.45901745367106330976886021837E+00;
3148  x[ 8] = 9.59439286958109677247367273428E+00;
3149  x[ 9] = 12.0388025469643163096234092989E+00;
3150  x[10] = 14.8142934426307399785126797100E+00;
3151  x[11] = 17.9488955205193760173657909926E+00;
3152  x[12] = 21.4787882402850109757351703696E+00;
3153  x[13] = 25.4517027931869055035186774846E+00;
3154  x[14] = 29.9325546317006120067136561352E+00;
3155  x[15] = 35.0134342404790000062849359067E+00;
3156  x[16] = 40.8330570567285710620295677078E+00;
3157  x[17] = 47.6199940473465021399416271529E+00;
3158  x[18] = 55.8107957500638988907507734445E+00;
3159  x[19] = 66.5244165256157538186403187915E+00;
3160  }
3161  else {
3162  std::cerr << "\n";
3163  std::cerr << "LAGUERRE_LOOKUP_POINTS - Fatal error!\n";
3164  std::cerr << " Illegal value of N = " << n << "\n";
3165  std::cerr << " Legal values are 1 through 20.\n";
3166  std::exit(1);
3167  }
3168 
3169  return;
3170 }
3171 
3172 //****************************************************************************
3173 template<class Real>
3175 //****************************************************************************
3176 //
3177 // Purpose:
3178 //
3179 // LAGUERRE_LOOKUP_WEIGHTS looks up weights for Laguerre quadrature.
3180 //
3181 // Licensing:
3182 //
3183 // This code is distributed under the GNU LGPL license.
3184 //
3185 // Modified:
3186 //
3187 // 27 April 2010
3188 //
3189 // Author:
3190 //
3191 // John Burkardt
3192 //
3193 // Reference:
3194 //
3195 // Milton Abramowitz, Irene Stegun,
3196 // Handbook of Mathematical Functions,
3197 // National Bureau of Standards, 1964,
3198 // ISBN: 0-486-61272-4,
3199 // LC: QA47.A34.
3200 //
3201 // Vladimir Krylov,
3202 // Approximate Calculation of Integrals,
3203 // Dover, 2006,
3204 // ISBN: 0486445798,
3205 // LC: QA311.K713.
3206 //
3207 // Arthur Stroud, Don Secrest,
3208 // Gaussian Quadrature Formulas,
3209 // Prentice Hall, 1966,
3210 // LC: QA299.4G3S7.
3211 //
3212 // Stephen Wolfram,
3213 // The Mathematica Book,
3214 // Fourth Edition,
3215 // Cambridge University Press, 1999,
3216 // ISBN: 0-521-64314-7,
3217 // LC: QA76.95.W65.
3218 //
3219 // Daniel Zwillinger, editor,
3220 // CRC Standard Mathematical Tables and Formulae,
3221 // 30th Edition,
3222 // CRC Press, 1996,
3223 // ISBN: 0-8493-2479-3.
3224 //
3225 // Parameters:
3226 //
3227 // Input, int N, the order.
3228 // N must be between 1 and 20.
3229 //
3230 // Output, Real W[N], the weights.
3231 //
3232 {
3233  if (n==1) {
3234  w[ 0] = 1.00000000000000000000000000000E+00;
3235  }
3236  else if (n==2) {
3237  w[ 0] = 0.85355339059327376220042218105E+00;
3238  w[ 1] = 0.146446609406726237799577818948E+00;
3239  }
3240  else if (n==3) {
3241  w[ 0] = 0.71109300992917301544959019114E+00;
3242  w[ 1] = 0.27851773356924084880144488846E+00;
3243  w[ 2] = 0.010389256501586135748964920401E+00;
3244  }
3245  else if (n==4) {
3246  w[ 0] = 0.60315410434163360163596602382E+00;
3247  w[ 1] = 0.35741869243779968664149201746E+00;
3248  w[ 2] = 0.03888790851500538427243816816E+00;
3249  w[ 3] = 0.0005392947055613274501037905676E+00;
3250  }
3251  else if (n==5) {
3252  w[ 0] = 0.52175561058280865247586092879E+00;
3253  w[ 1] = 0.3986668110831759274541333481E+00;
3254  w[ 2] = 0.0759424496817075953876533114E+00;
3255  w[ 3] = 0.00361175867992204845446126257E+00;
3256  w[ 4] = 0.00002336997238577622789114908455E+00;
3257  }
3258  else if (n==6) {
3259  w[ 0] = 0.45896467394996359356828487771E+00;
3260  w[ 1] = 0.4170008307721209941133775662E+00;
3261  w[ 2] = 0.1133733820740449757387061851E+00;
3262  w[ 3] = 0.01039919745314907489891330285E+00;
3263  w[ 4] = 0.000261017202814932059479242860E+00;
3264  w[ 5] = 8.98547906429621238825292053E-07;
3265  }
3266  else if (n==7) {
3267  w[ 0] = 0.40931895170127390213043288002E+00;
3268  w[ 1] = 0.4218312778617197799292810054E+00;
3269  w[ 2] = 0.1471263486575052783953741846E+00;
3270  w[ 3] = 0.0206335144687169398657056150E+00;
3271  w[ 4] = 0.00107401014328074552213195963E+00;
3272  w[ 5] = 0.0000158654643485642012687326223E+00;
3273  w[ 6] = 3.17031547899558056227132215E-08;
3274  }
3275  else if (n==8) {
3276  w[ 0] = 0.36918858934163752992058283938E+00;
3277  w[ 1] = 0.4187867808143429560769785813E+00;
3278  w[ 2] = 0.175794986637171805699659867E+00;
3279  w[ 3] = 0.033343492261215651522132535E+00;
3280  w[ 4] = 0.0027945362352256725249389241E+00;
3281  w[ 5] = 0.00009076508773358213104238501E+00;
3282  w[ 6] = 8.4857467162725315448680183E-07;
3283  w[ 7] = 1.04800117487151038161508854E-09;
3284  }
3285  else if (n==9) {
3286  w[ 0] = 0.336126421797962519673467717606E+00;
3287  w[ 1] = 0.411213980423984387309146942793E+00;
3288  w[ 2] = 0.199287525370885580860575607212E+00;
3289  w[ 3] = 0.0474605627656515992621163600479E+00;
3290  w[ 4] = 0.00559962661079458317700419900556E+00;
3291  w[ 5] = 0.000305249767093210566305412824291E+00;
3292  w[ 6] = 6.59212302607535239225572284875E-06;
3293  w[ 7] = 4.1107693303495484429024104033E-08;
3294  w[ 8] = 3.29087403035070757646681380323E-11;
3295  }
3296  else if (n==10) {
3297  w[ 0] = 0.30844111576502014154747083468E+00;
3298  w[ 1] = 0.4011199291552735515157803099E+00;
3299  w[ 2] = 0.218068287611809421588648523E+00;
3300  w[ 3] = 0.062087456098677747392902129E+00;
3301  w[ 4] = 0.009501516975181100553839072E+00;
3302  w[ 5] = 0.0007530083885875387754559644E+00;
3303  w[ 6] = 0.00002825923349599565567422564E+00;
3304  w[ 7] = 4.249313984962686372586577E-07;
3305  w[ 8] = 1.839564823979630780921535E-09;
3306  w[ 9] = 9.911827219609008558377547E-13;
3307  }
3308  else if (n==11) {
3309  w[ 0] = 0.28493321289420060505605102472E+00;
3310  w[ 1] = 0.3897208895278493779375535080E+00;
3311  w[ 2] = 0.232781831848991333940223796E+00;
3312  w[ 3] = 0.076564453546196686400854179E+00;
3313  w[ 4] = 0.014393282767350695091863919E+00;
3314  w[ 5] = 0.001518880846484873069847776E+00;
3315  w[ 6] = 0.0000851312243547192259720424E+00;
3316  w[ 7] = 2.29240387957450407857683E-06;
3317  w[ 8] = 2.48635370276779587373391E-08;
3318  w[ 9] = 7.71262693369132047028153E-11;
3319  w[10] = 2.883775868323623861597778E-14;
3320  }
3321  else if (n==12) {
3322  w[ 0] = 0.26473137105544319034973889206E+00;
3323  w[ 1] = 0.3777592758731379820244905567E+00;
3324  w[ 2] = 0.244082011319877564254870818E+00;
3325  w[ 3] = 0.09044922221168093072750549E+00;
3326  w[ 4] = 0.02010238115463409652266129E+00;
3327  w[ 5] = 0.002663973541865315881054158E+00;
3328  w[ 6] = 0.000203231592662999392121433E+00;
3329  w[ 7] = 8.3650558568197987453363E-06;
3330  w[ 8] = 1.66849387654091026116990E-07;
3331  w[ 9] = 1.34239103051500414552392E-09;
3332  w[10] = 3.06160163503502078142408E-12;
3333  w[11] = 8.148077467426241682473119E-16;
3334  }
3335  else if (n==13) {
3336  w[ 0] = 0.24718870842996262134624918596E+00;
3337  w[ 1] = 0.3656888229005219453067175309E+00;
3338  w[ 2] = 0.252562420057658502356824289E+00;
3339  w[ 3] = 0.10347075802418370511421863E+00;
3340  w[ 4] = 0.02643275441556161577815877E+00;
3341  w[ 5] = 0.00422039604025475276555209E+00;
3342  w[ 6] = 0.000411881770472734774892473E+00;
3343  w[ 7] = 0.0000235154739815532386882897E+00;
3344  w[ 8] = 7.3173116202490991040105E-07;
3345  w[ 9] = 1.10884162570398067979151E-08;
3346  w[10] = 6.7708266922058988406462E-11;
3347  w[11] = 1.15997995990507606094507E-13;
3348  w[12] = 2.245093203892758415991872E-17;
3349  }
3350  else if (n==14) {
3351  w[ 0] = 0.23181557714486497784077486110E+00;
3352  w[ 1] = 0.3537846915975431518023313013E+00;
3353  w[ 2] = 0.258734610245428085987320561E+00;
3354  w[ 3] = 0.11548289355692321008730499E+00;
3355  w[ 4] = 0.03319209215933736003874996E+00;
3356  w[ 5] = 0.00619286943700661021678786E+00;
3357  w[ 6] = 0.00073989037786738594242589E+00;
3358  w[ 7] = 0.000054907194668416983785733E+00;
3359  w[ 8] = 2.4095857640853774967578E-06;
3360  w[ 9] = 5.801543981676495180886E-08;
3361  w[10] = 6.819314692484974119616E-10;
3362  w[11] = 3.2212077518948479398089E-12;
3363  w[12] = 4.2213524405165873515980E-15;
3364  w[13] = 6.05237502228918880839871E-19;
3365  }
3366  else if (n==15) {
3367  w[ 0] = 0.21823488594008688985641323645E+00;
3368  w[ 1] = 0.3422101779228833296389489568E+00;
3369  w[ 2] = 0.263027577941680097414812275E+00;
3370  w[ 3] = 0.12642581810593053584303055E+00;
3371  w[ 4] = 0.04020686492100091484158548E+00;
3372  w[ 5] = 0.00856387780361183836391576E+00;
3373  w[ 6] = 0.00121243614721425207621921E+00;
3374  w[ 7] = 0.00011167439234425194199258E+00;
3375  w[ 8] = 6.459926762022900924653E-06;
3376  w[ 9] = 2.226316907096272630332E-07;
3377  w[10] = 4.227430384979365007351E-09;
3378  w[11] = 3.921897267041089290385E-11;
3379  w[12] = 1.4565152640731264063327E-13;
3380  w[13] = 1.4830270511133013354616E-16;
3381  w[14] = 1.60059490621113323104998E-20;
3382  }
3383  else if (n==16) {
3384  w[ 0] = 0.20615171495780099433427363674E+00;
3385  w[ 1] = 0.3310578549508841659929830987E+00;
3386  w[ 2] = 0.265795777644214152599502021E+00;
3387  w[ 3] = 0.13629693429637753997554751E+00;
3388  w[ 4] = 0.0473289286941252189780623E+00;
3389  w[ 5] = 0.0112999000803394532312490E+00;
3390  w[ 6] = 0.0018490709435263108642918E+00;
3391  w[ 7] = 0.00020427191530827846012602E+00;
3392  w[ 8] = 0.00001484458687398129877135E+00;
3393  w[ 9] = 6.828319330871199564396E-07;
3394  w[10] = 1.881024841079673213882E-08;
3395  w[11] = 2.862350242973881619631E-10;
3396  w[12] = 2.127079033224102967390E-12;
3397  w[13] = 6.297967002517867787174E-15;
3398  w[14] = 5.050473700035512820402E-18;
3399  w[15] = 4.1614623703728551904265E-22;
3400  }
3401  else if (n==17) {
3402  w[ 0] = 0.19533220525177083214592729770E+00;
3403  w[ 1] = 0.3203753572745402813366256320E+00;
3404  w[ 2] = 0.267329726357171097238809604E+00;
3405  w[ 3] = 0.14512985435875862540742645E+00;
3406  w[ 4] = 0.0544369432453384577793806E+00;
3407  w[ 5] = 0.0143572977660618672917767E+00;
3408  w[ 6] = 0.0026628247355727725684324E+00;
3409  w[ 7] = 0.0003436797271562999206118E+00;
3410  w[ 8] = 0.00003027551783782870109437E+00;
3411  w[ 9] = 1.768515053231676895381E-06;
3412  w[10] = 6.57627288681043332199E-08;
3413  w[11] = 1.469730932159546790344E-09;
3414  w[12] = 1.81691036255544979555E-11;
3415  w[13] = 1.095401388928687402976E-13;
3416  w[14] = 2.617373882223370421551E-16;
3417  w[15] = 1.6729356931461546908502E-19;
3418  w[16] = 1.06562631627404278815253E-23;
3419  }
3420  else if (n==18) {
3421  w[ 0] = 0.18558860314691880562333775228E+00;
3422  w[ 1] = 0.3101817663702252936495975957E+00;
3423  w[ 2] = 0.267866567148536354820854395E+00;
3424  w[ 3] = 0.15297974746807490655384308E+00;
3425  w[ 4] = 0.0614349178609616527076780E+00;
3426  w[ 5] = 0.0176872130807729312772600E+00;
3427  w[ 6] = 0.0036601797677599177980266E+00;
3428  w[ 7] = 0.0005406227870077353231284E+00;
3429  w[ 8] = 0.0000561696505121423113818E+00;
3430  w[ 9] = 4.01530788370115755859E-06;
3431  w[10] = 1.91466985667567497969E-07;
3432  w[11] = 5.8360952686315941292E-09;
3433  w[12] = 1.07171126695539012773E-10;
3434  w[13] = 1.08909871388883385562E-12;
3435  w[14] = 5.38666474837830887608E-15;
3436  w[15] = 1.049865978035703408779E-17;
3437  w[16] = 5.405398451631053643566E-21;
3438  w[17] = 2.6916532692010286270838E-25;
3439  }
3440  else if (n==19) {
3441  w[ 0] = 0.17676847491591250225103547981E+00;
3442  w[ 1] = 0.3004781436072543794821568077E+00;
3443  w[ 2] = 0.267599547038175030772695441E+00;
3444  w[ 3] = 0.15991337213558021678551215E+00;
3445  w[ 4] = 0.0682493799761491134552355E+00;
3446  w[ 5] = 0.0212393076065443249244062E+00;
3447  w[ 6] = 0.0048416273511483959672501E+00;
3448  w[ 7] = 0.0008049127473813667665946E+00;
3449  w[ 8] = 0.0000965247209315350170843E+00;
3450  w[ 9] = 8.20730525805103054409E-06;
3451  w[10] = 4.8305667247307725394E-07;
3452  w[11] = 1.90499136112328569994E-08;
3453  w[12] = 4.8166846309280615577E-10;
3454  w[13] = 7.3482588395511443768E-12;
3455  w[14] = 6.2022753875726163989E-14;
3456  w[15] = 2.54143084301542272372E-16;
3457  w[16] = 4.07886129682571235007E-19;
3458  w[17] = 1.707750187593837061004E-22;
3459  w[18] = 6.715064649908189959990E-27;
3460  }
3461  else if (n==20) {
3462  w[ 0] = 0.168746801851113862149223899689E+00;
3463  w[ 1] = 0.291254362006068281716795323812E+00;
3464  w[ 2] = 0.266686102867001288549520868998E+00;
3465  w[ 3] = 0.166002453269506840031469127816E+00;
3466  w[ 4] = 0.0748260646687923705400624639615E+00;
3467  w[ 5] = 0.0249644173092832210728227383234E+00;
3468  w[ 6] = 0.00620255084457223684744754785395E+00;
3469  w[ 7] = 0.00114496238647690824203955356969E+00;
3470  w[ 8] = 0.000155741773027811974779809513214E+00;
3471  w[ 9] = 0.0000154014408652249156893806714048E+00;
3472  w[10] = 1.08648636651798235147970004439E-06;
3473  w[11] = 5.33012090955671475092780244305E-08;
3474  w[12] = 1.7579811790505820035778763784E-09;
3475  w[13] = 3.72550240251232087262924585338E-11;
3476  w[14] = 4.76752925157819052449488071613E-13;
3477  w[15] = 3.37284424336243841236506064991E-15;
3478  w[16] = 1.15501433950039883096396247181E-17;
3479  w[17] = 1.53952214058234355346383319667E-20;
3480  w[18] = 5.28644272556915782880273587683E-24;
3481  w[19] = 1.65645661249902329590781908529E-28;
3482  }
3483  else {
3484  std::cerr << "\n";
3485  std::cerr << "LAGUERRE_LOOKUP_WEIGHTS - Fatal error!\n";
3486  std::cerr << " Illegal value of N = " << n << "\n";
3487  std::cerr << " Legal values are 1 through 20.\n";
3488  std::exit(1);
3489  }
3490 
3491  return;
3492 }
3493 
3494 //****************************************************************************
3495 template<class Real>
3496 void ROLBurkardtRules::legendre_compute ( int n, Real x[], Real w[] )
3497 //****************************************************************************
3498 //
3499 // Purpose:
3500 //
3501 // LEGENDRE_COMPUTE: Legendre quadrature rule by the Elhay-Kautsky method.
3502 //
3503 // Licensing:
3504 //
3505 // This code is distributed under the GNU LGPL license.
3506 //
3507 // Modified:
3508 //
3509 // 19 April 2011
3510 //
3511 // Author:
3512 //
3513 // Original FORTRAN77 version by Sylvan Elhay, Jaroslav Kautsky.
3514 // C++ version by John Burkardt.
3515 //
3516 // Reference:
3517 //
3518 // Sylvan Elhay, Jaroslav Kautsky,
3519 // Algorithm 655: IQPACK, FORTRAN Subroutines for the Weights of
3520 // Interpolatory Quadrature,
3521 // ACM Transactions on Mathematical Software,
3522 // Volume 13, Number 4, December 1987, pages 399-415.
3523 //
3524 // Parameters:
3525 //
3526 // Input, int N, the order.
3527 //
3528 // Output, Real X[N], the abscissas.
3529 //
3530 // Output, Real W[N], the weights.
3531 //
3532 {
3533  Real *bj;
3534  int i;
3535  Real zemu;
3536 //
3537 // Define the zero-th moment.
3538 //
3539  zemu = 2.0;
3540 //
3541 // Define the Jacobi matrix.
3542 //
3543  bj = new Real[n];
3544 
3545  for (i=0;i<n;i++) {
3546  bj[i] = (Real)((i+1)*(i+1))/(Real)(4*(i+1)*(i+1)-1);
3547  bj[i] = std::sqrt(bj[i]);
3548  }
3549 
3550  for (i=0;i<n;i++) {
3551  x[i] = 0.0;
3552  }
3553 
3554  w[0] = std::sqrt(zemu);
3555 
3556  for (i=1;i<n;i++) {
3557  w[i] = 0.0;
3558  }
3559 //
3560 // Diagonalize the Jacobi matrix.
3561 //
3562  ROLBurkardtRules::imtqlx(n,x,bj,w);
3563 
3564  for (i=0;i<n;i++) {
3565  w[i] = w[i]*w[i];
3566  }
3567 
3568  // Ensure that zero is actually zero.
3569  if (n%2) {
3570  int ind = (int)((Real)n/2.0);
3571  x[ind] = 0.0;
3572  }
3573 
3574  delete [] bj;
3575 
3576  return;
3577 }
3578 
3579 //****************************************************************************
3580 template<class Real>
3582 //****************************************************************************
3583 //
3584 // Purpose:
3585 //
3586 // LEGENDRE_COMPUTE_POINTS computes Legendre quadrature points.
3587 //
3588 // Licensing:
3589 //
3590 // This code is distributed under the GNU LGPL license.
3591 //
3592 // Modified:
3593 //
3594 // 13 June 2009
3595 //
3596 // Author:
3597 //
3598 // John Burkardt
3599 //
3600 // Parameters:
3601 //
3602 // Input, int N, the order.
3603 //
3604 // Output, Real X[N], the abscissas.
3605 //
3606 {
3607  Real *w; w= new Real[n];
3609  delete [] w;
3610 
3611  return;
3612 }
3613 
3614 //****************************************************************************
3615 template<class Real>
3617 //****************************************************************************
3618 //
3619 // Purpose:
3620 //
3621 // LEGENDRE_COMPUTE_WEIGHTS computes Legendre quadrature weights.
3622 //
3623 // Licensing:
3624 //
3625 // This code is distributed under the GNU LGPL license.
3626 //
3627 // Modified:
3628 //
3629 // 13 June 2009
3630 //
3631 // Author:
3632 //
3633 // John Burkardt
3634 //
3635 // Parameters:
3636 //
3637 // Input, int N, the order.
3638 //
3639 // Output, Real W[N], the weights.
3640 //
3641 {
3642  Real *x; x = new Real[n];
3644  delete [] x;
3645 
3646  return;
3647 }
3648 
3649 //****************************************************************************
3650 template<class Real>
3651 void ROLBurkardtRules::legendre_lookup ( int n, Real x[], Real w[] )
3652 //****************************************************************************
3653 //
3654 // Purpose:
3655 //
3656 // LEGENDRE_LOOKUP looks up abscissas and weights for Gauss-Legendre quadrature.
3657 //
3658 // Licensing:
3659 //
3660 // This code is distributed under the GNU LGPL license.
3661 //
3662 // Modified:
3663 //
3664 // 27 April 2010
3665 //
3666 // Author:
3667 //
3668 // John Burkardt
3669 //
3670 // Reference:
3671 //
3672 // Milton Abramowitz, Irene Stegun,
3673 // Handbook of Mathematical Functions,
3674 // National Bureau of Standards, 1964,
3675 // ISBN: 0-486-61272-4,
3676 // LC: QA47.A34.
3677 //
3678 // Vladimir Krylov,
3679 // Approximate Calculation of Integrals,
3680 // Dover, 2006,
3681 // ISBN: 0486445798.
3682 // LC: QA311.K713.
3683 //
3684 // Arthur Stroud, Don Secrest,
3685 // Gaussian Quadrature Formulas,
3686 // Prentice Hall, 1966,
3687 // LC: QA299.4G3S7.
3688 //
3689 // Stephen Wolfram,
3690 // The Mathematica Book,
3691 // Fourth Edition,
3692 // Cambridge University Press, 1999,
3693 // ISBN: 0-521-64314-7,
3694 // LC: QA76.95.W65.
3695 //
3696 // Daniel Zwillinger, editor,
3697 // CRC Standard Mathematical Tables and Formulae,
3698 // 30th Edition,
3699 // CRC Press, 1996,
3700 // ISBN: 0-8493-2479-3,
3701 // LC: QA47.M315.
3702 //
3703 // Parameters:
3704 //
3705 // Input, int N, the order.
3706 // N must be between 1 and 33.
3707 //
3708 // Output, Real X[N], the abscissas.
3709 //
3710 // Output, Real W[N], the abscissas.
3711 //
3712 {
3715 
3716  return;
3717 }
3718 
3719 //****************************************************************************
3720 template<class Real>
3722 //****************************************************************************
3723 //
3724 // Purpose:
3725 //
3726 // LEGENDRE_LOOKUP_POINTS looks up abscissas for Gauss-Legendre quadrature.
3727 //
3728 // Licensing:
3729 //
3730 // This code is distributed under the GNU LGPL license.
3731 //
3732 // Modified:
3733 //
3734 // 27 April 2010
3735 //
3736 // Author:
3737 //
3738 // John Burkardt
3739 //
3740 // Reference:
3741 //
3742 // Milton Abramowitz, Irene Stegun,
3743 // Handbook of Mathematical Functions,
3744 // National Bureau of Standards, 1964,
3745 // ISBN: 0-486-61272-4,
3746 // LC: QA47.A34.
3747 //
3748 // Vladimir Krylov,
3749 // Approximate Calculation of Integrals,
3750 // Dover, 2006,
3751 // ISBN: 0486445798.
3752 // LC: QA311.K713.
3753 //
3754 // Arthur Stroud, Don Secrest,
3755 // Gaussian Quadrature Formulas,
3756 // Prentice Hall, 1966,
3757 // LC: QA299.4G3S7.
3758 //
3759 // Stephen Wolfram,
3760 // The Mathematica Book,
3761 // Fourth Edition,
3762 // Cambridge University Press, 1999,
3763 // ISBN: 0-521-64314-7,
3764 // LC: QA76.95.W65.
3765 //
3766 // Daniel Zwillinger, editor,
3767 // CRC Standard Mathematical Tables and Formulae,
3768 // 30th Edition,
3769 // CRC Press, 1996,
3770 // ISBN: 0-8493-2479-3,
3771 // LC: QA47.M315.
3772 //
3773 // Parameters:
3774 //
3775 // Input, int N, the order.
3776 // N must be between 1 and 33.
3777 //
3778 // Output, Real X[N], the abscissas.
3779 //
3780 {
3781  if (n==1) {
3782  x[ 0] = 0.000000000000000000000000000000;
3783  }
3784  else if (n==2) {
3785  x[ 0] = -0.577350269189625764509148780502;
3786  x[ 1] = 0.577350269189625764509148780502;
3787  }
3788  else if (n==3) {
3789  x[ 0] = -0.774596669241483377035853079956;
3790  x[ 1] = 0.000000000000000000000000000000;
3791  x[ 2] = 0.774596669241483377035853079956;
3792  }
3793  else if (n==4) {
3794  x[ 0] = -0.861136311594052575223946488893;
3795  x[ 1] = -0.339981043584856264802665759103;
3796  x[ 2] = 0.339981043584856264802665759103;
3797  x[ 3] = 0.861136311594052575223946488893;
3798  }
3799  else if (n==5) {
3800  x[ 0] = -0.906179845938663992797626878299;
3801  x[ 1] = -0.538469310105683091036314420700;
3802  x[ 2] = 0.000000000000000000000000000000;
3803  x[ 3] = 0.538469310105683091036314420700;
3804  x[ 4] = 0.906179845938663992797626878299;
3805  }
3806  else if (n==6) {
3807  x[ 0] = -0.932469514203152027812301554494;
3808  x[ 1] = -0.661209386466264513661399595020;
3809  x[ 2] = -0.238619186083196908630501721681;
3810  x[ 3] = 0.238619186083196908630501721681;
3811  x[ 4] = 0.661209386466264513661399595020;
3812  x[ 5] = 0.932469514203152027812301554494;
3813  }
3814  else if (n==7) {
3815  x[ 0] = -0.949107912342758524526189684048;
3816  x[ 1] = -0.741531185599394439863864773281;
3817  x[ 2] = -0.405845151377397166906606412077;
3818  x[ 3] = 0.000000000000000000000000000000;
3819  x[ 4] = 0.405845151377397166906606412077;
3820  x[ 5] = 0.741531185599394439863864773281;
3821  x[ 6] = 0.949107912342758524526189684048;
3822  }
3823  else if (n==8) {
3824  x[ 0] = -0.960289856497536231683560868569;
3825  x[ 1] = -0.796666477413626739591553936476;
3826  x[ 2] = -0.525532409916328985817739049189;
3827  x[ 3] = -0.183434642495649804939476142360;
3828  x[ 4] = 0.183434642495649804939476142360;
3829  x[ 5] = 0.525532409916328985817739049189;
3830  x[ 6] = 0.796666477413626739591553936476;
3831  x[ 7] = 0.960289856497536231683560868569;
3832  }
3833  else if (n==9) {
3834  x[ 0] = -0.968160239507626089835576203;
3835  x[ 1] = -0.836031107326635794299429788;
3836  x[ 2] = -0.613371432700590397308702039;
3837  x[ 3] = -0.324253423403808929038538015;
3838  x[ 4] = 0.000000000000000000000000000;
3839  x[ 5] = 0.324253423403808929038538015;
3840  x[ 6] = 0.613371432700590397308702039;
3841  x[ 7] = 0.836031107326635794299429788;
3842  x[ 8] = 0.968160239507626089835576203;
3843  }
3844  else if (n==10) {
3845  x[ 0] = -0.973906528517171720077964012;
3846  x[ 1] = -0.865063366688984510732096688;
3847  x[ 2] = -0.679409568299024406234327365;
3848  x[ 3] = -0.433395394129247190799265943;
3849  x[ 4] = -0.148874338981631210884826001;
3850  x[ 5] = 0.148874338981631210884826001;
3851  x[ 6] = 0.433395394129247190799265943;
3852  x[ 7] = 0.679409568299024406234327365;
3853  x[ 8] = 0.865063366688984510732096688;
3854  x[ 9] = 0.973906528517171720077964012;
3855  }
3856  else if (n==11) {
3857  x[ 0] = -0.978228658146056992803938001;
3858  x[ 1] = -0.887062599768095299075157769;
3859  x[ 2] = -0.730152005574049324093416252;
3860  x[ 3] = -0.519096129206811815925725669;
3861  x[ 4] = -0.269543155952344972331531985;
3862  x[ 5] = 0.000000000000000000000000000;
3863  x[ 6] = 0.269543155952344972331531985;
3864  x[ 7] = 0.519096129206811815925725669;
3865  x[ 8] = 0.730152005574049324093416252;
3866  x[ 9] = 0.887062599768095299075157769;
3867  x[10] = 0.978228658146056992803938001;
3868  }
3869  else if (n==12) {
3870  x[ 0] = -0.981560634246719250690549090;
3871  x[ 1] = -0.904117256370474856678465866;
3872  x[ 2] = -0.769902674194304687036893833;
3873  x[ 3] = -0.587317954286617447296702419;
3874  x[ 4] = -0.367831498998180193752691537;
3875  x[ 5] = -0.125233408511468915472441369;
3876  x[ 6] = 0.125233408511468915472441369;
3877  x[ 7] = 0.367831498998180193752691537;
3878  x[ 8] = 0.587317954286617447296702419;
3879  x[ 9] = 0.769902674194304687036893833;
3880  x[10] = 0.904117256370474856678465866;
3881  x[11] = 0.981560634246719250690549090;
3882  }
3883  else if (n==13) {
3884  x[ 0] = -0.984183054718588149472829449;
3885  x[ 1] = -0.917598399222977965206547837;
3886  x[ 2] = -0.801578090733309912794206490;
3887  x[ 3] = -0.642349339440340220643984607;
3888  x[ 4] = -0.448492751036446852877912852;
3889  x[ 5] = -0.230458315955134794065528121;
3890  x[ 6] = 0.000000000000000000000000000;
3891  x[ 7] = 0.230458315955134794065528121;
3892  x[ 8] = 0.448492751036446852877912852;
3893  x[ 9] = 0.642349339440340220643984607;
3894  x[10] = 0.80157809073330991279420649;
3895  x[11] = 0.91759839922297796520654784;
3896  x[12] = 0.98418305471858814947282945;
3897  }
3898  else if (n==14) {
3899  x[ 0] = -0.986283808696812338841597267;
3900  x[ 1] = -0.928434883663573517336391139;
3901  x[ 2] = -0.827201315069764993189794743;
3902  x[ 3] = -0.687292904811685470148019803;
3903  x[ 4] = -0.515248636358154091965290719;
3904  x[ 5] = -0.319112368927889760435671824;
3905  x[ 6] = -0.108054948707343662066244650;
3906  x[ 7] = 0.108054948707343662066244650;
3907  x[ 8] = 0.31911236892788976043567182;
3908  x[ 9] = 0.51524863635815409196529072;
3909  x[10] = 0.68729290481168547014801980;
3910  x[11] = 0.82720131506976499318979474;
3911  x[12] = 0.92843488366357351733639114;
3912  x[13] = 0.98628380869681233884159727;
3913  }
3914  else if (n==15) {
3915  x[ 0] = -0.987992518020485428489565719;
3916  x[ 1] = -0.937273392400705904307758948;
3917  x[ 2] = -0.848206583410427216200648321;
3918  x[ 3] = -0.724417731360170047416186055;
3919  x[ 4] = -0.570972172608538847537226737;
3920  x[ 5] = -0.394151347077563369897207371;
3921  x[ 6] = -0.201194093997434522300628303;
3922  x[ 7] = 0.00000000000000000000000000;
3923  x[ 8] = 0.20119409399743452230062830;
3924  x[ 9] = 0.39415134707756336989720737;
3925  x[10] = 0.57097217260853884753722674;
3926  x[11] = 0.72441773136017004741618605;
3927  x[12] = 0.84820658341042721620064832;
3928  x[13] = 0.93727339240070590430775895;
3929  x[14] = 0.98799251802048542848956572;
3930  }
3931  else if (n==16) {
3932  x[ 0] = -0.989400934991649932596154173;
3933  x[ 1] = -0.944575023073232576077988416;
3934  x[ 2] = -0.865631202387831743880467898;
3935  x[ 3] = -0.755404408355003033895101195;
3936  x[ 4] = -0.617876244402643748446671764;
3937  x[ 5] = -0.458016777657227386342419443;
3938  x[ 6] = -0.281603550779258913230460501;
3939  x[ 7] = -0.09501250983763744018531934;
3940  x[ 8] = 0.09501250983763744018531934;
3941  x[ 9] = 0.28160355077925891323046050;
3942  x[10] = 0.45801677765722738634241944;
3943  x[11] = 0.61787624440264374844667176;
3944  x[12] = 0.75540440835500303389510119;
3945  x[13] = 0.86563120238783174388046790;
3946  x[14] = 0.94457502307323257607798842;
3947  x[15] = 0.98940093499164993259615417;
3948  }
3949  else if (n==17) {
3950  x[ 0] = -0.990575475314417335675434020;
3951  x[ 1] = -0.950675521768767761222716958;
3952  x[ 2] = -0.880239153726985902122955694;
3953  x[ 3] = -0.781514003896801406925230056;
3954  x[ 4] = -0.657671159216690765850302217;
3955  x[ 5] = -0.512690537086476967886246569;
3956  x[ 6] = -0.35123176345387631529718552;
3957  x[ 7] = -0.17848418149584785585067749;
3958  x[ 8] = 0.00000000000000000000000000;
3959  x[ 9] = 0.17848418149584785585067749;
3960  x[10] = 0.35123176345387631529718552;
3961  x[11] = 0.51269053708647696788624657;
3962  x[12] = 0.65767115921669076585030222;
3963  x[13] = 0.78151400389680140692523006;
3964  x[14] = 0.88023915372698590212295569;
3965  x[15] = 0.95067552176876776122271696;
3966  x[16] = 0.99057547531441733567543402;
3967  }
3968  else if (n==18) {
3969  x[ 0] = -0.991565168420930946730016005;
3970  x[ 1] = -0.955823949571397755181195893;
3971  x[ 2] = -0.892602466497555739206060591;
3972  x[ 3] = -0.803704958972523115682417455;
3973  x[ 4] = -0.691687043060353207874891081;
3974  x[ 5] = -0.55977083107394753460787155;
3975  x[ 6] = -0.41175116146284264603593179;
3976  x[ 7] = -0.25188622569150550958897285;
3977  x[ 8] = -0.08477501304173530124226185;
3978  x[ 9] = 0.08477501304173530124226185;
3979  x[10] = 0.25188622569150550958897285;
3980  x[11] = 0.41175116146284264603593179;
3981  x[12] = 0.55977083107394753460787155;
3982  x[13] = 0.69168704306035320787489108;
3983  x[14] = 0.80370495897252311568241746;
3984  x[15] = 0.89260246649755573920606059;
3985  x[16] = 0.95582394957139775518119589;
3986  x[17] = 0.99156516842093094673001600;
3987  }
3988  else if (n==19) {
3989  x[ 0] = -0.992406843843584403189017670;
3990  x[ 1] = -0.960208152134830030852778841;
3991  x[ 2] = -0.903155903614817901642660929;
3992  x[ 3] = -0.822714656537142824978922487;
3993  x[ 4] = -0.72096617733522937861709586;
3994  x[ 5] = -0.60054530466168102346963816;
3995  x[ 6] = -0.46457074137596094571726715;
3996  x[ 7] = -0.31656409996362983199011733;
3997  x[ 8] = -0.16035864564022537586809612;
3998  x[ 9] = 0.00000000000000000000000000;
3999  x[10] = 0.16035864564022537586809612;
4000  x[11] = 0.31656409996362983199011733;
4001  x[12] = 0.46457074137596094571726715;
4002  x[13] = 0.60054530466168102346963816;
4003  x[14] = 0.72096617733522937861709586;
4004  x[15] = 0.82271465653714282497892249;
4005  x[16] = 0.90315590361481790164266093;
4006  x[17] = 0.96020815213483003085277884;
4007  x[18] = 0.99240684384358440318901767;
4008  }
4009  else if (n==20) {
4010  x[ 0] = -0.993128599185094924786122388;
4011  x[ 1] = -0.963971927277913791267666131;
4012  x[ 2] = -0.912234428251325905867752441;
4013  x[ 3] = -0.83911697182221882339452906;
4014  x[ 4] = -0.74633190646015079261430507;
4015  x[ 5] = -0.63605368072651502545283670;
4016  x[ 6] = -0.51086700195082709800436405;
4017  x[ 7] = -0.37370608871541956067254818;
4018  x[ 8] = -0.22778585114164507808049620;
4019  x[ 9] = -0.07652652113349733375464041;
4020  x[10] = 0.07652652113349733375464041;
4021  x[11] = 0.22778585114164507808049620;
4022  x[12] = 0.37370608871541956067254818;
4023  x[13] = 0.51086700195082709800436405;
4024  x[14] = 0.63605368072651502545283670;
4025  x[15] = 0.74633190646015079261430507;
4026  x[16] = 0.83911697182221882339452906;
4027  x[17] = 0.91223442825132590586775244;
4028  x[18] = 0.96397192727791379126766613;
4029  x[19] = 0.99312859918509492478612239;
4030  }
4031  else if (n==21) {
4032  x[ 0] = -0.99375217062038950026024204;
4033  x[ 1] = -0.96722683856630629431662221;
4034  x[ 2] = -0.92009933415040082879018713;
4035  x[ 3] = -0.85336336458331728364725064;
4036  x[ 4] = -0.76843996347567790861587785;
4037  x[ 5] = -0.66713880419741231930596667;
4038  x[ 6] = -0.55161883588721980705901880;
4039  x[ 7] = -0.42434212020743878357366889;
4040  x[ 8] = -0.28802131680240109660079252;
4041  x[ 9] = -0.14556185416089509093703098;
4042  x[10] = 0.00000000000000000000000000;
4043  x[11] = +0.14556185416089509093703098;
4044  x[12] = +0.28802131680240109660079252;
4045  x[13] = +0.42434212020743878357366889;
4046  x[14] = +0.55161883588721980705901880;
4047  x[15] = +0.66713880419741231930596667;
4048  x[16] = +0.76843996347567790861587785;
4049  x[17] = +0.85336336458331728364725064;
4050  x[18] = +0.92009933415040082879018713;
4051  x[19] = +0.96722683856630629431662221;
4052  x[20] = +0.99375217062038950026024204;
4053  }
4054  else if (n==22) {
4055  x[ 0] = -0.99429458548239929207303142;
4056  x[ 1] = -0.97006049783542872712395099;
4057  x[ 2] = -0.92695677218717400052069294;
4058  x[ 3] = -0.86581257772030013653642564;
4059  x[ 4] = -0.78781680597920816200427796;
4060  x[ 5] = -0.69448726318668278005068984;
4061  x[ 6] = -0.58764040350691159295887693;
4062  x[ 7] = -0.46935583798675702640633071;
4063  x[ 8] = -0.34193582089208422515814742;
4064  x[ 9] = -0.20786042668822128547884653;
4065  x[10] = -0.06973927331972222121384180;
4066  x[11] = 0.06973927331972222121384180;
4067  x[12] = 0.20786042668822128547884653;
4068  x[13] = 0.34193582089208422515814742;
4069  x[14] = 0.46935583798675702640633071;
4070  x[15] = 0.58764040350691159295887693;
4071  x[16] = 0.69448726318668278005068984;
4072  x[17] = 0.78781680597920816200427796;
4073  x[18] = 0.86581257772030013653642564;
4074  x[19] = 0.92695677218717400052069294;
4075  x[20] = 0.97006049783542872712395099;
4076  x[21] = 0.99429458548239929207303142;
4077  }
4078  else if (n==23) {
4079  x[ 0] = -0.99476933499755212352392572;
4080  x[ 1] = -0.97254247121811523195602408;
4081  x[ 2] = -0.93297108682601610234919699;
4082  x[ 3] = -0.87675235827044166737815689;
4083  x[ 4] = -0.80488840161883989215111841;
4084  x[ 5] = -0.71866136313195019446162448;
4085  x[ 6] = -0.61960987576364615638509731;
4086  x[ 7] = -0.50950147784600754968979305;
4087  x[ 8] = -0.39030103803029083142148887;
4088  x[ 9] = -0.26413568097034493053386954;
4089  x[10] = -0.13325682429846611093174268;
4090  x[11] = 0.00000000000000000000000000;
4091  x[12] = 0.13325682429846611093174268;
4092  x[13] = 0.26413568097034493053386954;
4093  x[14] = 0.39030103803029083142148887;
4094  x[15] = 0.50950147784600754968979305;
4095  x[16] = 0.61960987576364615638509731;
4096  x[17] = 0.71866136313195019446162448;
4097  x[18] = 0.80488840161883989215111841;
4098  x[19] = 0.87675235827044166737815689;
4099  x[20] = 0.93297108682601610234919699;
4100  x[21] = 0.97254247121811523195602408;
4101  x[22] = 0.99476933499755212352392572;
4102  }
4103  else if (n==24) {
4104  x[ 0] = -0.99518721999702136017999741;
4105  x[ 1] = -0.97472855597130949819839199;
4106  x[ 2] = -0.93827455200273275852364900;
4107  x[ 3] = -0.88641552700440103421315434;
4108  x[ 4] = -0.82000198597390292195394987;
4109  x[ 5] = -0.74012419157855436424382810;
4110  x[ 6] = -0.64809365193697556925249579;
4111  x[ 7] = -0.54542147138883953565837562;
4112  x[ 8] = -0.43379350762604513848708423;
4113  x[ 9] = -0.31504267969616337438679329;
4114  x[10] = -0.19111886747361630915863982;
4115  x[11] = -0.06405689286260562608504308;
4116  x[12] = 0.06405689286260562608504308;
4117  x[13] = 0.19111886747361630915863982;
4118  x[14] = 0.31504267969616337438679329;
4119  x[15] = 0.43379350762604513848708423;
4120  x[16] = 0.54542147138883953565837562;
4121  x[17] = 0.64809365193697556925249579;
4122  x[18] = 0.74012419157855436424382810;
4123  x[19] = 0.82000198597390292195394987;
4124  x[20] = 0.88641552700440103421315434;
4125  x[21] = 0.93827455200273275852364900;
4126  x[22] = 0.97472855597130949819839199;
4127  x[23] = 0.99518721999702136017999741;
4128  }
4129  else if (n==25) {
4130  x[ 0] = -0.99555696979049809790878495;
4131  x[ 1] = -0.97666392145951751149831539;
4132  x[ 2] = -0.94297457122897433941401117;
4133  x[ 3] = -0.89499199787827536885104201;
4134  x[ 4] = -0.83344262876083400142102111;
4135  x[ 5] = -0.75925926303735763057728287;
4136  x[ 6] = -0.67356636847346836448512063;
4137  x[ 7] = -0.57766293024122296772368984;
4138  x[ 8] = -0.47300273144571496052218212;
4139  x[ 9] = -0.36117230580938783773582173;
4140  x[10] = -0.24386688372098843204519036;
4141  x[11] = -0.12286469261071039638735982;
4142  x[12] = 0.00000000000000000000000000;
4143  x[13] = 0.12286469261071039638735982;
4144  x[14] = 0.24386688372098843204519036;
4145  x[15] = 0.36117230580938783773582173;
4146  x[16] = 0.47300273144571496052218212;
4147  x[17] = 0.57766293024122296772368984;
4148  x[18] = 0.67356636847346836448512063;
4149  x[19] = 0.75925926303735763057728287;
4150  x[20] = 0.83344262876083400142102111;
4151  x[21] = 0.89499199787827536885104201;
4152  x[22] = 0.94297457122897433941401117;
4153  x[23] = 0.97666392145951751149831539;
4154  x[24] = 0.99555696979049809790878495;
4155  }
4156  else if (n==26) {
4157  x[ 0] = -0.99588570114561692900321696;
4158  x[ 1] = -0.97838544595647099110058035;
4159  x[ 2] = -0.94715906666171425013591528;
4160  x[ 3] = -0.90263786198430707421766560;
4161  x[ 4] = -0.84544594278849801879750706;
4162  x[ 5] = -0.77638594882067885619296725;
4163  x[ 6] = -0.69642726041995726486381391;
4164  x[ 7] = -0.60669229301761806323197875;
4165  x[ 8] = -0.50844071482450571769570306;
4166  x[ 9] = -0.40305175512348630648107738;
4167  x[10] = -0.29200483948595689514283538;
4168  x[11] = -0.17685882035689018396905775;
4169  x[12] = -0.05923009342931320709371858;
4170  x[13] = 0.05923009342931320709371858;
4171  x[14] = 0.17685882035689018396905775;
4172  x[15] = 0.29200483948595689514283538;
4173  x[16] = 0.40305175512348630648107738;
4174  x[17] = 0.50844071482450571769570306;
4175  x[18] = 0.60669229301761806323197875;
4176  x[19] = 0.69642726041995726486381391;
4177  x[20] = 0.77638594882067885619296725;
4178  x[21] = 0.84544594278849801879750706;
4179  x[22] = 0.90263786198430707421766560;
4180  x[23] = 0.94715906666171425013591528;
4181  x[24] = 0.97838544595647099110058035;
4182  x[25] = 0.99588570114561692900321696;
4183  }
4184  else if (n==27) {
4185  x[ 0] = -0.99617926288898856693888721;
4186  x[ 1] = -0.97992347596150122285587336;
4187  x[ 2] = -0.95090055781470500685190803;
4188  x[ 3] = -0.90948232067749110430064502;
4189  x[ 4] = -0.85620790801829449030273722;
4190  x[ 5] = -0.79177163907050822714439734;
4191  x[ 6] = -0.71701347373942369929481621;
4192  x[ 7] = -0.63290797194649514092773464;
4193  x[ 8] = -0.54055156457945689490030094;
4194  x[ 9] = -0.44114825175002688058597416;
4195  x[10] = -0.33599390363850889973031903;
4196  x[11] = -0.22645936543953685885723911;
4197  x[12] = -0.11397258560952996693289498;
4198  x[13] = 0.00000000000000000000000000;
4199  x[14] = 0.11397258560952996693289498;
4200  x[15] = 0.22645936543953685885723911;
4201  x[16] = 0.33599390363850889973031903;
4202  x[17] = 0.44114825175002688058597416;
4203  x[18] = 0.54055156457945689490030094;
4204  x[19] = 0.63290797194649514092773464;
4205  x[20] = 0.71701347373942369929481621;
4206  x[21] = 0.79177163907050822714439734;
4207  x[22] = 0.85620790801829449030273722;
4208  x[23] = 0.90948232067749110430064502;
4209  x[24] = 0.95090055781470500685190803;
4210  x[25] = 0.97992347596150122285587336;
4211  x[26] = 0.99617926288898856693888721;
4212  }
4213  else if (n==28) {
4214  x[ 0] = -0.99644249757395444995043639;
4215  x[ 1] = -0.98130316537087275369455995;
4216  x[ 2] = -0.95425928062893819725410184;
4217  x[ 3] = -0.91563302639213207386968942;
4218  x[ 4] = -0.86589252257439504894225457;
4219  x[ 5] = -0.80564137091717917144788596;
4220  x[ 6] = -0.73561087801363177202814451;
4221  x[ 7] = -0.65665109403886496121989818;
4222  x[ 8] = -0.56972047181140171930800328;
4223  x[ 9] = -0.47587422495511826103441185;
4224  x[10] = -0.37625151608907871022135721;
4225  x[11] = -0.27206162763517807767682636;
4226  x[12] = -0.16456928213338077128147178;
4227  x[13] = -0.05507928988403427042651653;
4228  x[14] = 0.05507928988403427042651653;
4229  x[15] = 0.16456928213338077128147178;
4230  x[16] = 0.27206162763517807767682636;
4231  x[17] = 0.37625151608907871022135721;
4232  x[18] = 0.47587422495511826103441185;
4233  x[19] = 0.56972047181140171930800328;
4234  x[20] = 0.65665109403886496121989818;
4235  x[21] = 0.73561087801363177202814451;
4236  x[22] = 0.80564137091717917144788596;
4237  x[23] = 0.86589252257439504894225457;
4238  x[24] = 0.91563302639213207386968942;
4239  x[25] = 0.95425928062893819725410184;
4240  x[26] = 0.98130316537087275369455995;
4241  x[27] = 0.99644249757395444995043639;
4242  }
4243  else if (n==29) {
4244  x[ 0] = -0.99667944226059658616319153;
4245  x[ 1] = -0.98254550526141317487092602;
4246  x[ 2] = -0.95728559577808772579820804;
4247  x[ 3] = -0.92118023295305878509375344;
4248  x[ 4] = -0.87463780492010279041779342;
4249  x[ 5] = -0.81818548761525244498957221;
4250  x[ 6] = -0.75246285173447713391261008;
4251  x[ 7] = -0.67821453760268651515618501;
4252  x[ 8] = -0.59628179713822782037958621;
4253  x[ 9] = -0.50759295512422764210262792;
4254  x[10] = -0.41315288817400866389070659;
4255  x[11] = -0.31403163786763993494819592;
4256  x[12] = -0.21135228616600107450637573;
4257  x[13] = -0.10627823013267923017098239;
4258  x[14] = 0.00000000000000000000000000;
4259  x[15] = 0.10627823013267923017098239;
4260  x[16] = 0.21135228616600107450637573;
4261  x[17] = 0.31403163786763993494819592;
4262  x[18] = 0.41315288817400866389070659;
4263  x[19] = 0.50759295512422764210262792;
4264  x[20] = 0.59628179713822782037958621;
4265  x[21] = 0.67821453760268651515618501;
4266  x[22] = 0.75246285173447713391261008;
4267  x[23] = 0.81818548761525244498957221;
4268  x[24] = 0.87463780492010279041779342;
4269  x[25] = 0.92118023295305878509375344;
4270  x[26] = 0.95728559577808772579820804;
4271  x[27] = 0.98254550526141317487092602;
4272  x[28] = 0.99667944226059658616319153;
4273  }
4274  else if (n==30) {
4275  x[ 0] = -0.99689348407464954027163005;
4276  x[ 1] = -0.98366812327974720997003258;
4277  x[ 2] = -0.96002186496830751221687103;
4278  x[ 3] = -0.92620004742927432587932428;
4279  x[ 4] = -0.88256053579205268154311646;
4280  x[ 5] = -0.82956576238276839744289812;
4281  x[ 6] = -0.76777743210482619491797734;
4282  x[ 7] = -0.69785049479331579693229239;
4283  x[ 8] = -0.62052618298924286114047756;
4284  x[ 9] = -0.53662414814201989926416979;
4285  x[10] = -0.44703376953808917678060990;
4286  x[11] = -0.35270472553087811347103721;
4287  x[12] = -0.25463692616788984643980513;
4288  x[13] = -0.15386991360858354696379467;
4289  x[14] = -0.05147184255531769583302521;
4290  x[15] = 0.05147184255531769583302521;
4291  x[16] = 0.15386991360858354696379467;
4292  x[17] = 0.25463692616788984643980513;
4293  x[18] = 0.35270472553087811347103721;
4294  x[19] = 0.44703376953808917678060990;
4295  x[20] = 0.53662414814201989926416979;
4296  x[21] = 0.62052618298924286114047756;
4297  x[22] = 0.69785049479331579693229239;
4298  x[23] = 0.76777743210482619491797734;
4299  x[24] = 0.82956576238276839744289812;
4300  x[25] = 0.88256053579205268154311646;
4301  x[26] = 0.92620004742927432587932428;
4302  x[27] = 0.96002186496830751221687103;
4303  x[28] = 0.98366812327974720997003258;
4304  x[29] = 0.99689348407464954027163005;
4305  }
4306  else if (n==31) {
4307  x[ 0] = -0.99708748181947707405562655;
4308  x[ 1] = -0.98468590966515248400246517;
4309  x[ 2] = -0.96250392509294966178905240;
4310  x[ 3] = -0.93075699789664816495694576;
4311  x[ 4] = -0.88976002994827104337419201;
4312  x[ 5] = -0.83992032014626734008690454;
4313  x[ 6] = -0.78173314841662494040636002;
4314  x[ 7] = -0.71577678458685328390597087;
4315  x[ 8] = -0.64270672292426034618441820;
4316  x[ 9] = -0.56324916140714926272094492;
4317  x[10] = -0.47819378204490248044059404;
4318  x[11] = -0.38838590160823294306135146;
4319  x[12] = -0.29471806998170161661790390;
4320  x[13] = -0.19812119933557062877241300;
4321  x[14] = -0.09955531215234152032517479;
4322  x[15] = 0.00000000000000000000000000;
4323  x[16] = 0.09955531215234152032517479;
4324  x[17] = 0.19812119933557062877241300;
4325  x[18] = 0.29471806998170161661790390;
4326  x[19] = 0.38838590160823294306135146;
4327  x[20] = 0.47819378204490248044059404;
4328  x[21] = 0.56324916140714926272094492;
4329  x[22] = 0.64270672292426034618441820;
4330  x[23] = 0.71577678458685328390597087;
4331  x[24] = 0.78173314841662494040636002;
4332  x[25] = 0.83992032014626734008690454;
4333  x[26] = 0.88976002994827104337419201;
4334  x[27] = 0.93075699789664816495694576;
4335  x[28] = 0.96250392509294966178905240;
4336  x[29] = 0.98468590966515248400246517;
4337  x[30] = 0.99708748181947707405562655;
4338  }
4339  else if (n==32) {
4340  x[ 0] = -0.99726386184948156354498113;
4341  x[ 1] = -0.98561151154526833540017504;
4342  x[ 2] = -0.96476225558750643077381193;
4343  x[ 3] = -0.93490607593773968917091913;
4344  x[ 4] = -0.89632115576605212396530724;
4345  x[ 5] = -0.84936761373256997013369300;
4346  x[ 6] = -0.79448379596794240696309730;
4347  x[ 7] = -0.73218211874028968038742667;
4348  x[ 8] = -0.66304426693021520097511517;
4349  x[ 9] = -0.58771575724076232904074548;
4350  x[10] = -0.50689990893222939002374747;
4351  x[11] = -0.42135127613063534536411944;
4352  x[12] = -0.33186860228212764977991681;
4353  x[13] = -0.23928736225213707454460321;
4354  x[14] = -0.14447196158279649348518637;
4355  x[15] = -0.04830766568773831623481257;
4356  x[16] = 0.04830766568773831623481257;
4357  x[17] = 0.14447196158279649348518637;
4358  x[18] = 0.23928736225213707454460321;
4359  x[19] = 0.33186860228212764977991681;
4360  x[20] = 0.42135127613063534536411944;
4361  x[21] = 0.50689990893222939002374747;
4362  x[22] = 0.58771575724076232904074548;
4363  x[23] = 0.66304426693021520097511517;
4364  x[24] = 0.73218211874028968038742667;
4365  x[25] = 0.79448379596794240696309730;
4366  x[26] = 0.84936761373256997013369300;
4367  x[27] = 0.89632115576605212396530724;
4368  x[28] = 0.93490607593773968917091913;
4369  x[29] = 0.96476225558750643077381193;
4370  x[30] = 0.98561151154526833540017504;
4371  x[31] = 0.99726386184948156354498113;
4372  }
4373  else if (n==33) {
4374  x[ 0] = -0.99742469424645521726616802;
4375  x[ 1] = -0.98645572623064248811037570;
4376  x[ 2] = -0.96682290968999276892837771;
4377  x[ 3] = -0.93869437261116835035583512;
4378  x[ 4] = -0.90231676774343358304053133;
4379  x[ 5] = -0.85800965267650406464306148;
4380  x[ 6] = -0.80616235627416658979620087;
4381  x[ 7] = -0.74723049644956215785905512;
4382  x[ 8] = -0.68173195996974278626821595;
4383  x[ 9] = -0.61024234583637902730728751;
4384  x[10] = -0.53338990478634764354889426;
4385  x[11] = -0.45185001727245069572599328;
4386  x[12] = -0.36633925774807334107022062;
4387  x[13] = -0.27760909715249702940324807;
4388  x[14] = -0.18643929882799157233579876;
4389  x[15] = -0.09363106585473338567074292;
4390  x[16] = 0.00000000000000000000000000;
4391  x[17] = 0.09363106585473338567074292;
4392  x[18] = 0.18643929882799157233579876;
4393  x[19] = 0.27760909715249702940324807;
4394  x[20] = 0.36633925774807334107022062;
4395  x[21] = 0.45185001727245069572599328;
4396  x[22] = 0.53338990478634764354889426;
4397  x[23] = 0.61024234583637902730728751;
4398  x[24] = 0.68173195996974278626821595;
4399  x[25] = 0.74723049644956215785905512;
4400  x[26] = 0.80616235627416658979620087;
4401  x[27] = 0.85800965267650406464306148;
4402  x[28] = 0.90231676774343358304053133;
4403  x[29] = 0.93869437261116835035583512;
4404  x[30] = 0.96682290968999276892837771;
4405  x[31] = 0.98645572623064248811037570;
4406  x[32] = 0.99742469424645521726616802;
4407  }
4408  else {
4409  std::cerr << "\n";
4410  std::cerr << "LEGENDRE_LOOKUP_POINTS - Fatal error!\n";
4411  std::cerr << " Illegal value of N = " << n << "\n";
4412  std::cerr << " Legal values are 1 through 33.\n";
4413  std::exit(1);
4414  }
4415  return;
4416 }
4417 
4418 //****************************************************************************
4419 template<class Real>
4421 //****************************************************************************
4422 //
4423 // Purpose:
4424 //
4425 // LEGENDRE_LOOKUP_WEIGHTS looks up weights for Gauss-Legendre quadrature.
4426 //
4427 // Licensing:
4428 //
4429 // This code is distributed under the GNU LGPL license.
4430 //
4431 // Modified:
4432 //
4433 // 27 April 2010
4434 //
4435 // Author:
4436 //
4437 // John Burkardt
4438 //
4439 // Reference:
4440 //
4441 // Milton Abramowitz, Irene Stegun,
4442 // Handbook of Mathematical Functions,
4443 // National Bureau of Standards, 1964,
4444 // ISBN: 0-486-61272-4,
4445 // LC: QA47.A34.
4446 //
4447 // Vladimir Krylov,
4448 // Approximate Calculation of Integrals,
4449 // Dover, 2006,
4450 // ISBN: 0486445798.
4451 // LC: QA311.K713.
4452 //
4453 // Arthur Stroud, Don Secrest,
4454 // Gaussian Quadrature Formulas,
4455 // Prentice Hall, 1966,
4456 // LC: QA299.4G3S7.
4457 //
4458 // Stephen Wolfram,
4459 // The Mathematica Book,
4460 // Fourth Edition,
4461 // Cambridge University Press, 1999,
4462 // ISBN: 0-521-64314-7,
4463 // LC: QA76.95.W65.
4464 //
4465 // Daniel Zwillinger, editor,
4466 // CRC Standard Mathematical Tables and Formulae,
4467 // 30th Edition,
4468 // CRC Press, 1996,
4469 // ISBN: 0-8493-2479-3,
4470 // LC: QA47.M315.
4471 //
4472 // Parameters:
4473 //
4474 // Input, int N, the order.
4475 // N must be between 1 and 33.
4476 //
4477 // Output, Real W[N], the weights.
4478 //
4479 {
4480  if (n==1) {
4481  w[ 0] = 2.000000000000000000000000000000;
4482  }
4483  else if (n==2) {
4484  w[ 0] = 1.000000000000000000000000000000;
4485  w[ 1] = 1.000000000000000000000000000000;
4486  }
4487  else if (n==3) {
4488  w[ 0] = 0.555555555555555555555555555556;
4489  w[ 1] = 0.888888888888888888888888888889;
4490  w[ 2] = 0.555555555555555555555555555556;
4491  }
4492  else if (n==4) {
4493  w[ 0] = 0.347854845137453857373063949222;
4494  w[ 1] = 0.652145154862546142626936050778;
4495  w[ 2] = 0.652145154862546142626936050778;
4496  w[ 3] = 0.347854845137453857373063949222;
4497  }
4498  else if (n==5) {
4499  w[ 0] = 0.236926885056189087514264040720;
4500  w[ 1] = 0.478628670499366468041291514836;
4501  w[ 2] = 0.568888888888888888888888888889;
4502  w[ 3] = 0.478628670499366468041291514836;
4503  w[ 4] = 0.236926885056189087514264040720;
4504  }
4505  else if (n==6) {
4506  w[ 0] = 0.171324492379170345040296142173;
4507  w[ 1] = 0.360761573048138607569833513838;
4508  w[ 2] = 0.467913934572691047389870343990;
4509  w[ 3] = 0.467913934572691047389870343990;
4510  w[ 4] = 0.360761573048138607569833513838;
4511  w[ 5] = 0.171324492379170345040296142173;
4512  }
4513  else if (n==7) {
4514  w[ 0] = 0.129484966168869693270611432679;
4515  w[ 1] = 0.279705391489276667901467771424;
4516  w[ 2] = 0.381830050505118944950369775489;
4517  w[ 3] = 0.417959183673469387755102040816;
4518  w[ 4] = 0.381830050505118944950369775489;
4519  w[ 5] = 0.279705391489276667901467771424;
4520  w[ 6] = 0.129484966168869693270611432679;
4521  }
4522  else if (n==8) {
4523  w[ 0] = 0.101228536290376259152531354310;
4524  w[ 1] = 0.222381034453374470544355994426;
4525  w[ 2] = 0.313706645877887287337962201987;
4526  w[ 3] = 0.362683783378361982965150449277;
4527  w[ 4] = 0.362683783378361982965150449277;
4528  w[ 5] = 0.313706645877887287337962201987;
4529  w[ 6] = 0.222381034453374470544355994426;
4530  w[ 7] = 0.101228536290376259152531354310;
4531  }
4532  else if (n==9) {
4533  w[ 0] = 0.081274388361574411971892158111;
4534  w[ 1] = 0.18064816069485740405847203124;
4535  w[ 2] = 0.26061069640293546231874286942;
4536  w[ 3] = 0.31234707704000284006863040658;
4537  w[ 4] = 0.33023935500125976316452506929;
4538  w[ 5] = 0.31234707704000284006863040658;
4539  w[ 6] = 0.26061069640293546231874286942;
4540  w[ 7] = 0.18064816069485740405847203124;
4541  w[ 8] = 0.081274388361574411971892158111;
4542  }
4543  else if (n==10) {
4544  w[ 0] = 0.066671344308688137593568809893;
4545  w[ 1] = 0.14945134915058059314577633966;
4546  w[ 2] = 0.21908636251598204399553493423;
4547  w[ 3] = 0.26926671930999635509122692157;
4548  w[ 4] = 0.29552422471475287017389299465;
4549  w[ 5] = 0.29552422471475287017389299465;
4550  w[ 6] = 0.26926671930999635509122692157;
4551  w[ 7] = 0.21908636251598204399553493423;
4552  w[ 8] = 0.14945134915058059314577633966;
4553  w[ 9] = 0.066671344308688137593568809893;
4554  }
4555  else if (n==11) {
4556  w[ 0] = 0.055668567116173666482753720443;
4557  w[ 1] = 0.12558036946490462463469429922;
4558  w[ 2] = 0.18629021092773425142609764143;
4559  w[ 3] = 0.23319376459199047991852370484;
4560  w[ 4] = 0.26280454451024666218068886989;
4561  w[ 5] = 0.27292508677790063071448352834;
4562  w[ 6] = 0.26280454451024666218068886989;
4563  w[ 7] = 0.23319376459199047991852370484;
4564  w[ 8] = 0.18629021092773425142609764143;
4565  w[ 9] = 0.12558036946490462463469429922;
4566  w[10] = 0.055668567116173666482753720443;
4567  }
4568  else if (n==12) {
4569  w[ 0] = 0.047175336386511827194615961485;
4570  w[ 1] = 0.10693932599531843096025471819;
4571  w[ 2] = 0.16007832854334622633465252954;
4572  w[ 3] = 0.20316742672306592174906445581;
4573  w[ 4] = 0.23349253653835480876084989892;
4574  w[ 5] = 0.24914704581340278500056243604;
4575  w[ 6] = 0.24914704581340278500056243604;
4576  w[ 7] = 0.23349253653835480876084989892;
4577  w[ 8] = 0.20316742672306592174906445581;
4578  w[ 9] = 0.16007832854334622633465252954;
4579  w[10] = 0.10693932599531843096025471819;
4580  w[11] = 0.047175336386511827194615961485;
4581  }
4582  else if (n==13) {
4583  w[ 0] = 0.040484004765315879520021592201;
4584  w[ 1] = 0.092121499837728447914421775954;
4585  w[ 2] = 0.13887351021978723846360177687;
4586  w[ 3] = 0.17814598076194573828004669200;
4587  w[ 4] = 0.20781604753688850231252321931;
4588  w[ 5] = 0.22628318026289723841209018604;
4589  w[ 6] = 0.23255155323087391019458951527;
4590  w[ 7] = 0.22628318026289723841209018604;
4591  w[ 8] = 0.20781604753688850231252321931;
4592  w[ 9] = 0.17814598076194573828004669200;
4593  w[10] = 0.13887351021978723846360177687;
4594  w[11] = 0.092121499837728447914421775954;
4595  w[12] = 0.040484004765315879520021592201;
4596  }
4597  else if (n==14) {
4598  w[ 0] = 0.035119460331751863031832876138;
4599  w[ 1] = 0.08015808715976020980563327706;
4600  w[ 2] = 0.12151857068790318468941480907;
4601  w[ 3] = 0.15720316715819353456960193862;
4602  w[ 4] = 0.18553839747793781374171659013;
4603  w[ 5] = 0.20519846372129560396592406566;
4604  w[ 6] = 0.21526385346315779019587644332;
4605  w[ 7] = 0.21526385346315779019587644332;
4606  w[ 8] = 0.20519846372129560396592406566;
4607  w[ 9] = 0.18553839747793781374171659013;
4608  w[10] = 0.15720316715819353456960193862;
4609  w[11] = 0.12151857068790318468941480907;
4610  w[12] = 0.08015808715976020980563327706;
4611  w[13] = 0.035119460331751863031832876138;
4612  }
4613  else if (n==15) {
4614  w[ 0] = 0.030753241996117268354628393577;
4615  w[ 1] = 0.070366047488108124709267416451;
4616  w[ 2] = 0.107159220467171935011869546686;
4617  w[ 3] = 0.13957067792615431444780479451;
4618  w[ 4] = 0.16626920581699393355320086048;
4619  w[ 5] = 0.18616100001556221102680056187;
4620  w[ 6] = 0.19843148532711157645611832644;
4621  w[ 7] = 0.20257824192556127288062019997;
4622  w[ 8] = 0.19843148532711157645611832644;
4623  w[ 9] = 0.18616100001556221102680056187;
4624  w[10] = 0.16626920581699393355320086048;
4625  w[11] = 0.13957067792615431444780479451;
4626  w[12] = 0.107159220467171935011869546686;
4627  w[13] = 0.070366047488108124709267416451;
4628  w[14] = 0.030753241996117268354628393577;
4629  }
4630  else if (n==16) {
4631  w[ 0] = 0.027152459411754094851780572456;
4632  w[ 1] = 0.062253523938647892862843836994;
4633  w[ 2] = 0.09515851168249278480992510760;
4634  w[ 3] = 0.12462897125553387205247628219;
4635  w[ 4] = 0.14959598881657673208150173055;
4636  w[ 5] = 0.16915651939500253818931207903;
4637  w[ 6] = 0.18260341504492358886676366797;
4638  w[ 7] = 0.18945061045506849628539672321;
4639  w[ 8] = 0.18945061045506849628539672321;
4640  w[ 9] = 0.18260341504492358886676366797;
4641  w[10] = 0.16915651939500253818931207903;
4642  w[11] = 0.14959598881657673208150173055;
4643  w[12] = 0.12462897125553387205247628219;
4644  w[13] = 0.09515851168249278480992510760;
4645  w[14] = 0.062253523938647892862843836994;
4646  w[15] = 0.027152459411754094851780572456;
4647  }
4648  else if (n==17) {
4649  w[ 0] = 0.024148302868547931960110026288;
4650  w[ 1] = 0.055459529373987201129440165359;
4651  w[ 2] = 0.085036148317179180883535370191;
4652  w[ 3] = 0.111883847193403971094788385626;
4653  w[ 4] = 0.13513636846852547328631998170;
4654  w[ 5] = 0.15404576107681028808143159480;
4655  w[ 6] = 0.16800410215645004450997066379;
4656  w[ 7] = 0.17656270536699264632527099011;
4657  w[ 8] = 0.17944647035620652545826564426;
4658  w[ 9] = 0.17656270536699264632527099011;
4659  w[10] = 0.16800410215645004450997066379;
4660  w[11] = 0.15404576107681028808143159480;
4661  w[12] = 0.13513636846852547328631998170;
4662  w[13] = 0.111883847193403971094788385626;
4663  w[14] = 0.085036148317179180883535370191;
4664  w[15] = 0.055459529373987201129440165359;
4665  w[16] = 0.024148302868547931960110026288;
4666  }
4667  else if (n==18) {
4668  w[ 0] = 0.021616013526483310313342710266;
4669  w[ 1] = 0.049714548894969796453334946203;
4670  w[ 2] = 0.07642573025488905652912967762;
4671  w[ 3] = 0.10094204410628716556281398492;
4672  w[ 4] = 0.12255520671147846018451912680;
4673  w[ 5] = 0.14064291467065065120473130375;
4674  w[ 6] = 0.15468467512626524492541800384;
4675  w[ 7] = 0.16427648374583272298605377647;
4676  w[ 8] = 0.16914238296314359184065647013;
4677  w[ 9] = 0.16914238296314359184065647013;
4678  w[10] = 0.16427648374583272298605377647;
4679  w[11] = 0.15468467512626524492541800384;
4680  w[12] = 0.14064291467065065120473130375;
4681  w[13] = 0.12255520671147846018451912680;
4682  w[14] = 0.10094204410628716556281398492;
4683  w[15] = 0.07642573025488905652912967762;
4684  w[16] = 0.049714548894969796453334946203;
4685  w[17] = 0.021616013526483310313342710266;
4686  }
4687  else if (n==19) {
4688  w[ 0] = 0.019461788229726477036312041464;
4689  w[ 1] = 0.044814226765699600332838157402;
4690  w[ 2] = 0.069044542737641226580708258006;
4691  w[ 3] = 0.091490021622449999464462094124;
4692  w[ 4] = 0.111566645547333994716023901682;
4693  w[ 5] = 0.12875396253933622767551578486;
4694  w[ 6] = 0.14260670217360661177574610944;
4695  w[ 7] = 0.15276604206585966677885540090;
4696  w[ 8] = 0.15896884339395434764995643946;
4697  w[ 9] = 0.16105444984878369597916362532;
4698  w[10] = 0.15896884339395434764995643946;
4699  w[11] = 0.15276604206585966677885540090;
4700  w[12] = 0.14260670217360661177574610944;
4701  w[13] = 0.12875396253933622767551578486;
4702  w[14] = 0.111566645547333994716023901682;
4703  w[15] = 0.091490021622449999464462094124;
4704  w[16] = 0.069044542737641226580708258006;
4705  w[17] = 0.044814226765699600332838157402;
4706  w[18] = 0.019461788229726477036312041464;
4707  }
4708  else if (n==20) {
4709  w[ 0] = 0.017614007139152118311861962352;
4710  w[ 1] = 0.040601429800386941331039952275;
4711  w[ 2] = 0.062672048334109063569506535187;
4712  w[ 3] = 0.08327674157670474872475814322;
4713  w[ 4] = 0.10193011981724043503675013548;
4714  w[ 5] = 0.11819453196151841731237737771;
4715  w[ 6] = 0.13168863844917662689849449975;
4716  w[ 7] = 0.14209610931838205132929832507;
4717  w[ 8] = 0.14917298647260374678782873700;
4718  w[ 9] = 0.15275338713072585069808433195;
4719  w[10] = 0.15275338713072585069808433195;
4720  w[11] = 0.14917298647260374678782873700;
4721  w[12] = 0.14209610931838205132929832507;
4722  w[13] = 0.13168863844917662689849449975;
4723  w[14] = 0.11819453196151841731237737771;
4724  w[15] = 0.10193011981724043503675013548;
4725  w[16] = 0.08327674157670474872475814322;
4726  w[17] = 0.062672048334109063569506535187;
4727  w[18] = 0.040601429800386941331039952275;
4728  w[19] = 0.017614007139152118311861962352;
4729  }
4730  else if (n==21) {
4731  w[ 0] = 0.016017228257774333324224616858;
4732  w[ 1] = 0.036953789770852493799950668299;
4733  w[ 2] = 0.057134425426857208283635826472;
4734  w[ 3] = 0.076100113628379302017051653300;
4735  w[ 4] = 0.093444423456033861553289741114;
4736  w[ 5] = 0.108797299167148377663474578070;
4737  w[ 6] = 0.12183141605372853419536717713;
4738  w[ 7] = 0.13226893863333746178105257450;
4739  w[ 8] = 0.13988739479107315472213342387;
4740  w[ 9] = 0.14452440398997005906382716655;
4741  w[10] = 0.14608113364969042719198514768;
4742  w[11] = 0.14452440398997005906382716655;
4743  w[12] = 0.13988739479107315472213342387;
4744  w[13] = 0.13226893863333746178105257450;
4745  w[14] = 0.12183141605372853419536717713;
4746  w[15] = 0.108797299167148377663474578070;
4747  w[16] = 0.093444423456033861553289741114;
4748  w[17] = 0.076100113628379302017051653300;
4749  w[18] = 0.057134425426857208283635826472;
4750  w[19] = 0.036953789770852493799950668299;
4751  w[20] = 0.016017228257774333324224616858;
4752  }
4753  else if (n==22) {
4754  w[ 0] = 0.014627995298272200684991098047;
4755  w[ 1] = 0.033774901584814154793302246866;
4756  w[ 2] = 0.052293335152683285940312051273;
4757  w[ 3] = 0.06979646842452048809496141893;
4758  w[ 4] = 0.08594160621706772741444368137;
4759  w[ 5] = 0.10041414444288096493207883783;
4760  w[ 6] = 0.11293229608053921839340060742;
4761  w[ 7] = 0.12325237681051242428556098615;
4762  w[ 8] = 0.13117350478706237073296499253;
4763  w[ 9] = 0.13654149834601517135257383123;
4764  w[10] = 0.13925187285563199337541024834;
4765  w[11] = 0.13925187285563199337541024834;
4766  w[12] = 0.13654149834601517135257383123;
4767  w[13] = 0.13117350478706237073296499253;
4768  w[14] = 0.12325237681051242428556098615;
4769  w[15] = 0.11293229608053921839340060742;
4770  w[16] = 0.10041414444288096493207883783;
4771  w[17] = 0.08594160621706772741444368137;
4772  w[18] = 0.06979646842452048809496141893;
4773  w[19] = 0.052293335152683285940312051273;
4774  w[20] = 0.033774901584814154793302246866;
4775  w[21] = 0.014627995298272200684991098047;
4776  }
4777  else if (n==23) {
4778  w[ 0] = 0.013411859487141772081309493459;
4779  w[ 1] = 0.030988005856979444310694219642;
4780  w[ 2] = 0.048037671731084668571641071632;
4781  w[ 3] = 0.064232421408525852127169615159;
4782  w[ 4] = 0.079281411776718954922892524742;
4783  w[ 5] = 0.092915766060035147477018617370;
4784  w[ 6] = 0.104892091464541410074086185015;
4785  w[ 7] = 0.11499664022241136494164351293;
4786  w[ 8] = 0.12304908430672953046757840067;
4787  w[ 9] = 0.12890572218808214997859533940;
4788  w[10] = 0.13246203940469661737164246470;
4789  w[11] = 0.13365457218610617535145711055;
4790  w[12] = 0.13246203940469661737164246470;
4791  w[13] = 0.12890572218808214997859533940;
4792  w[14] = 0.12304908430672953046757840067;
4793  w[15] = 0.11499664022241136494164351293;
4794  w[16] = 0.104892091464541410074086185015;
4795  w[17] = 0.092915766060035147477018617370;
4796  w[18] = 0.079281411776718954922892524742;
4797  w[19] = 0.064232421408525852127169615159;
4798  w[20] = 0.048037671731084668571641071632;
4799  w[21] = 0.030988005856979444310694219642;
4800  w[22] = 0.013411859487141772081309493459;
4801  }
4802  else if (n==24) {
4803  w[ 0] = 0.012341229799987199546805667070;
4804  w[ 1] = 0.028531388628933663181307815952;
4805  w[ 2] = 0.044277438817419806168602748211;
4806  w[ 3] = 0.059298584915436780746367758500;
4807  w[ 4] = 0.07334648141108030573403361525;
4808  w[ 5] = 0.08619016153195327591718520298;
4809  w[ 6] = 0.09761865210411388826988066446;
4810  w[ 7] = 0.10744427011596563478257734245;
4811  w[ 8] = 0.11550566805372560135334448391;
4812  w[ 9] = 0.12167047292780339120446315348;
4813  w[10] = 0.12583745634682829612137538251;
4814  w[11] = 0.12793819534675215697405616522;
4815  w[12] = 0.12793819534675215697405616522;
4816  w[13] = 0.12583745634682829612137538251;
4817  w[14] = 0.12167047292780339120446315348;
4818  w[15] = 0.11550566805372560135334448391;
4819  w[16] = 0.10744427011596563478257734245;
4820  w[17] = 0.09761865210411388826988066446;
4821  w[18] = 0.08619016153195327591718520298;
4822  w[19] = 0.07334648141108030573403361525;
4823  w[20] = 0.059298584915436780746367758500;
4824  w[21] = 0.044277438817419806168602748211;
4825  w[22] = 0.028531388628933663181307815952;
4826  w[23] = 0.012341229799987199546805667070;
4827  }
4828  else if (n==25) {
4829  w[ 0] = 0.0113937985010262879479029641132;
4830  w[ 1] = 0.026354986615032137261901815295;
4831  w[ 2] = 0.040939156701306312655623487712;
4832  w[ 3] = 0.054904695975835191925936891541;
4833  w[ 4] = 0.068038333812356917207187185657;
4834  w[ 5] = 0.080140700335001018013234959669;
4835  w[ 6] = 0.091028261982963649811497220703;
4836  w[ 7] = 0.100535949067050644202206890393;
4837  w[ 8] = 0.108519624474263653116093957050;
4838  w[ 9] = 0.11485825914571164833932554587;
4839  w[10] = 0.11945576353578477222817812651;
4840  w[11] = 0.12224244299031004168895951895;
4841  w[12] = 0.12317605372671545120390287308;
4842  w[13] = 0.12224244299031004168895951895;
4843  w[14] = 0.11945576353578477222817812651;
4844  w[15] = 0.11485825914571164833932554587;
4845  w[16] = 0.108519624474263653116093957050;
4846  w[17] = 0.100535949067050644202206890393;
4847  w[18] = 0.091028261982963649811497220703;
4848  w[19] = 0.080140700335001018013234959669;
4849  w[20] = 0.068038333812356917207187185657;
4850  w[21] = 0.054904695975835191925936891541;
4851  w[22] = 0.040939156701306312655623487712;
4852  w[23] = 0.026354986615032137261901815295;
4853  w[24] = 0.0113937985010262879479029641132;
4854  }
4855  else if (n==26) {
4856  w[ 0] = 0.010551372617343007155651187685;
4857  w[ 1] = 0.024417851092631908789615827520;
4858  w[ 2] = 0.037962383294362763950303141249;
4859  w[ 3] = 0.050975825297147811998319900724;
4860  w[ 4] = 0.063274046329574835539453689907;
4861  w[ 5] = 0.07468414976565974588707579610;
4862  w[ 6] = 0.08504589431348523921044776508;
4863  w[ 7] = 0.09421380035591414846366488307;
4864  w[ 8] = 0.10205916109442542323841407025;
4865  w[ 9] = 0.10847184052857659065657942673;
4866  w[10] = 0.11336181654631966654944071844;
4867  w[11] = 0.11666044348529658204466250754;
4868  w[12] = 0.11832141527926227651637108570;
4869  w[13] = 0.11832141527926227651637108570;
4870  w[14] = 0.11666044348529658204466250754;
4871  w[15] = 0.11336181654631966654944071844;
4872  w[16] = 0.10847184052857659065657942673;
4873  w[17] = 0.10205916109442542323841407025;
4874  w[18] = 0.09421380035591414846366488307;
4875  w[19] = 0.08504589431348523921044776508;
4876  w[20] = 0.07468414976565974588707579610;
4877  w[21] = 0.063274046329574835539453689907;
4878  w[22] = 0.050975825297147811998319900724;
4879  w[23] = 0.037962383294362763950303141249;
4880  w[24] = 0.024417851092631908789615827520;
4881  w[25] = 0.010551372617343007155651187685;
4882  }
4883  else if (n==27) {
4884  w[ 0] = 0.0097989960512943602611500550912;
4885  w[ 1] = 0.022686231596180623196034206447;
4886  w[ 2] = 0.035297053757419711022578289305;
4887  w[ 3] = 0.047449412520615062704096710114;
4888  w[ 4] = 0.058983536859833599110300833720;
4889  w[ 5] = 0.069748823766245592984322888357;
4890  w[ 6] = 0.079604867773057771263074959010;
4891  w[ 7] = 0.088423158543756950194322802854;
4892  w[ 8] = 0.096088727370028507565652646558;
4893  w[ 9] = 0.102501637817745798671247711533;
4894  w[10] = 0.107578285788533187212162984427;
4895  w[11] = 0.111252488356845192672163096043;
4896  w[12] = 0.113476346108965148620369948092;
4897  w[13] = 0.11422086737895698904504573690;
4898  w[14] = 0.113476346108965148620369948092;
4899  w[15] = 0.111252488356845192672163096043;
4900  w[16] = 0.107578285788533187212162984427;
4901  w[17] = 0.102501637817745798671247711533;
4902  w[18] = 0.096088727370028507565652646558;
4903  w[19] = 0.088423158543756950194322802854;
4904  w[20] = 0.079604867773057771263074959010;
4905  w[21] = 0.069748823766245592984322888357;
4906  w[22] = 0.058983536859833599110300833720;
4907  w[23] = 0.047449412520615062704096710114;
4908  w[24] = 0.035297053757419711022578289305;
4909  w[25] = 0.022686231596180623196034206447;
4910  w[26] = 0.0097989960512943602611500550912;
4911  }
4912  else if (n==28) {
4913  w[ 0] = 0.009124282593094517738816153923;
4914  w[ 1] = 0.021132112592771259751500380993;
4915  w[ 2] = 0.032901427782304379977630819171;
4916  w[ 3] = 0.044272934759004227839587877653;
4917  w[ 4] = 0.055107345675716745431482918227;
4918  w[ 5] = 0.06527292396699959579339756678;
4919  w[ 6] = 0.07464621423456877902393188717;
4920  w[ 7] = 0.08311341722890121839039649824;
4921  w[ 8] = 0.09057174439303284094218603134;
4922  w[ 9] = 0.09693065799792991585048900610;
4923  w[10] = 0.10211296757806076981421663851;
4924  w[11] = 0.10605576592284641791041643700;
4925  w[12] = 0.10871119225829413525357151930;
4926  w[13] = 0.11004701301647519628237626560;
4927  w[14] = 0.11004701301647519628237626560;
4928  w[15] = 0.10871119225829413525357151930;
4929  w[16] = 0.10605576592284641791041643700;
4930  w[17] = 0.10211296757806076981421663851;
4931  w[18] = 0.09693065799792991585048900610;
4932  w[19] = 0.09057174439303284094218603134;
4933  w[20] = 0.08311341722890121839039649824;
4934  w[21] = 0.07464621423456877902393188717;
4935  w[22] = 0.06527292396699959579339756678;
4936  w[23] = 0.055107345675716745431482918227;
4937  w[24] = 0.044272934759004227839587877653;
4938  w[25] = 0.032901427782304379977630819171;
4939  w[26] = 0.021132112592771259751500380993;
4940  w[27] = 0.009124282593094517738816153923;
4941  }
4942  else if (n==29) {
4943  w[ 0] = 0.0085169038787464096542638133022;
4944  w[ 1] = 0.019732085056122705983859801640;
4945  w[ 2] = 0.030740492202093622644408525375;
4946  w[ 3] = 0.041402062518682836104830010114;
4947  w[ 4] = 0.051594826902497923912594381180;
4948  w[ 5] = 0.061203090657079138542109848024;
4949  w[ 6] = 0.070117933255051278569581486949;
4950  w[ 7] = 0.078238327135763783828144888660;
4951  w[ 8] = 0.085472257366172527545344849297;
4952  w[ 9] = 0.091737757139258763347966411077;
4953  w[10] = 0.096963834094408606301900074883;
4954  w[11] = 0.101091273759914966121820546907;
4955  w[12] = 0.104073310077729373913328471285;
4956  w[13] = 0.105876155097320941406591327852;
4957  w[14] = 0.10647938171831424424651112691;
4958  w[15] = 0.105876155097320941406591327852;
4959  w[16] = 0.104073310077729373913328471285;
4960  w[17] = 0.101091273759914966121820546907;
4961  w[18] = 0.096963834094408606301900074883;
4962  w[19] = 0.091737757139258763347966411077;
4963  w[20] = 0.085472257366172527545344849297;
4964  w[21] = 0.078238327135763783828144888660;
4965  w[22] = 0.070117933255051278569581486949;
4966  w[23] = 0.061203090657079138542109848024;
4967  w[24] = 0.051594826902497923912594381180;
4968  w[25] = 0.041402062518682836104830010114;
4969  w[26] = 0.030740492202093622644408525375;
4970  w[27] = 0.019732085056122705983859801640;
4971  w[28] = 0.0085169038787464096542638133022;
4972  }
4973  else if (n==30) {
4974  w[ 0] = 0.007968192496166605615465883475;
4975  w[ 1] = 0.018466468311090959142302131912;
4976  w[ 2] = 0.028784707883323369349719179611;
4977  w[ 3] = 0.038799192569627049596801936446;
4978  w[ 4] = 0.048402672830594052902938140423;
4979  w[ 5] = 0.057493156217619066481721689402;
4980  w[ 6] = 0.06597422988218049512812851512;
4981  w[ 7] = 0.07375597473770520626824385002;
4982  w[ 8] = 0.08075589522942021535469493846;
4983  w[ 9] = 0.08689978720108297980238753072;
4984  w[10] = 0.09212252223778612871763270709;
4985  w[11] = 0.09636873717464425963946862635;
4986  w[12] = 0.09959342058679526706278028210;
4987  w[13] = 0.10176238974840550459642895217;
4988  w[14] = 0.10285265289355884034128563671;
4989  w[15] = 0.10285265289355884034128563671;
4990  w[16] = 0.10176238974840550459642895217;
4991  w[17] = 0.09959342058679526706278028210;
4992  w[18] = 0.09636873717464425963946862635;
4993  w[19] = 0.09212252223778612871763270709;
4994  w[20] = 0.08689978720108297980238753072;
4995  w[21] = 0.08075589522942021535469493846;
4996  w[22] = 0.07375597473770520626824385002;
4997  w[23] = 0.06597422988218049512812851512;
4998  w[24] = 0.057493156217619066481721689402;
4999  w[25] = 0.048402672830594052902938140423;
5000  w[26] = 0.038799192569627049596801936446;
5001  w[27] = 0.028784707883323369349719179611;
5002  w[28] = 0.018466468311090959142302131912;
5003  w[29] = 0.007968192496166605615465883475;
5004  }
5005  else if (n==31) {
5006  w[ 0] = 0.0074708315792487758586968750322;
5007  w[ 1] = 0.017318620790310582463157996087;
5008  w[ 2] = 0.027009019184979421800608708092;
5009  w[ 3] = 0.036432273912385464024392010468;
5010  w[ 4] = 0.045493707527201102902315857895;
5011  w[ 5] = 0.054103082424916853711666259087;
5012  w[ 6] = 0.062174786561028426910343543687;
5013  w[ 7] = 0.069628583235410366167756126255;
5014  w[ 8] = 0.076390386598776616426357674901;
5015  w[ 9] = 0.082392991761589263903823367432;
5016  w[10] = 0.087576740608477876126198069695;
5017  w[11] = 0.091890113893641478215362871607;
5018  w[12] = 0.095290242912319512807204197488;
5019  w[13] = 0.097743335386328725093474010979;
5020  w[14] = 0.099225011226672307874875514429;
5021  w[15] = 0.09972054479342645142753383373;
5022  w[16] = 0.099225011226672307874875514429;
5023  w[17] = 0.097743335386328725093474010979;
5024  w[18] = 0.095290242912319512807204197488;
5025  w[19] = 0.091890113893641478215362871607;
5026  w[20] = 0.087576740608477876126198069695;
5027  w[21] = 0.082392991761589263903823367432;
5028  w[22] = 0.076390386598776616426357674901;
5029  w[23] = 0.069628583235410366167756126255;
5030  w[24] = 0.062174786561028426910343543687;
5031  w[25] = 0.054103082424916853711666259087;
5032  w[26] = 0.045493707527201102902315857895;
5033  w[27] = 0.036432273912385464024392010468;
5034  w[28] = 0.027009019184979421800608708092;
5035  w[29] = 0.017318620790310582463157996087;
5036  w[30] = 0.0074708315792487758586968750322;
5037  }
5038  else if (n==32) {
5039  w[ 0] = 0.007018610009470096600407063739;
5040  w[ 1] = 0.016274394730905670605170562206;
5041  w[ 2] = 0.025392065309262059455752589789;
5042  w[ 3] = 0.034273862913021433102687732252;
5043  w[ 4] = 0.042835898022226680656878646606;
5044  w[ 5] = 0.050998059262376176196163244690;
5045  w[ 6] = 0.058684093478535547145283637300;
5046  w[ 7] = 0.06582222277636184683765006371;
5047  w[ 8] = 0.07234579410884850622539935648;
5048  w[ 9] = 0.07819389578707030647174091883;
5049  w[10] = 0.08331192422694675522219907460;
5050  w[11] = 0.08765209300440381114277146275;
5051  w[12] = 0.09117387869576388471286857711;
5052  w[13] = 0.09384439908080456563918023767;
5053  w[14] = 0.09563872007927485941908200220;
5054  w[15] = 0.09654008851472780056676483006;
5055  w[16] = 0.09654008851472780056676483006;
5056  w[17] = 0.09563872007927485941908200220;
5057  w[18] = 0.09384439908080456563918023767;
5058  w[19] = 0.09117387869576388471286857711;
5059  w[20] = 0.08765209300440381114277146275;
5060  w[21] = 0.08331192422694675522219907460;
5061  w[22] = 0.07819389578707030647174091883;
5062  w[23] = 0.07234579410884850622539935648;
5063  w[24] = 0.06582222277636184683765006371;
5064  w[25] = 0.058684093478535547145283637300;
5065  w[26] = 0.050998059262376176196163244690;
5066  w[27] = 0.042835898022226680656878646606;
5067  w[28] = 0.034273862913021433102687732252;
5068  w[29] = 0.025392065309262059455752589789;
5069  w[30] = 0.016274394730905670605170562206;
5070  w[31] = 0.007018610009470096600407063739;
5071  }
5072  else if (n==33) {
5073  w[ 0] = 0.0066062278475873780586492352085;
5074  w[ 1] = 0.015321701512934676127945768534;
5075  w[ 2] = 0.023915548101749480350533257529;
5076  w[ 3] = 0.032300358632328953281561447250;
5077  w[ 4] = 0.040401541331669591563409790527;
5078  w[ 5] = 0.048147742818711695670146880138;
5079  w[ 6] = 0.055470846631663561284944495439;
5080  w[ 7] = 0.062306482530317480031627725771;
5081  w[ 8] = 0.068594572818656712805955073015;
5082  w[ 9] = 0.074279854843954149342472175919;
5083  w[10] = 0.079312364794886738363908384942;
5084  w[11] = 0.083647876067038707613928014518;
5085  w[12] = 0.087248287618844337607281670945;
5086  w[13] = 0.090081958660638577239743705500;
5087  w[14] = 0.092123986643316846213240977717;
5088  w[15] = 0.093356426065596116160999126274;
5089  w[16] = 0.09376844616020999656730454155;
5090  w[17] = 0.093356426065596116160999126274;
5091  w[18] = 0.092123986643316846213240977717;
5092  w[19] = 0.090081958660638577239743705500;
5093  w[20] = 0.087248287618844337607281670945;
5094  w[21] = 0.083647876067038707613928014518;
5095  w[22] = 0.079312364794886738363908384942;
5096  w[23] = 0.074279854843954149342472175919;
5097  w[24] = 0.068594572818656712805955073015;
5098  w[25] = 0.062306482530317480031627725771;
5099  w[26] = 0.055470846631663561284944495439;
5100  w[27] = 0.048147742818711695670146880138;
5101  w[28] = 0.040401541331669591563409790527;
5102  w[29] = 0.032300358632328953281561447250;
5103  w[30] = 0.023915548101749480350533257529;
5104  w[31] = 0.015321701512934676127945768534;
5105  w[32] = 0.0066062278475873780586492352085;
5106  }
5107  else {
5108  std::cerr << "\n";
5109  std::cerr << "LEGENDRE_LOOKUP_WEIGHTS - Fatal error!\n";
5110  std::cerr << " Illegal value of N = " << n << "\n";
5111  std::cerr << " Legal values are 1 through 33.\n";
5112  std::exit(1);
5113  }
5114  return;
5115 }
5116 
5117 //****************************************************************************
5118 template<class Real>
5119 void ROLBurkardtRules::patterson_lookup ( int n, Real x[], Real w[] )
5120 //****************************************************************************
5121 //
5122 // Purpose:
5123 //
5124 // PATTERSON_LOOKUP looks up Patterson quadrature points and weights.
5125 //
5126 // Discussion:
5127 //
5128 // Our convention is that the abscissas are numbered from left to right.
5129 //
5130 // The rule is defined on [-1,1],
5131 //
5132 // Licensing:
5133 //
5134 // This code is distributed under the GNU LGPL license.
5135 //
5136 // Modified:
5137 //
5138 // 11 February 2010
5139 //
5140 // Author:
5141 //
5142 // John Burkardt
5143 //
5144 // Reference:
5145 //
5146 // Prem Kythe, Michael Schaeferkotter,
5147 // Handbook of Computational Methods for Integration,
5148 // Chapman and Hall, 2004,
5149 // ISBN: 1-58488-428-2,
5150 // LC: QA299.3.K98.
5151 //
5152 // Thomas Patterson,
5153 // The Optimal Addition of Points to Quadrature Formulae,
5154 // Mathematics of Computation,
5155 // Volume 22, Number 104, October 1968, pages 847-856.
5156 //
5157 // Parameters:
5158 //
5159 // Input, int N, the order.
5160 // Legal values are 1, 3, 7, 15, 31, 63, 127 and 255.
5161 //
5162 // Output, Real X[N], the abscissas.
5163 //
5164 // Output, Real W[N], the weights.
5165 //
5166 {
5169 
5170  return;
5171 }
5172 
5173 //****************************************************************************
5174 template<class Real>
5176 //****************************************************************************
5177 //
5178 // Purpose:
5179 //
5180 // PATTERSON_LOOKUP_POINTS looks up Patterson quadrature points.
5181 //
5182 // Discussion:
5183 //
5184 // Our convention is that the abscissas are numbered from left to right.
5185 //
5186 // The rule is defined on [-1,1],
5187 //
5188 // Licensing:
5189 //
5190 // This code is distributed under the GNU LGPL license.
5191 //
5192 // Modified:
5193 //
5194 // 17 December 2009
5195 //
5196 // Author:
5197 //
5198 // John Burkardt
5199 //
5200 // Reference:
5201 //
5202 // Prem Kythe, Michael Schaeferkotter,
5203 // Handbook of Computational Methods for Integration,
5204 // Chapman and Hall, 2004,
5205 // ISBN: 1-58488-428-2,
5206 // LC: QA299.3.K98.
5207 //
5208 // Thomas Patterson,
5209 // The Optimal Addition of Points to Quadrature Formulae,
5210 // Mathematics of Computation,
5211 // Volume 22, Number 104, October 1968, pages 847-856.
5212 //
5213 // Parameters:
5214 //
5215 // Input, int N, the order.
5216 // Legal values are 1, 3, 7, 15, 31, 63, 127 and 255.
5217 //
5218 // Output, Real X[N], the abscissas.
5219 //
5220 {
5221  if (n==1) {
5222  x[ 0] = 0.0;
5223  }
5224  else if (n==3) {
5225  x[ 0] = -0.77459666924148337704;
5226  x[ 1] = 0.0;
5227  x[ 2] = 0.77459666924148337704;
5228  }
5229  else if (n==7) {
5230  x[ 0] = -0.96049126870802028342;
5231  x[ 1] = -0.77459666924148337704;
5232  x[ 2] = -0.43424374934680255800;
5233  x[ 3] = 0.0;
5234  x[ 4] = 0.43424374934680255800;
5235  x[ 5] = 0.77459666924148337704;
5236  x[ 6] = 0.96049126870802028342;
5237  }
5238  else if (n==15) {
5239  x[ 0] = -0.99383196321275502221;
5240  x[ 1] = -0.96049126870802028342;
5241  x[ 2] = -0.88845923287225699889;
5242  x[ 3] = -0.77459666924148337704;
5243  x[ 4] = -0.62110294673722640294;
5244  x[ 5] = -0.43424374934680255800;
5245  x[ 6] = -0.22338668642896688163;
5246  x[ 7] = 0.0;
5247  x[ 8] = 0.22338668642896688163;
5248  x[ 9] = 0.43424374934680255800;
5249  x[10] = 0.62110294673722640294;
5250  x[11] = 0.77459666924148337704;
5251  x[12] = 0.88845923287225699889;
5252  x[13] = 0.96049126870802028342;
5253  x[14] = 0.99383196321275502221;
5254  }
5255  else if (n==31) {
5256  x[ 0] = -0.99909812496766759766;
5257  x[ 1] = -0.99383196321275502221;
5258  x[ 2] = -0.98153114955374010687;
5259  x[ 3] = -0.96049126870802028342;
5260  x[ 4] = -0.92965485742974005667;
5261  x[ 5] = -0.88845923287225699889;
5262  x[ 6] = -0.83672593816886873550;
5263  x[ 7] = -0.77459666924148337704;
5264  x[ 8] = -0.70249620649152707861;
5265  x[ 9] = -0.62110294673722640294;
5266  x[10] = -0.53131974364437562397;
5267  x[11] = -0.43424374934680255800;
5268  x[12] = -0.33113539325797683309;
5269  x[13] = -0.22338668642896688163;
5270  x[14] = -0.11248894313318662575;
5271  x[15] = 0.0;
5272  x[16] = 0.11248894313318662575;
5273  x[17] = 0.22338668642896688163;
5274  x[18] = 0.33113539325797683309;
5275  x[19] = 0.43424374934680255800;
5276  x[20] = 0.53131974364437562397;
5277  x[21] = 0.62110294673722640294;
5278  x[22] = 0.70249620649152707861;
5279  x[23] = 0.77459666924148337704;
5280  x[24] = 0.83672593816886873550;
5281  x[25] = 0.88845923287225699889;
5282  x[26] = 0.92965485742974005667;
5283  x[27] = 0.96049126870802028342;
5284  x[28] = 0.98153114955374010687;
5285  x[29] = 0.99383196321275502221;
5286  x[30] = 0.99909812496766759766;
5287  }
5288  else if (n==63) {
5289  x[ 0] = -0.99987288812035761194;
5290  x[ 1] = -0.99909812496766759766;
5291  x[ 2] = -0.99720625937222195908;
5292  x[ 3] = -0.99383196321275502221;
5293  x[ 4] = -0.98868475754742947994;
5294  x[ 5] = -0.98153114955374010687;
5295  x[ 6] = -0.97218287474858179658;
5296  x[ 7] = -0.96049126870802028342;
5297  x[ 8] = -0.94634285837340290515;
5298  x[ 9] = -0.92965485742974005667;
5299  x[10] = -0.91037115695700429250;
5300  x[11] = -0.88845923287225699889;
5301  x[12] = -0.86390793819369047715;
5302  x[13] = -0.83672593816886873550;
5303  x[14] = -0.80694053195021761186;
5304  x[15] = -0.77459666924148337704;
5305  x[16] = -0.73975604435269475868;
5306  x[17] = -0.70249620649152707861;
5307  x[18] = -0.66290966002478059546;
5308  x[19] = -0.62110294673722640294;
5309  x[20] = -0.57719571005204581484;
5310  x[21] = -0.53131974364437562397;
5311  x[22] = -0.48361802694584102756;
5312  x[23] = -0.43424374934680255800;
5313  x[24] = -0.38335932419873034692;
5314  x[25] = -0.33113539325797683309;
5315  x[26] = -0.27774982202182431507;
5316  x[27] = -0.22338668642896688163;
5317  x[28] = -0.16823525155220746498;
5318  x[29] = -0.11248894313318662575;
5319  x[30] = -0.056344313046592789972;
5320  x[31] = 0.0;
5321  x[32] = 0.056344313046592789972;
5322  x[33] = 0.11248894313318662575;
5323  x[34] = 0.16823525155220746498;
5324  x[35] = 0.22338668642896688163;
5325  x[36] = 0.27774982202182431507;
5326  x[37] = 0.33113539325797683309;
5327  x[38] = 0.38335932419873034692;
5328  x[39] = 0.43424374934680255800;
5329  x[40] = 0.48361802694584102756;
5330  x[41] = 0.53131974364437562397;
5331  x[42] = 0.57719571005204581484;
5332  x[43] = 0.62110294673722640294;
5333  x[44] = 0.66290966002478059546;
5334  x[45] = 0.70249620649152707861;
5335  x[46] = 0.73975604435269475868;
5336  x[47] = 0.77459666924148337704;
5337  x[48] = 0.80694053195021761186;
5338  x[49] = 0.83672593816886873550;
5339  x[50] = 0.86390793819369047715;
5340  x[51] = 0.88845923287225699889;
5341  x[52] = 0.91037115695700429250;
5342  x[53] = 0.92965485742974005667;
5343  x[54] = 0.94634285837340290515;
5344  x[55] = 0.96049126870802028342;
5345  x[56] = 0.97218287474858179658;
5346  x[57] = 0.98153114955374010687;
5347  x[58] = 0.98868475754742947994;
5348  x[59] = 0.99383196321275502221;
5349  x[60] = 0.99720625937222195908;
5350  x[61] = 0.99909812496766759766;
5351  x[62] = 0.99987288812035761194;
5352  }
5353  else if (n==127) {
5354  x[ 0] = -0.99998243035489159858;
5355  x[ 1] = -0.99987288812035761194;
5356  x[ 2] = -0.99959879967191068325;
5357  x[ 3] = -0.99909812496766759766;
5358  x[ 4] = -0.99831663531840739253;
5359  x[ 5] = -0.99720625937222195908;
5360  x[ 6] = -0.99572410469840718851;
5361  x[ 7] = -0.99383196321275502221;
5362  x[ 8] = -0.99149572117810613240;
5363  x[ 9] = -0.98868475754742947994;
5364  x[ 10] = -0.98537149959852037111;
5365  x[ 11] = -0.98153114955374010687;
5366  x[ 12] = -0.97714151463970571416;
5367  x[ 13] = -0.97218287474858179658;
5368  x[ 14] = -0.96663785155841656709;
5369  x[ 15] = -0.96049126870802028342;
5370  x[ 16] = -0.95373000642576113641;
5371  x[ 17] = -0.94634285837340290515;
5372  x[ 18] = -0.93832039777959288365;
5373  x[ 19] = -0.92965485742974005667;
5374  x[ 20] = -0.92034002547001242073;
5375  x[ 21] = -0.91037115695700429250;
5376  x[ 22] = -0.89974489977694003664;
5377  x[ 23] = -0.88845923287225699889;
5378  x[ 24] = -0.87651341448470526974;
5379  x[ 25] = -0.86390793819369047715;
5380  x[ 26] = -0.85064449476835027976;
5381  x[ 27] = -0.83672593816886873550;
5382  x[ 28] = -0.82215625436498040737;
5383  x[ 29] = -0.80694053195021761186;
5384  x[ 30] = -0.79108493379984836143;
5385  x[ 31] = -0.77459666924148337704;
5386  x[ 32] = -0.75748396638051363793;
5387  x[ 33] = -0.73975604435269475868;
5388  x[ 34] = -0.72142308537009891548;
5389  x[ 35] = -0.70249620649152707861;
5390  x[ 36] = -0.68298743109107922809;
5391  x[ 37] = -0.66290966002478059546;
5392  x[ 38] = -0.64227664250975951377;
5393  x[ 39] = -0.62110294673722640294;
5394  x[ 40] = -0.59940393024224289297;
5395  x[ 41] = -0.57719571005204581484;
5396  x[ 42] = -0.55449513263193254887;
5397  x[ 43] = -0.53131974364437562397;
5398  x[ 44] = -0.50768775753371660215;
5399  x[ 45] = -0.48361802694584102756;
5400  x[ 46] = -0.45913001198983233287;
5401  x[ 47] = -0.43424374934680255800;
5402  x[ 48] = -0.40897982122988867241;
5403  x[ 49] = -0.38335932419873034692;
5404  x[ 50] = -0.35740383783153215238;
5405  x[ 51] = -0.33113539325797683309;
5406  x[ 52] = -0.30457644155671404334;
5407  x[ 53] = -0.27774982202182431507;
5408  x[ 54] = -0.25067873030348317661;
5409  x[ 55] = -0.22338668642896688163;
5410  x[ 56] = -0.19589750271110015392;
5411  x[ 57] = -0.16823525155220746498;
5412  x[ 58] = -0.14042423315256017459;
5413  x[ 59] = -0.11248894313318662575;
5414  x[ 60] = -0.084454040083710883710;
5415  x[ 61] = -0.056344313046592789972;
5416  x[ 62] = -0.028184648949745694339;
5417  x[ 63] = 0.0;
5418  x[ 64] = 0.028184648949745694339;
5419  x[ 65] = 0.056344313046592789972;
5420  x[ 66] = 0.084454040083710883710;
5421  x[ 67] = 0.11248894313318662575;
5422  x[ 68] = 0.14042423315256017459;
5423  x[ 69] = 0.16823525155220746498;
5424  x[ 70] = 0.19589750271110015392;
5425  x[ 71] = 0.22338668642896688163;
5426  x[ 72] = 0.25067873030348317661;
5427  x[ 73] = 0.27774982202182431507;
5428  x[ 74] = 0.30457644155671404334;
5429  x[ 75] = 0.33113539325797683309;
5430  x[ 76] = 0.35740383783153215238;
5431  x[ 77] = 0.38335932419873034692;
5432  x[ 78] = 0.40897982122988867241;
5433  x[ 79] = 0.43424374934680255800;
5434  x[ 80] = 0.45913001198983233287;
5435  x[ 81] = 0.48361802694584102756;
5436  x[ 82] = 0.50768775753371660215;
5437  x[ 83] = 0.53131974364437562397;
5438  x[ 84] = 0.55449513263193254887;
5439  x[ 85] = 0.57719571005204581484;
5440  x[ 86] = 0.59940393024224289297;
5441  x[ 87] = 0.62110294673722640294;
5442  x[ 88] = 0.64227664250975951377;
5443  x[ 89] = 0.66290966002478059546;
5444  x[ 90] = 0.68298743109107922809;
5445  x[ 91] = 0.70249620649152707861;
5446  x[ 92] = 0.72142308537009891548;
5447  x[ 93] = 0.73975604435269475868;
5448  x[ 94] = 0.75748396638051363793;
5449  x[ 95] = 0.77459666924148337704;
5450  x[ 96] = 0.79108493379984836143;
5451  x[ 97] = 0.80694053195021761186;
5452  x[ 98] = 0.82215625436498040737;
5453  x[ 99] = 0.83672593816886873550;
5454  x[100] = 0.85064449476835027976;
5455  x[101] = 0.86390793819369047715;
5456  x[102] = 0.87651341448470526974;
5457  x[103] = 0.88845923287225699889;
5458  x[104] = 0.89974489977694003664;
5459  x[105] = 0.91037115695700429250;
5460  x[106] = 0.92034002547001242073;
5461  x[107] = 0.92965485742974005667;
5462  x[108] = 0.93832039777959288365;
5463  x[109] = 0.94634285837340290515;
5464  x[110] = 0.95373000642576113641;
5465  x[111] = 0.96049126870802028342;
5466  x[112] = 0.96663785155841656709;
5467  x[113] = 0.97218287474858179658;
5468  x[114] = 0.97714151463970571416;
5469  x[115] = 0.98153114955374010687;
5470  x[116] = 0.98537149959852037111;
5471  x[117] = 0.98868475754742947994;
5472  x[118] = 0.99149572117810613240;
5473  x[119] = 0.99383196321275502221;
5474  x[120] = 0.99572410469840718851;
5475  x[121] = 0.99720625937222195908;
5476  x[122] = 0.99831663531840739253;
5477  x[123] = 0.99909812496766759766;
5478  x[124] = 0.99959879967191068325;
5479  x[125] = 0.99987288812035761194;
5480  x[126] = 0.99998243035489159858;
5481  }
5482  else if (n==255) {
5483  x[ 0] = -0.99999759637974846462;
5484  x[ 1] = -0.99998243035489159858;
5485  x[ 2] = -0.99994399620705437576;
5486  x[ 3] = -0.99987288812035761194;
5487  x[ 4] = -0.99976049092443204733;
5488  x[ 5] = -0.99959879967191068325;
5489  x[ 6] = -0.99938033802502358193;
5490  x[ 7] = -0.99909812496766759766;
5491  x[ 8] = -0.99874561446809511470;
5492  x[ 9] = -0.99831663531840739253;
5493  x[ 10] = -0.99780535449595727456;
5494  x[ 11] = -0.99720625937222195908;
5495  x[ 12] = -0.99651414591489027385;
5496  x[ 13] = -0.99572410469840718851;
5497  x[ 14] = -0.99483150280062100052;
5498  x[ 15] = -0.99383196321275502221;
5499  x[ 16] = -0.99272134428278861533;
5500  x[ 17] = -0.99149572117810613240;
5501  x[ 18] = -0.99015137040077015918;
5502  x[ 19] = -0.98868475754742947994;
5503  x[ 20] = -0.98709252795403406719;
5504  x[ 21] = -0.98537149959852037111;
5505  x[ 22] = -0.98351865757863272876;
5506  x[ 23] = -0.98153114955374010687;
5507  x[ 24] = -0.97940628167086268381;
5508  x[ 25] = -0.97714151463970571416;
5509  x[ 26] = -0.97473445975240266776;
5510  x[ 27] = -0.97218287474858179658;
5511  x[ 28] = -0.96948465950245923177;
5512  x[ 29] = -0.96663785155841656709;
5513  x[ 30] = -0.96364062156981213252;
5514  x[ 31] = -0.96049126870802028342;
5515  x[ 32] = -0.95718821610986096274;
5516  x[ 33] = -0.95373000642576113641;
5517  x[ 34] = -0.95011529752129487656;
5518  x[ 35] = -0.94634285837340290515;
5519  x[ 36] = -0.94241156519108305981;
5520  x[ 37] = -0.93832039777959288365;
5521  x[ 38] = -0.93406843615772578800;
5522  x[ 39] = -0.92965485742974005667;
5523  x[ 40] = -0.92507893290707565236;
5524  x[ 41] = -0.92034002547001242073;
5525  x[ 42] = -0.91543758715576504064;
5526  x[ 43] = -0.91037115695700429250;
5527  x[ 44] = -0.90514035881326159519;
5528  x[ 45] = -0.89974489977694003664;
5529  x[ 46] = -0.89418456833555902286;
5530  x[ 47] = -0.88845923287225699889;
5531  x[ 48] = -0.88256884024734190684;
5532  x[ 49] = -0.87651341448470526974;
5533  x[ 50] = -0.87029305554811390585;
5534  x[ 51] = -0.86390793819369047715;
5535  x[ 52] = -0.85735831088623215653;
5536  x[ 53] = -0.85064449476835027976;
5537  x[ 54] = -0.84376688267270860104;
5538  x[ 55] = -0.83672593816886873550;
5539  x[ 56] = -0.82952219463740140018;
5540  x[ 57] = -0.82215625436498040737;
5541  x[ 58] = -0.81462878765513741344;
5542  x[ 59] = -0.80694053195021761186;
5543  x[ 60] = -0.79909229096084140180;
5544  x[ 61] = -0.79108493379984836143;
5545  x[ 62] = -0.78291939411828301639;
5546  x[ 63] = -0.77459666924148337704;
5547  x[ 64] = -0.76611781930376009072;
5548  x[ 65] = -0.75748396638051363793;
5549  x[ 66] = -0.74869629361693660282;
5550  x[ 67] = -0.73975604435269475868;
5551  x[ 68] = -0.73066452124218126133;
5552  x[ 69] = -0.72142308537009891548;
5553  x[ 70] = -0.71203315536225203459;
5554  x[ 71] = -0.70249620649152707861;
5555  x[ 72] = -0.69281376977911470289;
5556  x[ 73] = -0.68298743109107922809;
5557  x[ 74] = -0.67301883023041847920;
5558  x[ 75] = -0.66290966002478059546;
5559  x[ 76] = -0.65266166541001749610;
5560  x[ 77] = -0.64227664250975951377;
5561  x[ 78] = -0.63175643771119423041;
5562  x[ 79] = -0.62110294673722640294;
5563  x[ 80] = -0.61031811371518640016;
5564  x[ 81] = -0.59940393024224289297;
5565  x[ 82] = -0.58836243444766254143;
5566  x[ 83] = -0.57719571005204581484;
5567  x[ 84] = -0.56590588542365442262;
5568  x[ 85] = -0.55449513263193254887;
5569  x[ 86] = -0.54296566649831149049;
5570  x[ 87] = -0.53131974364437562397;
5571  x[ 88] = -0.51955966153745702199;
5572  x[ 89] = -0.50768775753371660215;
5573  x[ 90] = -0.49570640791876146017;
5574  x[ 91] = -0.48361802694584102756;
5575  x[ 92] = -0.47142506587165887693;
5576  x[ 93] = -0.45913001198983233287;
5577  x[ 94] = -0.44673538766202847374;
5578  x[ 95] = -0.43424374934680255800;
5579  x[ 96] = -0.42165768662616330006;
5580  x[ 97] = -0.40897982122988867241;
5581  x[ 98] = -0.39621280605761593918;
5582  x[ 99] = -0.38335932419873034692;
5583  x[100] = -0.37042208795007823014;
5584  x[101] = -0.35740383783153215238;
5585  x[102] = -0.34430734159943802278;
5586  x[103] = -0.33113539325797683309;
5587  x[104] = -0.31789081206847668318;
5588  x[105] = -0.30457644155671404334;
5589  x[106] = -0.29119514851824668196;
5590  x[107] = -0.27774982202182431507;
5591  x[108] = -0.26424337241092676194;
5592  x[109] = -0.25067873030348317661;
5593  x[110] = -0.23705884558982972721;
5594  x[111] = -0.22338668642896688163;
5595  x[112] = -0.20966523824318119477;
5596  x[113] = -0.19589750271110015392;
5597  x[114] = -0.18208649675925219825;
5598  x[115] = -0.16823525155220746498;
5599  x[116] = -0.15434681148137810869;
5600  x[117] = -0.14042423315256017459;
5601  x[118] = -0.12647058437230196685;
5602  x[119] = -0.11248894313318662575;
5603  x[120] = -0.098482396598119202090;
5604  x[121] = -0.084454040083710883710;
5605  x[122] = -0.070406976042855179063;
5606  x[123] = -0.056344313046592789972;
5607  x[124] = -0.042269164765363603212;
5608  x[125] = -0.028184648949745694339;
5609  x[126] = -0.014093886410782462614;
5610  x[127] = 0.0;
5611  x[128] = 0.014093886410782462614;
5612  x[129] = 0.028184648949745694339;
5613  x[130] = 0.042269164765363603212;
5614  x[131] = 0.056344313046592789972;
5615  x[132] = 0.070406976042855179063;
5616  x[133] = 0.084454040083710883710;
5617  x[134] = 0.098482396598119202090;
5618  x[135] = 0.11248894313318662575;
5619  x[136] = 0.12647058437230196685;
5620  x[137] = 0.14042423315256017459;
5621  x[138] = 0.15434681148137810869;
5622  x[139] = 0.16823525155220746498;
5623  x[140] = 0.18208649675925219825;
5624  x[141] = 0.19589750271110015392;
5625  x[142] = 0.20966523824318119477;
5626  x[143] = 0.22338668642896688163;
5627  x[144] = 0.23705884558982972721;
5628  x[145] = 0.25067873030348317661;
5629  x[146] = 0.26424337241092676194;
5630  x[147] = 0.27774982202182431507;
5631  x[148] = 0.29119514851824668196;
5632  x[149] = 0.30457644155671404334;
5633  x[150] = 0.31789081206847668318;
5634  x[151] = 0.33113539325797683309;
5635  x[152] = 0.34430734159943802278;
5636  x[153] = 0.35740383783153215238;
5637  x[154] = 0.37042208795007823014;
5638  x[155] = 0.38335932419873034692;
5639  x[156] = 0.39621280605761593918;
5640  x[157] = 0.40897982122988867241;
5641  x[158] = 0.42165768662616330006;
5642  x[159] = 0.43424374934680255800;
5643  x[160] = 0.44673538766202847374;
5644  x[161] = 0.45913001198983233287;
5645  x[162] = 0.47142506587165887693;
5646  x[163] = 0.48361802694584102756;
5647  x[164] = 0.49570640791876146017;
5648  x[165] = 0.50768775753371660215;
5649  x[166] = 0.51955966153745702199;
5650  x[167] = 0.53131974364437562397;
5651  x[168] = 0.54296566649831149049;
5652  x[169] = 0.55449513263193254887;
5653  x[170] = 0.56590588542365442262;
5654  x[171] = 0.57719571005204581484;
5655  x[172] = 0.58836243444766254143;
5656  x[173] = 0.59940393024224289297;
5657  x[174] = 0.61031811371518640016;
5658  x[175] = 0.62110294673722640294;
5659  x[176] = 0.63175643771119423041;
5660  x[177] = 0.64227664250975951377;
5661  x[178] = 0.65266166541001749610;
5662  x[179] = 0.66290966002478059546;
5663  x[180] = 0.67301883023041847920;
5664  x[181] = 0.68298743109107922809;
5665  x[182] = 0.69281376977911470289;
5666  x[183] = 0.70249620649152707861;
5667  x[184] = 0.71203315536225203459;
5668  x[185] = 0.72142308537009891548;
5669  x[186] = 0.73066452124218126133;
5670  x[187] = 0.73975604435269475868;
5671  x[188] = 0.74869629361693660282;
5672  x[189] = 0.75748396638051363793;
5673  x[190] = 0.76611781930376009072;
5674  x[191] = 0.77459666924148337704;
5675  x[192] = 0.78291939411828301639;
5676  x[193] = 0.79108493379984836143;
5677  x[194] = 0.79909229096084140180;
5678  x[195] = 0.80694053195021761186;
5679  x[196] = 0.81462878765513741344;
5680  x[197] = 0.82215625436498040737;
5681  x[198] = 0.82952219463740140018;
5682  x[199] = 0.83672593816886873550;
5683  x[200] = 0.84376688267270860104;
5684  x[201] = 0.85064449476835027976;
5685  x[202] = 0.85735831088623215653;
5686  x[203] = 0.86390793819369047715;
5687  x[204] = 0.87029305554811390585;
5688  x[205] = 0.87651341448470526974;
5689  x[206] = 0.88256884024734190684;
5690  x[207] = 0.88845923287225699889;
5691  x[208] = 0.89418456833555902286;
5692  x[209] = 0.89974489977694003664;
5693  x[210] = 0.90514035881326159519;
5694  x[211] = 0.91037115695700429250;
5695  x[212] = 0.91543758715576504064;
5696  x[213] = 0.92034002547001242073;
5697  x[214] = 0.92507893290707565236;
5698  x[215] = 0.92965485742974005667;
5699  x[216] = 0.93406843615772578800;
5700  x[217] = 0.93832039777959288365;
5701  x[218] = 0.94241156519108305981;
5702  x[219] = 0.94634285837340290515;
5703  x[220] = 0.95011529752129487656;
5704  x[221] = 0.95373000642576113641;
5705  x[222] = 0.95718821610986096274;
5706  x[223] = 0.96049126870802028342;
5707  x[224] = 0.96364062156981213252;
5708  x[225] = 0.96663785155841656709;
5709  x[226] = 0.96948465950245923177;
5710  x[227] = 0.97218287474858179658;
5711  x[228] = 0.97473445975240266776;
5712  x[229] = 0.97714151463970571416;
5713  x[230] = 0.97940628167086268381;
5714  x[231] = 0.98153114955374010687;
5715  x[232] = 0.98351865757863272876;
5716  x[233] = 0.98537149959852037111;
5717  x[234] = 0.98709252795403406719;
5718  x[235] = 0.98868475754742947994;
5719  x[236] = 0.99015137040077015918;
5720  x[237] = 0.99149572117810613240;
5721  x[238] = 0.99272134428278861533;
5722  x[239] = 0.99383196321275502221;
5723  x[240] = 0.99483150280062100052;
5724  x[241] = 0.99572410469840718851;
5725  x[242] = 0.99651414591489027385;
5726  x[243] = 0.99720625937222195908;
5727  x[244] = 0.99780535449595727456;
5728  x[245] = 0.99831663531840739253;
5729  x[246] = 0.99874561446809511470;
5730  x[247] = 0.99909812496766759766;
5731  x[248] = 0.99938033802502358193;
5732  x[249] = 0.99959879967191068325;
5733  x[250] = 0.99976049092443204733;
5734  x[251] = 0.99987288812035761194;
5735  x[252] = 0.99994399620705437576;
5736  x[253] = 0.99998243035489159858;
5737  x[254] = 0.99999759637974846462;
5738  }
5739  else {
5740  std::cerr << "\n";
5741  std::cerr << "PATTERSON_LOOKUP_POINTS - Fatal error!\n";
5742  std::cerr << " Unexpected value of N = " << n << "\n";
5743  std::exit(1);
5744  }
5745  return;
5746 }
5747 
5748 //****************************************************************************
5749 template<class Real>
5751 //****************************************************************************
5752 //
5753 // Purpose:
5754 //
5755 // PATTERSON_LOOKUP_WEIGHTS looks up Patterson quadrature weights.
5756 //
5757 // Discussion:
5758 //
5759 // The allowed orders are 1, 3, 7, 15, 31, 63, 127 and 255.
5760 //
5761 // The weights are positive, symmetric and should sum to 2.
5762 //
5763 // The user must preallocate space for the output array W.
5764 //
5765 // Licensing:
5766 //
5767 // This code is distributed under the GNU LGPL license.
5768 //
5769 // Modified:
5770 //
5771 // 17 December 2009
5772 //
5773 // Author:
5774 //
5775 // John Burkardt
5776 //
5777 // Reference:
5778 //
5779 // Milton Abramowitz, Irene Stegun,
5780 // Handbook of Mathematical Functions,
5781 // National Bureau of Standards, 1964,
5782 // ISBN: 0-486-61272-4,
5783 // LC: QA47.A34.
5784 //
5785 // Arthur Stroud, Don Secrest,
5786 // Gaussian Quadrature Formulas,
5787 // Prentice Hall, 1966,
5788 // LC: QA299.4G3S7.
5789 //
5790 // Parameters:
5791 //
5792 // Input, int N, the order.
5793 // Legal values are 1, 3, 7, 15, 31, 63, 127 or 255.
5794 //
5795 // Output, Real W[N], the weights.
5796 //
5797 {
5798  if (n==1) {
5799  w[ 0] = 2.0;
5800  }
5801  else if (n==3) {
5802  w[ 0] = 0.555555555555555555556;
5803  w[ 1] = 0.888888888888888888889;
5804  w[ 2] = 0.555555555555555555556;
5805  }
5806  else if (n==7) {
5807  w[ 0] = 0.104656226026467265194;
5808  w[ 1] = 0.268488089868333440729;
5809  w[ 2] = 0.401397414775962222905;
5810  w[ 3] = 0.450916538658474142345;
5811  w[ 4] = 0.401397414775962222905;
5812  w[ 5] = 0.268488089868333440729;
5813  w[ 6] = 0.104656226026467265194;
5814  }
5815  else if (n==15) {
5816  w[ 0] = 0.0170017196299402603390;
5817  w[ 1] = 0.0516032829970797396969;
5818  w[ 2] = 0.0929271953151245376859;
5819  w[ 3] = 0.134415255243784220360;
5820  w[ 4] = 0.171511909136391380787;
5821  w[ 5] = 0.200628529376989021034;
5822  w[ 6] = 0.219156858401587496404;
5823  w[ 7] = 0.225510499798206687386;
5824  w[ 8] = 0.219156858401587496404;
5825  w[ 9] = 0.200628529376989021034;
5826  w[ 10] = 0.171511909136391380787;
5827  w[ 11] = 0.134415255243784220360;
5828  w[ 12] = 0.0929271953151245376859;
5829  w[ 13] = 0.0516032829970797396969;
5830  w[ 14] = 0.0170017196299402603390;
5831  }
5832  else if (n==31) {
5833  w[ 0] = 0.00254478079156187441540;
5834  w[ 1] = 0.00843456573932110624631;
5835  w[ 2] = 0.0164460498543878109338;
5836  w[ 3] = 0.0258075980961766535646;
5837  w[ 4] = 0.0359571033071293220968;
5838  w[ 5] = 0.0464628932617579865414;
5839  w[ 6] = 0.0569795094941233574122;
5840  w[ 7] = 0.0672077542959907035404;
5841  w[ 8] = 0.0768796204990035310427;
5842  w[ 9] = 0.0857559200499903511542;
5843  w[ 10] = 0.0936271099812644736167;
5844  w[ 11] = 0.100314278611795578771;
5845  w[ 12] = 0.105669893580234809744;
5846  w[ 13] = 0.109578421055924638237;
5847  w[ 14] = 0.111956873020953456880;
5848  w[ 15] = 0.112755256720768691607;
5849  w[ 16] = 0.111956873020953456880;
5850  w[ 17] = 0.109578421055924638237;
5851  w[ 18] = 0.105669893580234809744;
5852  w[ 19] = 0.100314278611795578771;
5853  w[ 20] = 0.0936271099812644736167;
5854  w[ 21] = 0.0857559200499903511542;
5855  w[ 22] = 0.0768796204990035310427;
5856  w[ 23] = 0.0672077542959907035404;
5857  w[ 24] = 0.0569795094941233574122;
5858  w[ 25] = 0.0464628932617579865414;
5859  w[ 26] = 0.0359571033071293220968;
5860  w[ 27] = 0.0258075980961766535646;
5861  w[ 28] = 0.0164460498543878109338;
5862  w[ 29] = 0.00843456573932110624631;
5863  w[ 30] = 0.00254478079156187441540;
5864  }
5865  else if (n==63) {
5866  w[ 0] = 0.000363221481845530659694;
5867  w[ 1] = 0.00126515655623006801137;
5868  w[ 2] = 0.00257904979468568827243;
5869  w[ 3] = 0.00421763044155885483908;
5870  w[ 4] = 0.00611550682211724633968;
5871  w[ 5] = 0.00822300795723592966926;
5872  w[ 6] = 0.0104982469096213218983;
5873  w[ 7] = 0.0129038001003512656260;
5874  w[ 8] = 0.0154067504665594978021;
5875  w[ 9] = 0.0179785515681282703329;
5876  w[ 10] = 0.0205942339159127111492;
5877  w[ 11] = 0.0232314466399102694433;
5878  w[ 12] = 0.0258696793272147469108;
5879  w[ 13] = 0.0284897547458335486125;
5880  w[ 14] = 0.0310735511116879648799;
5881  w[ 15] = 0.0336038771482077305417;
5882  w[ 16] = 0.0360644327807825726401;
5883  w[ 17] = 0.0384398102494555320386;
5884  w[ 18] = 0.0407155101169443189339;
5885  w[ 19] = 0.0428779600250077344929;
5886  w[ 20] = 0.0449145316536321974143;
5887  w[ 21] = 0.0468135549906280124026;
5888  w[ 22] = 0.0485643304066731987159;
5889  w[ 23] = 0.0501571393058995374137;
5890  w[ 24] = 0.0515832539520484587768;
5891  w[ 25] = 0.0528349467901165198621;
5892  w[ 26] = 0.0539054993352660639269;
5893  w[ 27] = 0.0547892105279628650322;
5894  w[ 28] = 0.0554814043565593639878;
5895  w[ 29] = 0.0559784365104763194076;
5896  w[ 30] = 0.0562776998312543012726;
5897  w[ 31] = 0.0563776283603847173877;
5898  w[ 32] = 0.0562776998312543012726;
5899  w[ 33] = 0.0559784365104763194076;
5900  w[ 34] = 0.0554814043565593639878;
5901  w[ 35] = 0.0547892105279628650322;
5902  w[ 36] = 0.0539054993352660639269;
5903  w[ 37] = 0.0528349467901165198621;
5904  w[ 38] = 0.0515832539520484587768;
5905  w[ 39] = 0.0501571393058995374137;
5906  w[ 40] = 0.0485643304066731987159;
5907  w[ 41] = 0.0468135549906280124026;
5908  w[ 42] = 0.0449145316536321974143;
5909  w[ 43] = 0.0428779600250077344929;
5910  w[ 44] = 0.0407155101169443189339;
5911  w[ 45] = 0.0384398102494555320386;
5912  w[ 46] = 0.0360644327807825726401;
5913  w[ 47] = 0.0336038771482077305417;
5914  w[ 48] = 0.0310735511116879648799;
5915  w[ 49] = 0.0284897547458335486125;
5916  w[ 50] = 0.0258696793272147469108;
5917  w[ 51] = 0.0232314466399102694433;
5918  w[ 52] = 0.0205942339159127111492;
5919  w[ 53] = 0.0179785515681282703329;
5920  w[ 54] = 0.0154067504665594978021;
5921  w[ 55] = 0.0129038001003512656260;
5922  w[ 56] = 0.0104982469096213218983;
5923  w[ 57] = 0.00822300795723592966926;
5924  w[ 58] = 0.00611550682211724633968;
5925  w[ 59] = 0.00421763044155885483908;
5926  w[ 60] = 0.00257904979468568827243;
5927  w[ 61] = 0.00126515655623006801137;
5928  w[ 62] = 0.000363221481845530659694;
5929  }
5930  else if (n==127) {
5931  w[ 0] = 0.0000505360952078625176247;
5932  w[ 1] = 0.000180739564445388357820;
5933  w[ 2] = 0.000377746646326984660274;
5934  w[ 3] = 0.000632607319362633544219;
5935  w[ 4] = 0.000938369848542381500794;
5936  w[ 5] = 0.00128952408261041739210;
5937  w[ 6] = 0.00168114286542146990631;
5938  w[ 7] = 0.00210881524572663287933;
5939  w[ 8] = 0.00256876494379402037313;
5940  w[ 9] = 0.00305775341017553113613;
5941  w[ 10] = 0.00357289278351729964938;
5942  w[ 11] = 0.00411150397865469304717;
5943  w[ 12] = 0.00467105037211432174741;
5944  w[ 13] = 0.00524912345480885912513;
5945  w[ 14] = 0.00584344987583563950756;
5946  w[ 15] = 0.00645190005017573692280;
5947  w[ 16] = 0.00707248999543355546805;
5948  w[ 17] = 0.00770337523327974184817;
5949  w[ 18] = 0.00834283875396815770558;
5950  w[ 19] = 0.00898927578406413572328;
5951  w[ 20] = 0.00964117772970253669530;
5952  w[ 21] = 0.0102971169579563555237;
5953  w[ 22] = 0.0109557333878379016480;
5954  w[ 23] = 0.0116157233199551347270;
5955  w[ 24] = 0.0122758305600827700870;
5956  w[ 25] = 0.0129348396636073734547;
5957  w[ 26] = 0.0135915710097655467896;
5958  w[ 27] = 0.0142448773729167743063;
5959  w[ 28] = 0.0148936416648151820348;
5960  w[ 29] = 0.0155367755558439824399;
5961  w[ 30] = 0.0161732187295777199419;
5962  w[ 31] = 0.0168019385741038652709;
5963  w[ 32] = 0.0174219301594641737472;
5964  w[ 33] = 0.0180322163903912863201;
5965  w[ 34] = 0.0186318482561387901863;
5966  w[ 35] = 0.0192199051247277660193;
5967  w[ 36] = 0.0197954950480974994880;
5968  w[ 37] = 0.0203577550584721594669;
5969  w[ 38] = 0.0209058514458120238522;
5970  w[ 39] = 0.0214389800125038672465;
5971  w[ 40] = 0.0219563663053178249393;
5972  w[ 41] = 0.0224572658268160987071;
5973  w[ 42] = 0.0229409642293877487608;
5974  w[ 43] = 0.0234067774953140062013;
5975  w[ 44] = 0.0238540521060385400804;
5976  w[ 45] = 0.0242821652033365993580;
5977  w[ 46] = 0.0246905247444876769091;
5978  w[ 47] = 0.0250785696529497687068;
5979  w[ 48] = 0.0254457699654647658126;
5980  w[ 49] = 0.0257916269760242293884;
5981  w[ 50] = 0.0261156733767060976805;
5982  w[ 51] = 0.0264174733950582599310;
5983  w[ 52] = 0.0266966229274503599062;
5984  w[ 53] = 0.0269527496676330319634;
5985  w[ 54] = 0.0271855132296247918192;
5986  w[ 55] = 0.0273946052639814325161;
5987  w[ 56] = 0.0275797495664818730349;
5988  w[ 57] = 0.0277407021782796819939;
5989  w[ 58] = 0.0278772514766137016085;
5990  w[ 59] = 0.0279892182552381597038;
5991  w[ 60] = 0.0280764557938172466068;
5992  w[ 61] = 0.0281388499156271506363;
5993  w[ 62] = 0.0281763190330166021307;
5994  w[ 63] = 0.0281888141801923586938;
5995  w[ 64] = 0.0281763190330166021307;
5996  w[ 65] = 0.0281388499156271506363;
5997  w[ 66] = 0.0280764557938172466068;
5998  w[ 67] = 0.0279892182552381597038;
5999  w[ 68] = 0.0278772514766137016085;
6000  w[ 69] = 0.0277407021782796819939;
6001  w[ 70] = 0.0275797495664818730349;
6002  w[ 71] = 0.0273946052639814325161;
6003  w[ 72] = 0.0271855132296247918192;
6004  w[ 73] = 0.0269527496676330319634;
6005  w[ 74] = 0.0266966229274503599062;
6006  w[ 75] = 0.0264174733950582599310;
6007  w[ 76] = 0.0261156733767060976805;
6008  w[ 77] = 0.0257916269760242293884;
6009  w[ 78] = 0.0254457699654647658126;
6010  w[ 79] = 0.0250785696529497687068;
6011  w[ 80] = 0.0246905247444876769091;
6012  w[ 81] = 0.0242821652033365993580;
6013  w[ 82] = 0.0238540521060385400804;
6014  w[ 83] = 0.0234067774953140062013;
6015  w[ 84] = 0.0229409642293877487608;
6016  w[ 85] = 0.0224572658268160987071;
6017  w[ 86] = 0.0219563663053178249393;
6018  w[ 87] = 0.0214389800125038672465;
6019  w[ 88] = 0.0209058514458120238522;
6020  w[ 89] = 0.0203577550584721594669;
6021  w[ 90] = 0.0197954950480974994880;
6022  w[ 91] = 0.0192199051247277660193;
6023  w[ 92] = 0.0186318482561387901863;
6024  w[ 93] = 0.0180322163903912863201;
6025  w[ 94] = 0.0174219301594641737472;
6026  w[ 95] = 0.0168019385741038652709;
6027  w[ 96] = 0.0161732187295777199419;
6028  w[ 97] = 0.0155367755558439824399;
6029  w[ 98] = 0.0148936416648151820348;
6030  w[ 99] = 0.0142448773729167743063;
6031  w[100] = 0.0135915710097655467896;
6032  w[101] = 0.0129348396636073734547;
6033  w[102] = 0.0122758305600827700870;
6034  w[103] = 0.0116157233199551347270;
6035  w[104] = 0.0109557333878379016480;
6036  w[105] = 0.0102971169579563555237;
6037  w[106] = 0.00964117772970253669530;
6038  w[107] = 0.00898927578406413572328;
6039  w[108] = 0.00834283875396815770558;
6040  w[109] = 0.00770337523327974184817;
6041  w[110] = 0.00707248999543355546805;
6042  w[111] = 0.00645190005017573692280;
6043  w[112] = 0.00584344987583563950756;
6044  w[113] = 0.00524912345480885912513;
6045  w[114] = 0.00467105037211432174741;
6046  w[115] = 0.00411150397865469304717;
6047  w[116] = 0.00357289278351729964938;
6048  w[117] = 0.00305775341017553113613;
6049  w[118] = 0.00256876494379402037313;
6050  w[119] = 0.00210881524572663287933;
6051  w[120] = 0.00168114286542146990631;
6052  w[121] = 0.00128952408261041739210;
6053  w[122] = 0.000938369848542381500794;
6054  w[123] = 0.000632607319362633544219;
6055  w[124] = 0.000377746646326984660274;
6056  w[125] = 0.000180739564445388357820;
6057  w[126] = 0.0000505360952078625176247;
6058  }
6059  else if (n==255) {
6060  w[ 0] = 0.69379364324108267170E-05;
6061  w[ 1] = 0.25157870384280661489E-04;
6062  w[ 2] = 0.53275293669780613125E-04;
6063  w[ 3] = 0.90372734658751149261E-04;
6064  w[ 4] = 0.13575491094922871973E-03;
6065  w[ 5] = 0.18887326450650491366E-03;
6066  w[ 6] = 0.24921240048299729402E-03;
6067  w[ 7] = 0.31630366082226447689E-03;
6068  w[ 8] = 0.38974528447328229322E-03;
6069  w[ 9] = 0.46918492424785040975E-03;
6070  w[ 10] = 0.55429531493037471492E-03;
6071  w[ 11] = 0.64476204130572477933E-03;
6072  w[ 12] = 0.74028280424450333046E-03;
6073  w[ 13] = 0.84057143271072246365E-03;
6074  w[ 14] = 0.94536151685852538246E-03;
6075  w[ 15] = 0.10544076228633167722E-02;
6076  w[ 16] = 0.11674841174299594077E-02;
6077  w[ 17] = 0.12843824718970101768E-02;
6078  w[ 18] = 0.14049079956551446427E-02;
6079  w[ 19] = 0.15288767050877655684E-02;
6080  w[ 20] = 0.16561127281544526052E-02;
6081  w[ 21] = 0.17864463917586498247E-02;
6082  w[ 22] = 0.19197129710138724125E-02;
6083  w[ 23] = 0.20557519893273465236E-02;
6084  w[ 24] = 0.21944069253638388388E-02;
6085  w[ 25] = 0.23355251860571608737E-02;
6086  w[ 26] = 0.24789582266575679307E-02;
6087  w[ 27] = 0.26245617274044295626E-02;
6088  w[ 28] = 0.27721957645934509940E-02;
6089  w[ 29] = 0.29217249379178197538E-02;
6090  w[ 30] = 0.30730184347025783234E-02;
6091  w[ 31] = 0.32259500250878684614E-02;
6092  w[ 32] = 0.33803979910869203823E-02;
6093  w[ 33] = 0.35362449977167777340E-02;
6094  w[ 34] = 0.36933779170256508183E-02;
6095  w[ 35] = 0.38516876166398709241E-02;
6096  w[ 36] = 0.40110687240750233989E-02;
6097  w[ 37] = 0.41714193769840788528E-02;
6098  w[ 38] = 0.43326409680929828545E-02;
6099  w[ 39] = 0.44946378920320678616E-02;
6100  w[ 40] = 0.46573172997568547773E-02;
6101  w[ 41] = 0.48205888648512683476E-02;
6102  w[ 42] = 0.49843645647655386012E-02;
6103  w[ 43] = 0.51485584789781777618E-02;
6104  w[ 44] = 0.53130866051870565663E-02;
6105  w[ 45] = 0.54778666939189508240E-02;
6106  w[ 46] = 0.56428181013844441585E-02;
6107  w[ 47] = 0.58078616599775673635E-02;
6108  w[ 48] = 0.59729195655081658049E-02;
6109  w[ 49] = 0.61379152800413850435E-02;
6110  w[ 50] = 0.63027734490857587172E-02;
6111  w[ 51] = 0.64674198318036867274E-02;
6112  w[ 52] = 0.66317812429018878941E-02;
6113  w[ 53] = 0.67957855048827733948E-02;
6114  w[ 54] = 0.69593614093904229394E-02;
6115  w[ 55] = 0.71224386864583871532E-02;
6116  w[ 56] = 0.72849479805538070639E-02;
6117  w[ 57] = 0.74468208324075910174E-02;
6118  w[ 58] = 0.76079896657190565832E-02;
6119  w[ 59] = 0.77683877779219912200E-02;
6120  w[ 60] = 0.79279493342948491103E-02;
6121  w[ 61] = 0.80866093647888599710E-02;
6122  w[ 62] = 0.82443037630328680306E-02;
6123  w[ 63] = 0.84009692870519326354E-02;
6124  w[ 64] = 0.85565435613076896192E-02;
6125  w[ 65] = 0.87109650797320868736E-02;
6126  w[ 66] = 0.88641732094824942641E-02;
6127  w[ 67] = 0.90161081951956431600E-02;
6128  w[ 68] = 0.91667111635607884067E-02;
6129  w[ 69] = 0.93159241280693950932E-02;
6130  w[ 70] = 0.94636899938300652943E-02;
6131  w[ 71] = 0.96099525623638830097E-02;
6132  w[ 72] = 0.97546565363174114611E-02;
6133  w[ 73] = 0.98977475240487497440E-02;
6134  w[ 74] = 0.10039172044056840798E-01;
6135  w[ 75] = 0.10178877529236079733E-01;
6136  w[ 76] = 0.10316812330947621682E-01;
6137  w[ 77] = 0.10452925722906011926E-01;
6138  w[ 78] = 0.10587167904885197931E-01;
6139  w[ 79] = 0.10719490006251933623E-01;
6140  w[ 80] = 0.10849844089337314099E-01;
6141  w[ 81] = 0.10978183152658912470E-01;
6142  w[ 82] = 0.11104461134006926537E-01;
6143  w[ 83] = 0.11228632913408049354E-01;
6144  w[ 84] = 0.11350654315980596602E-01;
6145  w[ 85] = 0.11470482114693874380E-01;
6146  w[ 86] = 0.11588074033043952568E-01;
6147  w[ 87] = 0.11703388747657003101E-01;
6148  w[ 88] = 0.11816385890830235763E-01;
6149  w[ 89] = 0.11927026053019270040E-01;
6150  w[ 90] = 0.12035270785279562630E-01;
6151  w[ 91] = 0.12141082601668299679E-01;
6152  w[ 92] = 0.12244424981611985899E-01;
6153  w[ 93] = 0.12345262372243838455E-01;
6154  w[ 94] = 0.12443560190714035263E-01;
6155  w[ 95] = 0.12539284826474884353E-01;
6156  w[ 96] = 0.12632403643542078765E-01;
6157  w[ 97] = 0.12722884982732382906E-01;
6158  w[ 98] = 0.12810698163877361967E-01;
6159  w[ 99] = 0.12895813488012114694E-01;
6160  w[100] = 0.12978202239537399286E-01;
6161  w[101] = 0.13057836688353048840E-01;
6162  w[102] = 0.13134690091960152836E-01;
6163  w[103] = 0.13208736697529129966E-01;
6164  w[104] = 0.13279951743930530650E-01;
6165  w[105] = 0.13348311463725179953E-01;
6166  w[106] = 0.13413793085110098513E-01;
6167  w[107] = 0.13476374833816515982E-01;
6168  w[108] = 0.13536035934956213614E-01;
6169  w[109] = 0.13592756614812395910E-01;
6170  w[110] = 0.13646518102571291428E-01;
6171  w[111] = 0.13697302631990716258E-01;
6172  w[112] = 0.13745093443001896632E-01;
6173  w[113] = 0.13789874783240936517E-01;
6174  w[114] = 0.13831631909506428676E-01;
6175  w[115] = 0.13870351089139840997E-01;
6176  w[116] = 0.13906019601325461264E-01;
6177  w[117] = 0.13938625738306850804E-01;
6178  w[118] = 0.13968158806516938516E-01;
6179  w[119] = 0.13994609127619079852E-01;
6180  w[120] = 0.14017968039456608810E-01;
6181  w[121] = 0.14038227896908623303E-01;
6182  w[122] = 0.14055382072649964277E-01;
6183  w[123] = 0.14069424957813575318E-01;
6184  w[124] = 0.14080351962553661325E-01;
6185  w[125] = 0.14088159516508301065E-01;
6186  w[126] = 0.14092845069160408355E-01;
6187  w[127] = 0.14094407090096179347E-01;
6188  w[128] = 0.14092845069160408355E-01;
6189  w[129] = 0.14088159516508301065E-01;
6190  w[130] = 0.14080351962553661325E-01;
6191  w[131] = 0.14069424957813575318E-01;
6192  w[132] = 0.14055382072649964277E-01;
6193  w[133] = 0.14038227896908623303E-01;
6194  w[134] = 0.14017968039456608810E-01;
6195  w[135] = 0.13994609127619079852E-01;
6196  w[136] = 0.13968158806516938516E-01;
6197  w[137] = 0.13938625738306850804E-01;
6198  w[138] = 0.13906019601325461264E-01;
6199  w[139] = 0.13870351089139840997E-01;
6200  w[140] = 0.13831631909506428676E-01;
6201  w[141] = 0.13789874783240936517E-01;
6202  w[142] = 0.13745093443001896632E-01;
6203  w[143] = 0.13697302631990716258E-01;
6204  w[144] = 0.13646518102571291428E-01;
6205  w[145] = 0.13592756614812395910E-01;
6206  w[146] = 0.13536035934956213614E-01;
6207  w[147] = 0.13476374833816515982E-01;
6208  w[148] = 0.13413793085110098513E-01;
6209  w[149] = 0.13348311463725179953E-01;
6210  w[150] = 0.13279951743930530650E-01;
6211  w[151] = 0.13208736697529129966E-01;
6212  w[152] = 0.13134690091960152836E-01;
6213  w[153] = 0.13057836688353048840E-01;
6214  w[154] = 0.12978202239537399286E-01;
6215  w[155] = 0.12895813488012114694E-01;
6216  w[156] = 0.12810698163877361967E-01;
6217  w[157] = 0.12722884982732382906E-01;
6218  w[158] = 0.12632403643542078765E-01;
6219  w[159] = 0.12539284826474884353E-01;
6220  w[160] = 0.12443560190714035263E-01;
6221  w[161] = 0.12345262372243838455E-01;
6222  w[162] = 0.12244424981611985899E-01;
6223  w[163] = 0.12141082601668299679E-01;
6224  w[164] = 0.12035270785279562630E-01;
6225  w[165] = 0.11927026053019270040E-01;
6226  w[166] = 0.11816385890830235763E-01;
6227  w[167] = 0.11703388747657003101E-01;
6228  w[168] = 0.11588074033043952568E-01;
6229  w[169] = 0.11470482114693874380E-01;
6230  w[170] = 0.11350654315980596602E-01;
6231  w[171] = 0.11228632913408049354E-01;
6232  w[172] = 0.11104461134006926537E-01;
6233  w[173] = 0.10978183152658912470E-01;
6234  w[174] = 0.10849844089337314099E-01;
6235  w[175] = 0.10719490006251933623E-01;
6236  w[176] = 0.10587167904885197931E-01;
6237  w[177] = 0.10452925722906011926E-01;
6238  w[178] = 0.10316812330947621682E-01;
6239  w[179] = 0.10178877529236079733E-01;
6240  w[180] = 0.10039172044056840798E-01;
6241  w[181] = 0.98977475240487497440E-02;
6242  w[182] = 0.97546565363174114611E-02;
6243  w[183] = 0.96099525623638830097E-02;
6244  w[184] = 0.94636899938300652943E-02;
6245  w[185] = 0.93159241280693950932E-02;
6246  w[186] = 0.91667111635607884067E-02;
6247  w[187] = 0.90161081951956431600E-02;
6248  w[188] = 0.88641732094824942641E-02;
6249  w[189] = 0.87109650797320868736E-02;
6250  w[190] = 0.85565435613076896192E-02;
6251  w[191] = 0.84009692870519326354E-02;
6252  w[192] = 0.82443037630328680306E-02;
6253  w[193] = 0.80866093647888599710E-02;
6254  w[194] = 0.79279493342948491103E-02;
6255  w[195] = 0.77683877779219912200E-02;
6256  w[196] = 0.76079896657190565832E-02;
6257  w[197] = 0.74468208324075910174E-02;
6258  w[198] = 0.72849479805538070639E-02;
6259  w[199] = 0.71224386864583871532E-02;
6260  w[200] = 0.69593614093904229394E-02;
6261  w[201] = 0.67957855048827733948E-02;
6262  w[202] = 0.66317812429018878941E-02;
6263  w[203] = 0.64674198318036867274E-02;
6264  w[204] = 0.63027734490857587172E-02;
6265  w[205] = 0.61379152800413850435E-02;
6266  w[206] = 0.59729195655081658049E-02;
6267  w[207] = 0.58078616599775673635E-02;
6268  w[208] = 0.56428181013844441585E-02;
6269  w[209] = 0.54778666939189508240E-02;
6270  w[210] = 0.53130866051870565663E-02;
6271  w[211] = 0.51485584789781777618E-02;
6272  w[212] = 0.49843645647655386012E-02;
6273  w[213] = 0.48205888648512683476E-02;
6274  w[214] = 0.46573172997568547773E-02;
6275  w[215] = 0.44946378920320678616E-02;
6276  w[216] = 0.43326409680929828545E-02;
6277  w[217] = 0.41714193769840788528E-02;
6278  w[218] = 0.40110687240750233989E-02;
6279  w[219] = 0.38516876166398709241E-02;
6280  w[220] = 0.36933779170256508183E-02;
6281  w[221] = 0.35362449977167777340E-02;
6282  w[222] = 0.33803979910869203823E-02;
6283  w[223] = 0.32259500250878684614E-02;
6284  w[224] = 0.30730184347025783234E-02;
6285  w[225] = 0.29217249379178197538E-02;
6286  w[226] = 0.27721957645934509940E-02;
6287  w[227] = 0.26245617274044295626E-02;
6288  w[228] = 0.24789582266575679307E-02;
6289  w[229] = 0.23355251860571608737E-02;
6290  w[230] = 0.21944069253638388388E-02;
6291  w[231] = 0.20557519893273465236E-02;
6292  w[232] = 0.19197129710138724125E-02;
6293  w[233] = 0.17864463917586498247E-02;
6294  w[234] = 0.16561127281544526052E-02;
6295  w[235] = 0.15288767050877655684E-02;
6296  w[236] = 0.14049079956551446427E-02;
6297  w[237] = 0.12843824718970101768E-02;
6298  w[238] = 0.11674841174299594077E-02;
6299  w[239] = 0.10544076228633167722E-02;
6300  w[240] = 0.94536151685852538246E-03;
6301  w[241] = 0.84057143271072246365E-03;
6302  w[242] = 0.74028280424450333046E-03;
6303  w[243] = 0.64476204130572477933E-03;
6304  w[244] = 0.55429531493037471492E-03;
6305  w[245] = 0.46918492424785040975E-03;
6306  w[246] = 0.38974528447328229322E-03;
6307  w[247] = 0.31630366082226447689E-03;
6308  w[248] = 0.24921240048299729402E-03;
6309  w[249] = 0.18887326450650491366E-03;
6310  w[250] = 0.13575491094922871973E-03;
6311  w[251] = 0.90372734658751149261E-04;
6312  w[252] = 0.53275293669780613125E-04;
6313  w[253] = 0.25157870384280661489E-04;
6314  w[254] = 0.69379364324108267170E-05;
6315  }
6316  else {
6317  std::cerr << "\n";
6318  std::cerr << "PATTERSON_LOOKUP_WEIGHTS - Fatal error!\n";
6319  std::cerr << " Unexpected value of N = " << n << ".\n";
6320  std::exit(1);
6321  }
6322  return;
6323 }
6324 
6325 //***************************************************************************
6326 template<class Real>
6327 void ROLBurkardtRules::trapezoidal_compute ( int n, Real x[], Real w[] )
6328 //***************************************************************************
6329 {
6330  if (n==1) {
6331  x[0] = 0.0;
6332  w[0] = 2.0;
6333  }
6334  else {
6335  Real h = 1.0/((Real)n-1.0);
6336  for (int i=0; i<n; i++) {
6337  x[i] = -1.0 + (Real)i*h*2.0;
6338  if (i==0||i==n-1) {
6339  w[i] = h;
6340  }
6341  else {
6342  w[i] = 2.0*h;
6343  }
6344  }
6345  }
6346  return;
6347 }
6348 
6349 //***************************************************************************
6350 template<class Real>
6352 //***************************************************************************
6353 {
6354  if (n==1) {
6355  x[0] = 0.0;
6356  }
6357  else {
6358  Real h = 1.0/((Real)n-1.0);
6359  for (int i=0; i<n; i++) {
6360  x[i] = -1.0 + (Real)i*h*2.0;
6361  }
6362  }
6363  return;
6364 }
6365 
6366 //***************************************************************************
6367 template<class Real>
6369 //***************************************************************************
6370 {
6371  if (n==1) {
6372  w[0] = 2.0;
6373  }
6374  else {
6375  Real h = 1.0/((Real)n-1.0);
6376  for (int i=0; i<n; i++) {
6377  if (i==0||i==n-1) {
6378  w[i] = h;
6379  }
6380  else {
6381  w[i] = 2.0*h;
6382  }
6383  }
6384  }
6385  return;
6386 }
6387 
6388 //****************************************************************************
6389 template<class Real>
6391 //****************************************************************************
6392 //
6393 // Purpose:
6394 //
6395 // R8_EPSILON returns the R8 roundoff unit.
6396 //
6397 // Discussion:
6398 //
6399 // The roundoff unit is a number R which is a power of 2 with the
6400 // property that, to the precision of the computer's arithmetic,
6401 // 1 < 1 + R
6402 // but
6403 // 1 = ( 1 + R / 2 )
6404 //
6405 // Licensing:
6406 //
6407 // This code is distributed under the GNU LGPL license.
6408 //
6409 // Modified:
6410 //
6411 // 18 February 2008
6412 //
6413 // Author:
6414 //
6415 // John Burkardt
6416 //
6417 // Parameters:
6418 //
6419 // Output, Real R8_EPSILON, the R8 round-off unit.
6420 //
6421 {
6422  Real value; value = 1.0;
6423 
6424  while (1.0<(Real)(1.0+value)) {
6425  value = value / 2.0;
6426  }
6427 
6428  value = 2.0 * value;
6429 
6430  return value;
6431 }
6432 
6433 //****************************************************************************
6434 template<class Real>
6436 //****************************************************************************
6437 //
6438 // Purpose:
6439 //
6440 // R8_SIGN returns the sign of an R8.
6441 //
6442 // Licensing:
6443 //
6444 // This code is distributed under the GNU LGPL license.
6445 //
6446 // Modified:
6447 //
6448 // 18 October 2004
6449 //
6450 // Author:
6451 //
6452 // John Burkardt
6453 //
6454 // Parameters:
6455 //
6456 // Input, Real X, the number whose sign is desired.
6457 //
6458 // Output, Real R8_SIGN, the sign of X.
6459 //
6460 {
6461  Real value;
6462 
6463  if (x<0.0) {
6464  value = -1.0;
6465  }
6466  else {
6467  value = 1.0;
6468  }
6469  return value;
6470 }
6471 
6472 } // end of namespace ROL
6473 
static void legendre_lookup(int n, Real x[], Real w[])
Gauss-Legendre; returns points and weights.
static void imtqlx(int n, Real d[], Real e[], Real z[])
static void fejer2_compute_weights(int order, Real w[])
Fejer type 2; returns weights.
static void trapezoidal_compute(int n, Real x[], Real w[])
Trapezoidal rule; returns points and weights.
static void chebyshev2_compute_points(int order, Real x[])
Gauss-Chebyshev of Type 2; returns points.
static void hermite_genz_keister_lookup_points(int n, Real x[])
Hermite-Genz-Keister; returns points.
static void laguerre_lookup_points(int n, Real x[])
Gauss-Laguerre; returns points.
static void laguerre_compute_points(int order, Real x[])
Gauss-Laguerre; returns points.
static void laguerre_compute_weights(int order, Real w[])
Gauss-Laguerre; returns weights.
static void chebyshev1_compute_weights(int order, Real w[])
Gauss-Chebyshev of Type 1; returns weights.
static void hermite_genz_keister_lookup(int n, Real x[], Real w[])
Hermite-Genz-Keister; returns points and weights.
static void patterson_lookup_points(int n, Real x[])
Gauss-Patterson; returns points.
static void chebyshev1_compute_points(int order, Real x[])
Gauss-Chebyshev of Type 1; returns points.
static void hermite_compute_weights(int order, Real w[])
Gauss-Hermite; returns weights.
static void hermite_lookup(int n, Real x[], Real w[])
Gauss-Hermite; returns points and weights.
static void legendre_lookup_weights(int n, Real w[])
Gauss-Legendre; returns weights.
static void chebyshev1_compute(int order, Real x[], Real w[])
Gauss-Chebyshev of Type 1; returns points and weights.
static void chebyshev2_compute(int order, Real x[], Real w[])
Gauss-Chebyshev of Type 2; returns points and weights.
static void trapezoidal_compute_points(int order, Real x[])
Trapezoidal rule; returns points.
static void hermite_genz_keister_lookup_weights(int n, Real w[])
Hermite-Genz-Keister; returns weights.
static void hermite_lookup_points(int n, Real x[])
Gauss-Hermite; returns points.
static void legendre_compute_weights(int order, Real w[])
Gauss-Legendre; returns weights.
static void laguerre_lookup_weights(int n, Real w[])
Gauss-Laguerre; returns weights.
static void trapezoidal_compute_weights(int order, Real w[])
Trapezoidal rule; returns weights.
static void clenshaw_curtis_compute(int order, Real x[], Real w[])
Clenshaw-Curtis; returns points and weights.
static void hermite_compute_points(int order, Real x[])
Gauss-Hermite; returns points.
static void legendre_compute(int n, Real x[], Real w[])
Gauss-Legendre; returns points and weights.
static Real r8_epsilon(Real one)
static void clenshaw_curtis_compute_points(int order, Real x[])
Clenshaw-Curtis; returns points.
static void clenshaw_curtis_compute_weights(int order, Real w[])
Clenshaw-Curtis; returns weights.
static void laguerre_compute(int n, Real x[], Real w[])
Gauss-Laguerre; returns points and weights.
static void hermite_compute(int order, Real x[], Real w[])
Gauss-Hermite; returns points and weights.
static void laguerre_lookup(int n, Real x[], Real w[])
Gauss-Laguerre; returns points and weights.
static void fejer2_compute(int order, Real x[], Real w[])
Fejer type 2; returns points and weights.
static void legendre_compute_points(int order, Real x[])
Gauss-Legendre; returns points.
static void patterson_lookup(int n, Real x[], Real w[])
Gauss-Patterson; returns points and weights.
static void chebyshev2_compute_weights(int order, Real w[])
Gauss-Chebyshev of Type 2; returns weights.
static void fejer2_compute_points(int order, Real x[])
Fejer type 2; returns points.
static void hermite_lookup_weights(int n, Real w[])
Gauss-Hermite; returns weights.
static void legendre_lookup_points(int n, Real x[])
Gauss-Legendre; returns points.
static void patterson_lookup_weights(int n, Real w[])
Gauss-Patterson; returns weights.