MathFunctions.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2021 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Namespace
27  Foam::Math
28 
29 Description
30  A namespace for various mathematical functions.
31 
32  Reference:
33  \verbatim
34  Inverse error function (tag:W):
35  Winitzki, S. (2008).
36  A handy approximation for the error function and its inverse.
37  A lecture note obtained through private communication.
38  URL:https://sites.google.com/site/winitzki/sergei-winitzkis-files
39  (Retrieved on: 16 Feb 2021).
40 
41  Incomplete gamma functions (tag:DM):
42  DiDonato, A. R., & Morris Jr, A. H. (1986).
43  Computation of the incomplete gamma
44  function ratios and their inverse.
45  ACM Transactions on Mathematical Software (TOMS), 12(4), 377-393.
46  DOI:10.1145/22721.23109
47  \endverbatim
48 
49 Note
50  - The algorithm in \c invIncGamma is described in (DM:Sec. 4).
51  - The algorithm in \c incGammaRatio_Q is described in (DM:Sec. 3).
52  - The accuracy parameter \c IND is set to a value of 1.
53 
54 SourceFiles
55  erfInv.C
56  incGamma.C
57  invIncGamma.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef MathFunctions_H
62 #define MathFunctions_H
63 
64 #include "scalar.H"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 
71 /*---------------------------------------------------------------------------*\
72  Namespace Math Declaration
73 \*---------------------------------------------------------------------------*/
74 
75 namespace Math
76 {
77 
78 //- Inverse error function of a real-number argument
79 // \param y Real-number argument at which to evaluate. Domain: (-1, 1)
80 // \return The inverse of error function of y
81 scalar erfInv(const scalar y);
82 
83 
84 // Incomplete gamma functions
85 
86 //- Inverse of regularised lower incomplete gamma function
87 // \param a Real-number argument. Domain: (0, infty]
88 // \param P Real-number argument. Domain: [0,1]
89 scalar invIncGamma(const scalar a, const scalar P);
90 
91 //- Regularised upper incomplete gamma function
92 // \param a Real-number argument. Domain: (0, infty]
93 // \param x Real-number argument. Domain: [0, infty]
94 scalar incGammaRatio_Q(const scalar a, const scalar x);
95 
96 //- Regularised lower incomplete gamma function
97 // \param a Real-number argument. Domain: (0, infty]
98 // \param x Real-number argument. Domain: [0, infty]
99 scalar incGammaRatio_P(const scalar a, const scalar x);
100 
101 //- Upper incomplete gamma function
102 // \param a Real-number argument. Domain: (0, infty]
103 // \param x Real-number argument. Domain: [0, infty]
104 scalar incGamma_Q(const scalar a, const scalar x);
105 
106 //- Lower incomplete gamma function
107 // \param a Real-number argument. Domain: (0, infty]
108 // \param x Real-number argument. Domain: [0, infty]
109 scalar incGamma_P(const scalar a, const scalar x);
110 
111 
112 } // End namespace Math
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 } // End namespace Foam
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 #endif
121 
122 // ************************************************************************* //
Foam::Math::incGammaRatio_P
scalar incGammaRatio_P(const scalar a, const scalar x)
Regularised lower incomplete gamma function.
Definition: incGamma.C:437
Foam::Math::incGammaRatio_Q
scalar incGammaRatio_Q(const scalar a, const scalar x)
Regularised upper incomplete gamma function.
Definition: incGamma.C:199
Foam::Math::incGamma_Q
scalar incGamma_Q(const scalar a, const scalar x)
Upper incomplete gamma function.
Definition: incGamma.C:443
Foam::Math::erfInv
scalar erfInv(const scalar y)
Inverse error function of a real-number argument.
Definition: erfInv.C:34
scalar.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Math::invIncGamma
scalar invIncGamma(const scalar a, const scalar P)
Inverse of regularised lower incomplete gamma function.
Definition: invIncGamma.C:91
Foam::Math::incGamma_P
scalar incGamma_P(const scalar a, const scalar x)
Lower incomplete gamma function.
Definition: incGamma.C:449
x
x
Definition: LISASMDCalcMethod2.H:52
y
scalar y
Definition: LISASMDCalcMethod1.H:14