• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2Copyright (c) 2019 Nick Thompson
3Copyright (c) 2019 Paul A. Bristow
4Use, modification and distribution are subject to the
5Boost Software License, Version 1.0. (See accompanying file
6LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7]
8
9[section:fourier_integrals Fourier Integrals]
10
11[import ../../example/ooura_fourier_integrals_example.cpp]
12[import ../../example/ooura_fourier_integrals_cosine_example.cpp]
13[import ../../example/ooura_fourier_integrals_multiprecision_example.cpp]
14
15[heading Synopsis]
16
17``
18    #include <boost/math/quadrature/ooura_fourier_integrals.hpp>
19
20    namespace boost { namespace math { namespace quadrature {
21
22    template<class Real>
23    class ooura_fourier_sin {
24    public:
25        ooura_fourier_sin(const Real relative_error_tolerance = tools::root_epsilon<Real>(), size_t levels = sizeof(Real));
26
27        template<class F>
28        std::pair<Real, Real> integrate(F const & f, Real omega);
29
30    };
31
32
33    template<class Real>
34    class ooura_fourier_cos {
35    public:
36        ooura_fourier_cos(const Real relative_error_tolerance = tools::root_epsilon<Real>(), size_t levels = sizeof(Real))
37
38        template<class F>
39        std::pair<Real, Real> integrate(F const & f, Real omega);
40    };
41
42    }}} // namespaces
43``
44
45Ooura's method for Fourier integrals computes
46
47[expression [int][sub 0][super [infin]] f(t)sin([omega] t) dt]
48
49and
50
51[expression [int][sub 0][super [infin]] f(t)cos([omega] t) dt]
52
53by a double exponentially decaying transformation.
54These integrals arise when computing continuous Fourier transform of odd and even functions, respectively.
55Oscillatory integrals are known to cause trouble for standard quadrature methods, so these routines are provided to cope with the most common oscillatory use case.
56
57The basic usage is shown below:
58
59[ooura_fourier_integrals_example_1]
60
61and compare with the expected value [pi]/2 of the integral.
62
63[ooura_fourier_integrals_example_2]
64
65The output is
66
67[ooura_fourier_integrals_example_output_1]
68
69[note This integrator is more insistent about examining the error estimate, than (say) tanh-sinh, which just returns the value of the integral.]
70
71With the macro BOOST_MATH_INSTRUMENT_OOURA defined, we can follow the progress:
72
73[ooura_fourier_integrals_example_diagnostic_output_1]
74
75Working code of this example is at [@../../example/ooura_fourier_integrals_example.cpp ooura_fourier_integrals_example.cpp]
76
77A classical cosine transform is presented below:
78
79[ooura_fourier_integrals_cosine_example_1]
80
81The value of this integral should be [pi]/(2e) and can be shown :
82
83[ooura_fourier_integrals_cosine_example_2]
84
85or with the macro BOOST_MATH_INSTRUMENT_OOURA defined, we can follow the progress:
86
87[ooura_fourier_integrals_example_cosine_diagnostic_output_1]
88
89Working code of this example is at [@../../example/ooura_fourier_integrals_cosine_example.cpp ooura_fourier_integrals_consine_example.cpp]
90
91[h5:performance Performance]
92The integrator precomputes nodes and weights, and hence can be reused for many different frequencies with good efficiency.
93The integrator is pimpl'd and hence can be shared between threads without a `memcpy` of the nodes and weights.
94
95Ooura and Mori's paper identifies criteria for rapid convergence based on the position of the poles of the integrand in the complex plane.
96If these poles are too close to the real axis the convergence is slow.
97It is not trivial to predict the convergence rate a priori, so if you are interested in figuring out if the convergence is rapid, compile with `-DBOOST_MATH_INSTRUMENT_OOURA`
98and some amount of printing will give you a good idea of how well this method is performing.
99
100[h5:multi_precision Higher precision]
101
102It is simple to extend to higher precision using __multiprecision.
103
104[ooura_fourier_integrals_multiprecision_example_1]
105
106[ooura_fourier_integrals_multiprecision_example_2]
107
108with output:
109[ooura_fourier_integrals_example_multiprecision_output_1]
110
111And with diagnostics on:
112
113[ooura_fourier_integrals_example_multiprecision_diagnostic_output_1]
114
115Working code of this example is at [@../../example/ooura_fourier_integrals_multiprecision_example.cpp ooura_fourier_integrals_multiprecision_example.cpp]
116
117For more examples of other functions and tests, see the full test suite at
118[@../../test/ooura_fourier_integral_test.cpp ooura_fourier_integral_test.cpp].
119
120Ngyen and Nuyens make use of __multiprecision in their extension to multiple dimensions, showing relative errors reducing to [cong] 10[super -2000]!
121
122[h5:rationale Rationale]
123
124This implementation is base on Ooura's 1999 paper rather than the later 2005 paper.
125It does not preclude a second future implementation based on the later work.
126
127Some of the features of the Ooura's 2005 paper that were less appealing were:
128
129* The advance of that paper is that one can compute ['both] the Fourier sine transform and Fourier cosine transform in a single shot.
130But there are examples, like sinc integral, where the Fourier sine would converge, but the Fourier cosine would diverge.
131* It would force users to live in the complex plane, when many potential applications only need real.
132
133[h4:references References]
134
135* Ooura, Takuya, and Masatake Mori, ['A robust double exponential formula for Fourier-type integrals.] Journal of computational and applied mathematics, 112.1-2 (1999): 229-241.
136* Ooura, Takuya, ['A Double Exponential Formula for the Fourier Transforms.] Publ. RIMS, Kyoto Univ., 41 (2005), 971-977. [@https://pdfs.semanticscholar.org/16ec/a5d76fd6b3d7acaaff0b2a6e8a70caa70190.pdf ]
137* Khatibi, Arezoo and Khatibi, Omid,[' Criteria for the Application of Double Exponential Transformation.] (2017) [@https://arxiv.org/pdf/1704.05752.pdf 1704.05752.pdf].
138* Nguyen, Dong T.P. and Nuyens, Dirk, ['Multivariate integration over Reals with exponential rate of convergence.] (2016) [@https://core.ac.uk/download/pdf/80799199.pdf].
139
140[endsect] [/section:fourier_integrals Fourier Integrals]
141
142