20void binomialSimple() {
24 printf(
"\nTMath::Binomial simple test\n");
25 printf(
"Build the Tartaglia triangle\n");
26 printf(
"============================\n");
29 for(
Int_t i=0;i<max;i++) {
31 for(j=0;j<(max-i);j++) printf(
" ");
44 const Int_t nmax=10000;
45 printf(
"\nTMath::Binomial fancy test\n");
46 printf(
"Verify Newton formula for (x+y)^n\n");
47 printf(
"x,y in [-2,2] and n from 0 to 9 \n");
48 printf(
"=================================\n");
50 for(
Int_t i=0; i<nmax; i++) {
55 for(
Int_t j=0; j<10; j++) {
58 for(
Int_t k=0; k<=j; k++)
61 printf(
"res1=%e res2=%e x=%e y=%e err=%e j=%d\n",res1,res2,
x,
y,err,j);
65 printf(
"Average Error = %e\n",serr/nmax);
This is the base class for the ROOT Random number generators.
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Double_t Binomial(Int_t n, Int_t k)
Calculate the binomial coefficient n over k.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)