From $ROOTSYS/tutorials/math/mathBeta.C

// Test the TMath::BetaDist and TMath::BetaDistI functions
// author: Anna Kreshuk

#include "TMath.h"
#include "TCanvas.h"
#include "TF1.h"
#include "TLegend.h"

void mathBeta() {
  TCanvas *c1=new TCanvas("c1", "TMath::BetaDist",600,800);
  c1->Divide(1, 2);
  TVirtualPad *pad1 = c1->cd(1);
  pad1->SetGrid();
  TF1 *fbeta = new TF1("fbeta", "TMath::BetaDist(x, [0], [1])", 0, 1);
  fbeta->SetParameters(0.5, 0.5);
  TF1 *f1 = fbeta->DrawCopy();
  f1->SetLineColor(kRed);
  f1->SetLineWidth(1);
  fbeta->SetParameters(0.5, 2);
  TF1 *f2 = fbeta->DrawCopy("same");
  f2->SetLineColor(kGreen);
  f2->SetLineWidth(1);
  fbeta->SetParameters(2, 0.5);
  TF1 *f3 = fbeta->DrawCopy("same");
  f3->SetLineColor(kBlue);
  f3->SetLineWidth(1);
  fbeta->SetParameters(2, 2);
  TF1 *f4 = fbeta->DrawCopy("same");
  f4->SetLineColor(kMagenta);
  f4->SetLineWidth(1);
  TLegend *legend1 = new TLegend(.5,.7,.8,.9);
  legend1->AddEntry(f1,"p=0.5  q=0.5","l");
  legend1->AddEntry(f2,"p=0.5  q=2","l");
  legend1->AddEntry(f3,"p=2    q=0.5","l");
  legend1->AddEntry(f4,"p=2    q=2","l");
  legend1->Draw();

  TVirtualPad *pad2 = c1->cd(2);
  pad2->SetGrid();
  TF1 *fbetai=new TF1("fbetai", "TMath::BetaDistI(x, [0], [1])", 0, 1);
  fbetai->SetParameters(0.5, 0.5);
  TF1 *g1=fbetai->DrawCopy();
  g1->SetLineColor(kRed);
  g1->SetLineWidth(1);
  fbetai->SetParameters(0.5, 2);
  TF1 *g2=fbetai->DrawCopy("same");
  g2->SetLineColor(kGreen);
  g2->SetLineWidth(1);
  fbetai->SetParameters(2, 0.5);
  TF1 *g3=fbetai->DrawCopy("same");
  g3->SetLineColor(kBlue);
  g3->SetLineWidth(1);
  fbetai->SetParameters(2, 2);
  TF1 *g4=fbetai->DrawCopy("same");
  g4->SetLineColor(kMagenta);
  g4->SetLineWidth(1);

  TLegend *legend2 = new TLegend(.7,.15,0.9,.35);
  legend2->AddEntry(f1,"p=0.5  q=0.5","l");
  legend2->AddEntry(f2,"p=0.5  q=2","l");
  legend2->AddEntry(f3,"p=2    q=0.5","l");
  legend2->AddEntry(f4,"p=2    q=2","l");
  legend2->Draw();
  c1->cd();
}
 mathBeta.C:1
 mathBeta.C:2
 mathBeta.C:3
 mathBeta.C:4
 mathBeta.C:5
 mathBeta.C:6
 mathBeta.C:7
 mathBeta.C:8
 mathBeta.C:9
 mathBeta.C:10
 mathBeta.C:11
 mathBeta.C:12
 mathBeta.C:13
 mathBeta.C:14
 mathBeta.C:15
 mathBeta.C:16
 mathBeta.C:17
 mathBeta.C:18
 mathBeta.C:19
 mathBeta.C:20
 mathBeta.C:21
 mathBeta.C:22
 mathBeta.C:23
 mathBeta.C:24
 mathBeta.C:25
 mathBeta.C:26
 mathBeta.C:27
 mathBeta.C:28
 mathBeta.C:29
 mathBeta.C:30
 mathBeta.C:31
 mathBeta.C:32
 mathBeta.C:33
 mathBeta.C:34
 mathBeta.C:35
 mathBeta.C:36
 mathBeta.C:37
 mathBeta.C:38
 mathBeta.C:39
 mathBeta.C:40
 mathBeta.C:41
 mathBeta.C:42
 mathBeta.C:43
 mathBeta.C:44
 mathBeta.C:45
 mathBeta.C:46
 mathBeta.C:47
 mathBeta.C:48
 mathBeta.C:49
 mathBeta.C:50
 mathBeta.C:51
 mathBeta.C:52
 mathBeta.C:53
 mathBeta.C:54
 mathBeta.C:55
 mathBeta.C:56
 mathBeta.C:57
 mathBeta.C:58
 mathBeta.C:59
 mathBeta.C:60
 mathBeta.C:61
 mathBeta.C:62
 mathBeta.C:63
 mathBeta.C:64
 mathBeta.C:65
 mathBeta.C:66