7 #include "Math/PdfFuncMathCore.h"
8 #include "Math/ProbFuncMathCore.h"
23 int main(
int argc,
char **argv)
40 catch(
const exception &error) {
41 FATAL(error.what() << endl);
45 for (
int n = 1;
n != 12; ++
n) {
46 for (
int m = 1; m <=
n; ++m) {
48 DEBUG(setw(2) <<
n <<
' ' << setw(2) << m <<
' ' << TMath::Binomial(
n,m) <<
' ' <<
binomial(
n,m) << endl);
54 for (
const double x : { -1.0e10, -10.0, -1.0, 0.0, +1.0, +10.0, +1.0e10 } ) {
59 ASSERT(fabs(TMath::Erf(
x) - erf(
x)) <= precision,
"Test of erf function");
62 for (
const double x : { -1.0e10, -10.0, -1.0, 0.0, +1.0, +10.0, +1.0e10 } ) {
67 ASSERT(fabs(TMath::Erfc(
x) - erfc(
x)) <= precision,
"Test of erfc function");
70 for (
const double x : { 1.0e-10, +1.0, +10.0, 100.0 } ) {
78 for (
const double a : { 1.0e-10, +1.0, +10.0, +1.0e10 } ) {
79 for (
const double x : { 1.0e-10, +1.0, +10.0, +1.0e10 } ) {
88 for (
int n : { 0, 1, 10, 100 }) {
89 for (
const double mu : { 1.0e-10, +1.0, +10.0, +1.0e10 } ) {
91 DEBUG(
"ROOT::Math::poisson_pdf(" <<
n <<
"," <<
SCIENTIFIC(12,5) << mu <<
") " <<
SCIENTIFIC(12,5) << ROOT::Math::poisson_pdf(
n, mu) <<
' ' <<
94 ASSERT(fabs(ROOT::Math::poisson_cdf(
n, mu) -
Poisson(
n,mu)) <= precision,
"Test of Poisson cumulative density function");
98 for (
int n : { 0, 1, 10, 100 }) {
99 for (
const double mu : { 1.0e-10, +1.0, +10.0, +1.0e10 } ) {
101 DEBUG(
"ROOT::Math::poisson_cdf(" <<
n <<
"," <<
SCIENTIFIC(12,5) << mu <<
") " <<
SCIENTIFIC(12,5) << ROOT::Math::poisson_cdf(
n, mu) <<
' ' <<
104 ASSERT(fabs(ROOT::Math::poisson_cdf(
n, mu) -
Poisson(
n,mu)) <= precision,
"Test of Poisson cumulative density function");
int main(int argc, char **argv)
Auxiliary methods for mathematics.
General purpose messaging.
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
I/O formatting auxiliaries.
Utility class to parse command line options.
double Gamma(const double a, const double x)
Incomplete gamma function.
double poisson(const size_t n, const double mu)
Poisson probability density distribition.
double Poisson(const size_t n, const double mu)
Poisson cumulative density distribition.
double binomial(const size_t n, const size_t k)
Binomial function.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.