laguerre.qbk 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. [section:laguerre Laguerre (and Associated) Polynomials]
  2. [h4 Synopsis]
  3. ``
  4. #include <boost/math/special_functions/laguerre.hpp>
  5. ``
  6. namespace boost{ namespace math{
  7. template <class T>
  8. ``__sf_result`` laguerre(unsigned n, T x);
  9. template <class T, class ``__Policy``>
  10. ``__sf_result`` laguerre(unsigned n, T x, const ``__Policy``&);
  11. template <class T>
  12. ``__sf_result`` laguerre(unsigned n, unsigned m, T x);
  13. template <class T, class ``__Policy``>
  14. ``__sf_result`` laguerre(unsigned n, unsigned m, T x, const ``__Policy``&);
  15. template <class T1, class T2, class T3>
  16. ``__sf_result`` laguerre_next(unsigned n, T1 x, T2 Ln, T3 Lnm1);
  17. template <class T1, class T2, class T3>
  18. ``__sf_result`` laguerre_next(unsigned n, unsigned m, T1 x, T2 Ln, T3 Lnm1);
  19. }} // namespaces
  20. [h4 Description]
  21. The return type of these functions is computed using the __arg_promotion_rules:
  22. note than when there is a single template argument the result is the same type
  23. as that argument or `double` if the template argument is an integer type.
  24. [optional_policy]
  25. template <class T>
  26. ``__sf_result`` laguerre(unsigned n, T x);
  27. template <class T, class ``__Policy``>
  28. ``__sf_result`` laguerre(unsigned n, T x, const ``__Policy``&);
  29. Returns the value of the Laguerre Polynomial of order /n/ at point /x/:
  30. [equation laguerre_0]
  31. The following graph illustrates the behaviour of the first few
  32. Laguerre Polynomials:
  33. [graph laguerre]
  34. template <class T>
  35. ``__sf_result`` laguerre(unsigned n, unsigned m, T x);
  36. template <class T, class ``__Policy``>
  37. ``__sf_result`` laguerre(unsigned n, unsigned m, T x, const ``__Policy``&);
  38. Returns the Associated Laguerre polynomial of degree /n/
  39. and order /m/ at point /x/:
  40. [equation laguerre_1]
  41. template <class T1, class T2, class T3>
  42. ``__sf_result`` laguerre_next(unsigned n, T1 x, T2 Ln, T3 Lnm1);
  43. Implements the three term recurrence relation for the Laguerre
  44. polynomials, this function can be used to create a sequence of
  45. values evaluated at the same /x/, and for rising /n/.
  46. [equation laguerre_2]
  47. For example we could produce a vector of the first 10 polynomial
  48. values using:
  49. double x = 0.5; // Abscissa value
  50. vector<double> v;
  51. v.push_back(laguerre(0, x)).push_back(laguerre(1, x));
  52. for(unsigned l = 1; l < 10; ++l)
  53. v.push_back(laguerre_next(l, x, v[l], v[l-1]));
  54. Formally the arguments are:
  55. [variablelist
  56. [[n][The degree /n/ of the last polynomial calculated.]]
  57. [[x][The abscissa value]]
  58. [[Ln][The value of the polynomial evaluated at degree /n/.]]
  59. [[Lnm1][The value of the polynomial evaluated at degree /n-1/.]]
  60. ]
  61. template <class T1, class T2, class T3>
  62. ``__sf_result`` laguerre_next(unsigned n, unsigned m, T1 x, T2 Ln, T3 Lnm1);
  63. Implements the three term recurrence relation for the Associated Laguerre
  64. polynomials, this function can be used to create a sequence of
  65. values evaluated at the same /x/, and for rising degree /n/.
  66. [equation laguerre_3]
  67. For example we could produce a vector of the first 10 polynomial
  68. values using:
  69. double x = 0.5; // Abscissa value
  70. int m = 10; // order
  71. vector<double> v;
  72. v.push_back(laguerre(0, m, x)).push_back(laguerre(1, m, x));
  73. for(unsigned l = 1; l < 10; ++l)
  74. v.push_back(laguerre_next(l, m, x, v[l], v[l-1]));
  75. Formally the arguments are:
  76. [variablelist
  77. [[n][The degree of the last polynomial calculated.]]
  78. [[m][The order of the Associated Polynomial.]]
  79. [[x][The abscissa value.]]
  80. [[Ln][The value of the polynomial evaluated at degree /n/.]]
  81. [[Lnm1][The value of the polynomial evaluated at degree /n-1/.]]
  82. ]
  83. [h4 Accuracy]
  84. The following table shows peak errors (in units of epsilon)
  85. for various domains of input arguments.
  86. Note that only results for the widest floating point type on the system are
  87. given as narrower types have __zero_error.
  88. [table_laguerre_n_x_]
  89. [table_laguerre_n_m_x_]
  90. Note that the worst errors occur when the degree increases, values greater than
  91. ~120 are very unlikely to produce sensible results, especially in the associated
  92. polynomial case when the order is also large. Further the relative errors
  93. are likely to grow arbitrarily large when the function is very close to a root.
  94. [h4 Testing]
  95. A mixture of spot tests of values calculated using functions.wolfram.com,
  96. and randomly generated test data are
  97. used: the test data was computed using
  98. [@http://shoup.net/ntl/doc/RR.txt NTL::RR] at 1000-bit precision.
  99. [h4 Implementation]
  100. These functions are implemented using the stable three term
  101. recurrence relations. These relations guarantee low absolute error
  102. but cannot guarantee low relative error near one of the roots of the
  103. polynomials.
  104. [endsect][/section:beta_function The Beta Function]
  105. [/
  106. Copyright 2006 John Maddock and Paul A. Bristow.
  107. Distributed under the Boost Software License, Version 1.0.
  108. (See accompanying file LICENSE_1_0.txt or copy at
  109. http://www.boost.org/LICENSE_1_0.txt).
  110. ]