BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Functions.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Base/Math/Functions.h
6 //! @brief Defines functions in namespace Math.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_BASE_MATH_FUNCTIONS_H
21 #define BORNAGAIN_BASE_MATH_FUNCTIONS_H
22 
23 #include "Base/Types/Complex.h"
24 #include <vector>
25 
26 //! Various mathematical functions.
27 
28 namespace Math {
29 
30 // ************************************************************************************************
31 // Various functions
32 // ************************************************************************************************
33 
34 double StandardNormal(double x);
35 double Gaussian(double x, double average, double std_dev);
36 double IntegratedGaussian(double x, double average, double std_dev);
37 
38 //! cotangent function: \f$cot(x)\equiv1/tan(x)\f$
39 double cot(double x);
40 
41 //! sinc function: \f$sinc(x)\equiv\sin(x)/x\f$
42 double sinc(double x);
43 
44 //! Complex sinc function: \f$sinc(x)\equiv\sin(x)/x\f$
45 complex_t sinc(const complex_t z);
46 
47 //! Complex tanhc function: \f$tanhc(x)\equiv\tanh(x)/x\f$
48 complex_t tanhc(const complex_t z);
49 
50 //! Real Laue function: \f$Laue(x,N)\equiv\sin(Nx)/sin(x)\f$
51 double Laue(const double x, size_t N);
52 
53 //! Error function of real-valued argument
54 double erf(double arg);
55 
56 // ************************************************************************************************
57 // Random number generators
58 // ************************************************************************************************
59 
60 // double GenerateUniformRandom();
61 // double GenerateStandardNormalRandom();
62 // double GenerateNormalRandom(double average, double std_dev);
63 double GeneratePoissonRandom(double average);
64 
65 } // Namespace Math
66 
67 #endif // BORNAGAIN_BASE_MATH_FUNCTIONS_H
68 #endif // USER_API
Defines complex_t, and a few elementary functions.
std::complex< double > complex_t
Definition: Complex.h:20
Various mathematical functions.
Definition: Bessel.h:26
double sinc(double x)
sinc function:
Definition: Functions.cpp:53
double Gaussian(double x, double average, double std_dev)
Definition: Functions.cpp:36
complex_t tanhc(const complex_t z)
Complex tanhc function: .
Definition: Functions.cpp:69
double erf(double arg)
Error function of real-valued argument.
Definition: Functions.cpp:87
double GeneratePoissonRandom(double average)
Definition: Functions.cpp:123
double IntegratedGaussian(double x, double average, double std_dev)
Definition: Functions.cpp:41
double cot(double x)
cotangent function:
Definition: Functions.cpp:48
double StandardNormal(double x)
Definition: Functions.cpp:31
double Laue(const double x, size_t N)
Real Laue function: .
Definition: Functions.cpp:76