#if !defined(__CINT__) || defined(__MAKECINT__) #include #include #include #include #include #include #include #include #endif double binomial(double xx, double norm, double ntrials, double prob); // BINOMIAL density void binomial(){ //gSystem->Load("libMathCore"); TH1F *fteo2 = new TH1F("fteo2","fteo2",100,-0.5,99.5); double ntrials = 10; double prob = 0.2; for (double x=0.;x<100;x+=1.) // fteo2->Fill(x,binomial(x,knorm,ntrials,prob)); //ramona // fteo2->Fill(x,binomial(x,100,ntrials,prob)); //ramona fteo2->Fill(x,binomial(x,100,ntrials,prob)); //ramona TCanvas *c =new TCanvas("c","c"); c->cd(1); fteo2->Draw(); } /////////////////////////////////////////////////////////////////////////// double binomial(double xx, double norm, double ntrials, double prob) { // Double_t BinomialI(Double_t p, Int_t n, Int_t k) // // Double_t n = ROOT::Math::binomial_pdf(xx,prob,ntrials);//TMath::BinomialI(xx,prob,ntrials); // Double_t n = TMath::BinomialI(prob,xx,ntrials); Double_t n = TMath::Binomial(ntrials,xx); cout<<"binomial coeff: "<Load("libMathCore"); TF1 *f1a = new TF1("binomiale p=0.1 n=5","ROOT::Math::binomial_pdf(x,0.1,5)",0,11); TF1 *f1b = new TF1("binomiale p=0.1 n=10","ROOT::Math::binomial_pdf(x,0.1,10)",0,11); TF1 *f1c = new TF1("binomiale p=0.9 n=5","ROOT::Math::binomial_pdf(x,0.9,5)",0,11); TF1 *f1d = new TF1("binomiale p=0.9 n=10","ROOT::Math::binomial_pdf(x,0.9,10)",0,11); TCanvas *c1 = new TCanvas("c1","c1",1000,750); c1->Divide(2,2); c1->cd(1); f1a->Draw(); c1->cd(2); f1b->Draw(); c1->cd(3); f1c->Draw(); c1->cd(4); f1d->Draw(); TF1 *f2a = new TF1("binomiale p=0.4 n=5","ROOT::Math::binomial_pdf(x,0.4,5)",0,11); TF1 *f2b = new TF1("binomiale p=0.4 n=10","ROOT::Math::binomial_pdf(x,0.4,10)",0,11); TF1 *f2c = new TF1("binomiale p=0.5 n=5","ROOT::Math::binomial_pdf(x,0.5,5)",0,11); TF1 *f2d = new TF1("binomiale p=0.5 n=10","ROOT::Math::binomial_pdf(x,0.5,10)",0,11); TCanvas *c2 = new TCanvas("c2","c2",1000,750); c2->Divide(2,2); c2->cd(1); f2a->Draw(); c2->cd(2); f2b->Draw(); c2->cd(3); f2c->Draw(); c2->cd(4); f2d->Draw(); TF1 *f3a = new TF1("binomiale p=0.3 n=5","ROOT::Math::binomial_pdf(x,0.3,5)",0,21); TF1 *f3b = new TF1("binomiale p=0.3 n=10","ROOT::Math::binomial_pdf(x,0.3,10)",0,21); TF1 *f3c = new TF1("binomiale p=0.3 n=20","ROOT::Math::binomial_pdf(x,0.3,20)",0,21); TF1 *f3d = new TF1("binomiale p=0.3 n=30","ROOT::Math::binomial_pdf(x,0.3,30)",0,21); TCanvas *c3 = new TCanvas("c3","c3",1000,750); c3->Divide(2,2); c3->cd(1); f3a->Draw(); c3->cd(2); f3b->Draw(); c3->cd(3); f3c->Draw(); c3->cd(4); f3d->Draw(); } */