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> yb( ARRAYSIZE );
42 vector<Double_t> ymb( ARRAYSIZE );
47 TGraph *gb =
nullptr, *gmb =
nullptr;
48 TCanvas*
c1 =
new TCanvas(
"c1",
"BetaFunction", 600, 400);
51 hpx =
new TH2F(
"hpx",
"BetaFunction(p,b)", ARRAYSIZE, MIN, MAX, ARRAYSIZE, 0, 5);
56 for (
double b = 0.9; b < 2; b+=0.4)
58 cout <<
"** b = " << b <<
" **" << endl;
59 unsigned int index = 0;
63 cout <<
"i:"; cout.width(5); cout << i
64 <<
" index: "; cout.width(5); cout << index
65 <<
" TMath::Beta(p,b): "; cout.width(10); cout <<
TMath::Beta(i,b)
72 if (
std::fabs( yb[index] - ymb[index] ) > ERRORLIMIT )
76 <<
" yb[index] " << yb[index]
77 <<
" ymb[index] " << ymb[index]
78 <<
" " <<
std::fabs( yb[index] - ymb[index] )
92 legend->
AddEntry(gb,
"TMath::Beta()");
93 legend->
AddEntry(gmb,
"ROOT::Math::beta()");
99 cout <<
"Test Done!" << endl;
104 int main(
int argc,
char **argv)
107 for (
Int_t i=1 ; i<argc ; i++) {
108 std::string arg = argv[i] ;
117 cerr <<
"Usage: " << argv[0] <<
" [-g] [-v]\n";
119 cerr <<
" -g : graphics mode\n";
120 cerr <<
" -v : verbose mode";
This class displays a legend box (TPaveText) containing several legend entries.
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
int main(int argc, char **argv)
double beta(double x, double y)
Calculates the beta function.
virtual void Run(Bool_t retrn=kFALSE)
Main application eventloop. Calls system dependent eventloop via gSystem.
TGraph * drawPoints(Double_t x[], Double_t y[], int color, int style=1)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
Double_t Beta(Double_t p, Double_t q)
Calculates Beta-function Gamma(p)*Gamma(q)/Gamma(p+q).
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...