File: laguerre.qbk

package info (click to toggle)
boost1.88 1.88.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 576,932 kB
  • sloc: cpp: 4,149,234; xml: 136,789; ansic: 35,092; python: 33,910; asm: 5,698; sh: 4,604; ada: 1,681; makefile: 1,633; pascal: 1,139; perl: 1,124; sql: 640; yacc: 478; ruby: 271; java: 77; lisp: 24; csh: 6
file content (159 lines) | stat: -rw-r--r-- 5,000 bytes parent folder | download | duplicates (16)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
[section:laguerre Laguerre (and Associated) Polynomials]

[h4 Synopsis]

``
#include <boost/math/special_functions/laguerre.hpp>
``

   namespace boost{ namespace math{
   
   template <class T>
   ``__sf_result`` laguerre(unsigned n, T x);
   
   template <class T, class ``__Policy``>
   ``__sf_result`` laguerre(unsigned n, T x, const ``__Policy``&);
   
   template <class T>
   ``__sf_result`` laguerre(unsigned n, unsigned m, T x);
   
   template <class T, class ``__Policy``>
   ``__sf_result`` laguerre(unsigned n, unsigned m, T x, const ``__Policy``&);
   
   template <class T1, class T2, class T3>
   ``__sf_result`` laguerre_next(unsigned n, T1 x, T2 Ln, T3 Lnm1);
   
   template <class T1, class T2, class T3>
   ``__sf_result`` laguerre_next(unsigned n, unsigned m, T1 x, T2 Ln, T3 Lnm1);

   
   }} // namespaces
   
[h4 Description]

The return type of these functions is computed using the __arg_promotion_rules:
note than when there is a single template argument the result is the same type 
as that argument or `double` if the template argument is an integer type.

[optional_policy]

   template <class T>
   ``__sf_result`` laguerre(unsigned n, T x);
   
   template <class T, class ``__Policy``>
   ``__sf_result`` laguerre(unsigned n, T x, const ``__Policy``&);
   
Returns the value of the Laguerre Polynomial of order /n/ at point /x/:

[equation laguerre_0]

The following graph illustrates the behaviour of the first few 
Laguerre Polynomials:

[graph laguerre]
   
   template <class T>
   ``__sf_result`` laguerre(unsigned n, unsigned m, T x);
   
   template <class T, class ``__Policy``>
   ``__sf_result`` laguerre(unsigned n, unsigned m, T x, const ``__Policy``&);
   
Returns the Associated Laguerre polynomial of degree /n/ 
and order /m/ at point /x/:

[equation laguerre_1]
   
   template <class T1, class T2, class T3>
   ``__sf_result`` laguerre_next(unsigned n, T1 x, T2 Ln, T3 Lnm1);
   
Implements the three term recurrence relation for the Laguerre
polynomials, this function can be used to create a sequence of
values evaluated at the same /x/, and for rising /n/.

[equation laguerre_2]

For example we could produce a vector of the first 10 polynomial
values using:

   double x = 0.5;  // Abscissa value
   vector<double> v;
   v.push_back(laguerre(0, x)).push_back(laguerre(1, x));
   for(unsigned l = 1; l < 10; ++l)
      v.push_back(laguerre_next(l, x, v[l], v[l-1]));
      
Formally the arguments are:

[variablelist
[[n][The degree /n/ of the last polynomial calculated.]]
[[x][The abscissa value]]
[[Ln][The value of the polynomial evaluated at degree /n/.]]
[[Lnm1][The value of the polynomial evaluated at degree /n-1/.]]
]
   
   template <class T1, class T2, class T3>
   ``__sf_result`` laguerre_next(unsigned n, unsigned m, T1 x, T2 Ln, T3 Lnm1);

Implements the three term recurrence relation for the Associated Laguerre
polynomials, this function can be used to create a sequence of
values evaluated at the same /x/, and for rising degree /n/.

[equation laguerre_3]

For example we could produce a vector of the first 10 polynomial
values using:

   double x = 0.5;  // Abscissa value
   int m = 10;      // order
   vector<double> v;
   v.push_back(laguerre(0, m, x)).push_back(laguerre(1, m, x));
   for(unsigned l = 1; l < 10; ++l)
      v.push_back(laguerre_next(l, m, x, v[l], v[l-1]));
      
Formally the arguments are:

[variablelist
[[n][The degree of the last polynomial calculated.]]
[[m][The order of the Associated Polynomial.]]
[[x][The abscissa value.]]
[[Ln][The value of the polynomial evaluated at degree /n/.]]
[[Lnm1][The value of the polynomial evaluated at degree /n-1/.]]
]
   
[h4 Accuracy]

The following table shows peak errors (in units of epsilon) 
for various domains of input arguments.  
Note that only results for the widest floating point type on the system are 
given as narrower types have __zero_error.

[table_laguerre_n_x_]

[table_laguerre_n_m_x_]

Note that the worst errors occur when the degree increases, values greater than
~120 are very unlikely to produce sensible results, especially in the associated
polynomial case when the order is also large.  Further the relative errors
are likely to grow arbitrarily large when the function is very close to a root.

[h4 Testing]

A mixture of spot tests of values calculated using functions.wolfram.com, 
and randomly generated test data are
used: the test data was computed using
[@http://shoup.net/ntl/doc/RR.txt NTL::RR] at 1000-bit precision.

[h4 Implementation]

These functions are implemented using the stable three term
recurrence relations.  These relations guarantee low absolute error
but cannot guarantee low relative error near one of the roots of the
polynomials.

[endsect][/section:beta_function The Beta Function]
[/ 
  Copyright 2006 John Maddock and Paul A. Bristow.
  Distributed under the Boost Software License, Version 1.0.
  (See accompanying file LICENSE_1_0.txt or copy at
  http://www.boost.org/LICENSE_1_0.txt).
]