18 const double MIN = -2.5;
19 const double MAX = +2.5;
23 bool showGraphics =
false;
29 TGraph*
g =
new TGraph(ARRAYSIZE, x, y);
30 g->SetLineColor(color);
31 g->SetLineStyle(
style);
40 vector<Double_t>
x( ARRAYSIZE );
41 vector<Double_t> yg( ARRAYSIZE );
42 vector<Double_t> ymtg( ARRAYSIZE );
43 vector<Double_t> yga( ARRAYSIZE );
44 vector<Double_t> ymga( ARRAYSIZE );
45 vector<Double_t> ylng( ARRAYSIZE );
46 vector<Double_t> ymlng( ARRAYSIZE );
54 unsigned int index = 0;
74 <<
" yg[index] " << yg[index]
75 <<
" ymtg[index] " << ymtg[index]
76 <<
" " <<
std::fabs( yg[index] - ymtg[index] )
83 if (
std::fabs( yga[index] - ymga[index] ) > ERRORLIMIT )
86 <<
" yga[index] " << yga[index]
87 <<
" ymga[index] " << ymga[index]
88 <<
" " <<
std::fabs( yga[index] - ymga[index] )
95 if (
std::fabs( ylng[index] - ymlng[index] ) > ERRORLIMIT )
98 <<
" ylng[index] " << ylng[index]
99 <<
" ymlng[index] " << ymlng[index]
100 <<
" " <<
std::fabs( ylng[index] - ymlng[index] )
111 TCanvas*
c1 =
new TCanvas(
"c1",
"Two Graphs", 600, 400);
112 TH2F*
hpx =
new TH2F(
"hpx",
"Two Graphs(hpx)", ARRAYSIZE, MIN, MAX, ARRAYSIZE, -1,5);
117 TGraph* gmtg =
drawPoints(&x[0], &ymtg[0], 2, 7);
119 TGraph* gmga =
drawPoints(&x[0], &ymga[0], 4, 7);
120 TGraph* glng =
drawPoints(&x[0], &ylng[0], 5);
121 TGraph* gmlng =
drawPoints(&x[0], &ymlng[0], 6, 7);
124 legend->
AddEntry(gg,
"TMath::Gamma()");
125 legend->
AddEntry(gmtg,
"ROOT::Math::tgamma()");
126 legend->
AddEntry(gga,
"TMath::GammaI()");
127 legend->
AddEntry(gmga,
"ROOT::Math::inc_gamma()");
128 legend->
AddEntry(glng,
"TMath::LnGamma()");
129 legend->
AddEntry(gmlng,
"ROOT::Math::lgamma()");
135 cout <<
"Test Done!" << endl;
141 int main(
int argc,
char **argv)
144 for (
Int_t i=1 ; i<argc ; i++) {
145 std::string arg = argv[i] ;
154 cerr <<
"Usage: " << argv[0] <<
" [-g] [-v]\n";
156 cerr <<
" -g : graphics mode\n";
157 cerr <<
" -v : verbose mode";
This class displays a legend box (TPaveText) containing several legend entries.
TGraph * drawPoints(Double_t x[], Double_t y[], int color, int style=1)
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
Double_t Gamma(Double_t z)
Computation of gamma(z) for all z.
double tgamma(double x)
The gamma function is defined to be the extension of the factorial to real numbers.
virtual void Run(Bool_t retrn=kFALSE)
Main application eventloop. Calls system dependent eventloop via gSystem.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
int main(int argc, char **argv)
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
Double_t LnGamma(Double_t z)
Computation of ln[gamma(z)] for all z.
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
double lgamma(double x)
Calculates the logarithm of the gamma function.
double inc_gamma(double a, double x)
Calculates the normalized (regularized) lower incomplete gamma function (lower integral) ...