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