20 const double MIN = -2.5;
21 const double MAX = +2.5;
25 bool showGraphics =
false;
32 TGraph*
g =
new TGraph(ARRAYSIZE, x, y);
33 g->SetLineColor(color);
34 g->SetLineStyle(
style);
43 vector<Double_t>
x( ARRAYSIZE );
44 vector<Double_t> yerf( ARRAYSIZE );
45 vector<Double_t> ymerf( ARRAYSIZE );
46 vector<Double_t> yerfc( ARRAYSIZE );
47 vector<Double_t> ymerfc( ARRAYSIZE );
48 vector<Double_t> yierf( ARRAYSIZE );
49 vector<Double_t> yierfc( ARRAYSIZE );
56 unsigned int index = 0;
74 if (
std::fabs( yerf[index] - ymerf[index] ) > ERRORLIMIT )
77 <<
" yerf[index] " << yerf[index]
78 <<
" ymerf[index] " << ymerf[index]
79 <<
" " <<
std::fabs( yerf[index] - ymerf[index] )
86 if (
std::fabs( yerfc[index] - ymerfc[index] ) > ERRORLIMIT )
89 <<
" yerfc[index] " << yerfc[index]
90 <<
" ymerfc[index] " << ymerfc[index]
91 <<
" " <<
std::fabs( yerfc[index] - ymerfc[index] )
97 if (
std::fabs( yierf[index] - i ) > ERRORLIMIT )
100 <<
" yierf[index] " << yierf[index]
107 if (
std::fabs( yierfc[index] - i ) > ERRORLIMIT )
110 <<
" yierfc[index] " << yierfc[index]
124 TCanvas*
c1 =
new TCanvas(
"c1",
"Two Graphs", 600, 400);
125 TH2F*
hpx =
new TH2F(
"hpx",
"Two Graphs(hpx)", ARRAYSIZE, MIN, MAX, ARRAYSIZE, -1,2);
129 TGraph* gerf =
drawPoints(&x[0], &yerf[0], 14);
130 TGraph* gmerf =
drawPoints(&x[0], &ymerf[0], 5, 7);
131 TGraph* gerfc =
drawPoints(&x[0], &yerfc[0], 2);
132 TGraph* gmerfc =
drawPoints(&x[0], &ymerfc[0], 3, 7);
138 legend->
AddEntry(gerf,
"TMath::Erf()");
139 legend->
AddEntry(gmerf,
"ROOT:Math::erf()");
140 legend->
AddEntry(gerfc,
"TMath::Erfc()");
141 legend->
AddEntry(gmerfc,
"ROOT::Math::erfInverse()");
147 cout <<
"Test Done!" << endl;
152 int main(
int argc,
char **argv)
156 for (
Int_t i=1 ; i<argc ; i++) {
157 std::string arg = argv[i] ;
166 cerr <<
"Usage: " << argv[0] <<
" [-g] [-v]\n";
168 cerr <<
" -g : graphics mode\n";
169 cerr <<
" -v : verbose mode";
double erf(double x)
Error function encountered in integrating the normal distribution.
Double_t ErfInverse(Double_t x)
returns the inverse error function x must be <-1<x<1
This class displays a legend box (TPaveText) containing several legend entries.
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
double erfc(double x)
Complementary error function.
virtual void Run(Bool_t retrn=kFALSE)
Main application eventloop. Calls system dependent eventloop via gSystem.
Double_t Erfc(Double_t x)
Compute the complementary error function erfc(x).
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
Double_t Erf(Double_t x)
Computation of the error function erf(x).
Double_t ErfcInverse(Double_t x)
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
int main(int argc, char **argv)
TGraph * drawPoints(Double_t x[], Double_t y[], int color, int style=1)
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...