/
preglq.1
76 lines (76 loc) · 2.2 KB
/
preglq.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
.\" Automatically generated by Pandoc 2.2.3
.\"
.TH "preglq" "1" "2018\-05\-20" "Fortran 95" "SHTOOLS 4.3"
.hy
.SH PreGLQ
.PP
Calculate the weights and nodes used in integrating a function by
Gauss\-Legendre quadrature.
.SH Usage
.PP
call PreGLQ (\f[C]lower\f[], \f[C]upper\f[], \f[C]n\f[], \f[C]zero\f[],
\f[C]w\f[], \f[C]exitstatus\f[])
.SH Parameters
.TP
.B \f[C]lower\f[] : input, real*8
The lower bound of the integration.
.RS
.RE
.TP
.B \f[C]upper\f[] : input, real*8
The upper bound of the integration.
.RS
.RE
.TP
.B \f[C]n\f[] : input, integer
The number of integration points to use.
This will integrate exactly a polynomial of degree \f[C]2n\-1\f[].
.RS
.RE
.TP
.B \f[C]zero\f[] : output, real*8, dimension (\f[C]n\f[])
The zeros used in the Gauss\-Legendre quadrature.
.RS
.RE
.TP
.B \f[C]w\f[] : output, real*8, dimension (\f[C]n\f[])
The weights used in the Gauss\-Legendre quadrature.
.RS
.RE
.TP
.B \f[C]exitstatus\f[] : output, optional, integer
If present, instead of executing a STOP when an error is encountered,
the variable exitstatus will be returned describing the error.
0 = No errors; 1 = Improper dimensions of input array; 2 = Improper
bounds for input variable; 3 = Error allocating memory; 4 = File IO
error.
.RS
.RE
.SH Description
.PP
\f[C]PreGLQ\f[] will calculate the weights and zeros used to integrate a
function using Gauss\-Legendre quadrature.
For \f[C]n\f[] quadrature points, the integration will be exact if the
function is a polynomial of degree \f[C]2n\-1\f[], or less.
The quadrature nodes correspond to the zeros of the Legendre polynomial
of degree \f[C]n\f[].
The number of quadrature points required to integrate a polynomial of
degree \f[C]L\f[] is \f[C]ceiling((L+1)/2)\f[].
.PP
To integrate a function between the bounds \f[C]lower\f[] and
\f[C]upper\f[] it is only necessary to calculate the sum of the function
evaluated at the nodes \f[C]zero\f[] multiplied by the weights.
.PP
This is a slightly modified version of the algorithm that was published
in NUMERICAL RECIPES.
.SH References
.PP
Press, W.H., S.A.
Teukolsky, W.T.
Vetterling, and B.P.
Flannery, Numerical Recipes in FORTRAN: The Art of Scientific Computing,
2nd ed., Cambridge Univ.
Press, Cambridge, UK, 1992.
.SH See also
.PP
shglq