/
preglq.1
65 lines (65 loc) · 2.24 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
.\" Automatically generated by Pandoc 2.9.2
.\"
.TH "preglq" "1" "2019-09-23" "Fortran 95" "SHTOOLS 4.6"
.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[R], \f[C]upper\f[R], \f[C]n\f[R],
\f[C]zero\f[R], \f[C]w\f[R], \f[C]exitstatus\f[R])
.SH Parameters
.TP
\f[B]\f[CB]lower\f[B]\f[R] : input, real(dp)
The lower bound of the integration.
.TP
\f[B]\f[CB]upper\f[B]\f[R] : input, real(dp)
The upper bound of the integration.
.TP
\f[B]\f[CB]n\f[B]\f[R] : input, integer
The number of integration points to use.
This will integrate exactly a polynomial of degree \f[C]2n-1\f[R].
.TP
\f[B]\f[CB]zero\f[B]\f[R] : output, real(dp), dimension (\f[B]\f[CB]n\f[B]\f[R])
The zeros used in the Gauss-Legendre quadrature.
.TP
\f[B]\f[CB]w\f[B]\f[R] : output, real(dp), dimension (\f[B]\f[CB]n\f[B]\f[R])
The weights used in the Gauss-Legendre quadrature.
.TP
\f[B]\f[CB]exitstatus\f[B]\f[R] : 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.
.SH Description
.PP
\f[C]PreGLQ\f[R] will calculate the weights and zeros used to integrate
a function using Gauss-Legendre quadrature.
For \f[C]n\f[R] quadrature points, the integration will be exact if the
function is a polynomial of degree \f[C]2n-1\f[R], or less.
The quadrature nodes correspond to the zeros of the Legendre polynomial
of degree \f[C]n\f[R].
The number of quadrature points required to integrate a polynomial of
degree \f[C]L\f[R] is \f[C]ceiling((L+1)/2)\f[R].
.PP
To integrate a function between the bounds \f[C]lower\f[R] and
\f[C]upper\f[R] it is only necessary to calculate the sum of the
function evaluated at the nodes \f[C]zero\f[R] 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