QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
gaussianorthogonalpolynomial.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2005, 2006 Klaus Spanderen
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file gaussianorthogonalpolynomial.hpp
21 \brief orthogonal polynomials for gaussian quadratures
22*/
23
24#ifndef quantlib_gaussian_orthogonal_polynomial_hpp
25#define quantlib_gaussian_orthogonal_polynomial_hpp
26
27#include <ql/types.hpp>
28
29namespace QuantLib {
30
31 //! orthogonal polynomial for Gaussian quadratures
32 /*! References:
33 Gauss quadratures and orthogonal polynomials
34
35 G.H. Gloub and J.H. Welsch: Calculation of Gauss quadrature rule.
36 Math. Comput. 23 (1986), 221-230
37
38 "Numerical Recipes in C", 2nd edition,
39 Press, Teukolsky, Vetterling, Flannery,
40
41 The polynomials are defined by the three-term recurrence relation
42 \f[
43 P_{k+1}(x)=(x-\alpha_k) P_k(x) - \beta_k P_{k-1}(x)
44 \f]
45 and
46 \f[
47 \mu_0 = \int{w(x)dx}
48 \f]
49 */
51 public:
52 virtual ~GaussianOrthogonalPolynomial() = default;
53 virtual Real mu_0() const = 0;
54 virtual Real alpha(Size i) const = 0;
55 virtual Real beta(Size i) const = 0;
56 virtual Real w(Real x) const = 0;
57
58 Real value(Size i, Real x) const;
59 Real weightedValue(Size i, Real x) const;
60 };
61
62 //! Gauss-Laguerre polynomial
64 public:
65 explicit GaussLaguerrePolynomial(Real s = 0.0);
66
67 Real mu_0() const override;
68 Real alpha(Size i) const override;
69 Real beta(Size i) const override;
70 Real w(Real x) const override;
71
72 private:
73 const Real s_;
74 };
75
76 //! Gauss-Hermite polynomial
78 public:
79 explicit GaussHermitePolynomial(Real mu = 0.0);
80
81 Real mu_0() const override;
82 Real alpha(Size i) const override;
83 Real beta(Size i) const override;
84 Real w(Real x) const override;
85
86 private:
87 const Real mu_;
88 };
89
90 //! Gauss-Jacobi polynomial
92 public:
94
95 Real mu_0() const override;
96 Real alpha(Size i) const override;
97 Real beta(Size i) const override;
98 Real w(Real x) const override;
99
100 private:
102 const Real beta_;
103 };
104
105 //! Gauss-Legendre polynomial
107 public:
109 };
110
111 //! Gauss-Chebyshev polynomial
113 public:
115 };
116
117 //! Gauss-Chebyshev polynomial (second kind)
119 public:
121 };
122
123 //! Gauss-Gegenbauer polynomial
125 public:
126 explicit GaussGegenbauerPolynomial(Real lambda);
127 };
128
129 //! Gauss hyperbolic polynomial
131 public:
132 Real mu_0() const override;
133 Real alpha(Size i) const override;
134 Real beta(Size i) const override;
135 Real w(Real x) const override;
136 };
137
138}
139
140#endif
Gauss-Chebyshev polynomial (second kind)
orthogonal polynomial for Gaussian quadratures
virtual ~GaussianOrthogonalPolynomial()=default
virtual Real alpha(Size i) const =0
virtual Real beta(Size i) const =0
virtual Real w(Real x) const =0
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
Real beta
Definition: sabr.cpp:200
Real alpha
Definition: sabr.cpp:200
Custom types.