From $ROOTSYS/tutorials/math/mathStudent.C

// tutorial illustrating the use of the Student and F distributions
// author: Anna Kreshuk
   
#include "TMath.h"
#include "TF1.h"
#include "TCanvas.h"
#include <Riostream.h>
#include "TLegend.h"
#include "TLegendEntry.h"

void mathStudent()
{
  //drawing the set of student density functions
  //normal(0, 1) density drawn for comparison
  TCanvas *DistCanvas = new TCanvas("DistCanvas", "Distribution graphs", 10, 10, 1000, 800);  
  DistCanvas->SetFillColor(17);
  DistCanvas->Divide(2, 2);
  DistCanvas->cd(1);
  gPad->SetGrid();
  gPad->SetFrameFillColor(19);
  TLegend *leg = new TLegend(0.6, 0.7, 0.89, 0.89); 

 
  TF1* fgaus = new TF1("gaus", "TMath::Gaus(x, [0], [1], [2])", -5, 5);
  fgaus->SetTitle("Student density");  
  fgaus->SetLineStyle(2);
  fgaus->SetLineWidth(1);
  fgaus->SetParameters(0, 1, kTRUE);
  leg->AddEntry(fgaus->DrawCopy(), "Normal(0,1)", "l");

  TF1* student = new TF1("student", "TMath::Student(x,[0])", -5, 5);
  //student->SetTitle("Student density");  
  student->SetLineWidth(1); 
  student->SetParameter(0, 10);
  student->SetLineColor(4);  
  leg->AddEntry(student->DrawCopy("lsame"), "10 degrees of freedom", "l");
 
  student->SetParameter(0, 3);
  student->SetLineColor(2);
  leg->AddEntry(student->DrawCopy("lsame"), "3 degrees of freedom", "l");

  student->SetParameter(0, 1);
  student->SetLineColor(1);
  leg->AddEntry(student->DrawCopy("lsame"), "1 degree of freedom", "l");

  leg->Draw();

  //drawing the set of student cumulative probability functions
  DistCanvas->cd(2);
  gPad->SetFrameFillColor(19);
  gPad->SetGrid();
  TF1 *studentI = new TF1("studentI", "TMath::StudentI(x, [0])", -5, 5);
  studentI->SetTitle("Student cumulative dist.");  
  studentI->SetLineWidth(1); 
  TLegend *leg2 = new TLegend(0.6, 0.4, 0.89, 0.6); 

  studentI->SetParameter(0, 10);
  studentI->SetLineColor(4);
  leg2->AddEntry(studentI->DrawCopy(), "10 degrees of freedom", "l");
  
  studentI->SetParameter(0, 3);
  studentI->SetLineColor(2);
  leg2->AddEntry(studentI->DrawCopy("lsame"), "3 degrees of freedom", "l");

  studentI->SetParameter(0, 1);
  studentI->SetLineColor(1);
  leg2->AddEntry(studentI->DrawCopy("lsame"), "1 degree of freedom", "l");
  leg2->Draw();

  //drawing the set of F-dist. densities  
  TF1* fDist = new TF1("fDist", "TMath::FDist(x, [0], [1])", 0, 2);
  fDist->SetTitle("F-Dist. density");
  fDist->SetLineWidth(1);
  TLegend* legF1 = new TLegend(0.7, 0.7, 0.89, 0.89);
  
  DistCanvas->cd(3);
  gPad->SetFrameFillColor(19);
  gPad->SetGrid();
 
  fDist->SetParameters(1, 1);
  fDist->SetLineColor(1);
  legF1->AddEntry(fDist->DrawCopy(), "N=1 M=1", "l");

  fDist->SetParameter(1, 10); 
  fDist->SetLineColor(2);
  legF1->AddEntry(fDist->DrawCopy("lsame"), "N=1 M=10", "l");

  fDist->SetParameters(10, 1);
  fDist->SetLineColor(8);
  legF1->AddEntry(fDist->DrawCopy("lsame"), "N=10 M=1", "l");

  fDist->SetParameters(10, 10);
  fDist->SetLineColor(4);
  legF1->AddEntry(fDist->DrawCopy("lsame"), "N=10 M=10", "l");

  legF1->Draw();

  //drawing the set of F cumulative dist.functions
  TF1* fDistI = new TF1("fDist", "TMath::FDistI(x, [0], [1])", 0, 2);
  fDistI->SetTitle("Cumulative dist. function for F");
  fDistI->SetLineWidth(1);
  TLegend* legF2 = new TLegend(0.7, 0.3, 0.89, 0.5);

  DistCanvas->cd(4);
  gPad->SetFrameFillColor(19);
  gPad->SetGrid();
  fDistI->SetParameters(1, 1);
  fDistI->SetLineColor(1);
  legF2->AddEntry(fDistI->DrawCopy(), "N=1 M=1", "l");

  fDistI->SetParameters(1, 10); 
  fDistI->SetLineColor(2);
  legF2->AddEntry(fDistI->DrawCopy("lsame"), "N=1 M=10", "l");
  
  fDistI->SetParameters(10, 1); 
  fDistI->SetLineColor(8);
  legF2->AddEntry(fDistI->DrawCopy("lsame"), "N=10 M=1", "l");
 
  fDistI->SetParameters(10, 10); 
  fDistI->SetLineColor(4);
  legF2->AddEntry(fDistI->DrawCopy("lsame"), "N=10 M=10", "l");

  legF2->Draw();
  DistCanvas->cd();
}


 mathStudent.C:1
 mathStudent.C:2
 mathStudent.C:3
 mathStudent.C:4
 mathStudent.C:5
 mathStudent.C:6
 mathStudent.C:7
 mathStudent.C:8
 mathStudent.C:9
 mathStudent.C:10
 mathStudent.C:11
 mathStudent.C:12
 mathStudent.C:13
 mathStudent.C:14
 mathStudent.C:15
 mathStudent.C:16
 mathStudent.C:17
 mathStudent.C:18
 mathStudent.C:19
 mathStudent.C:20
 mathStudent.C:21
 mathStudent.C:22
 mathStudent.C:23
 mathStudent.C:24
 mathStudent.C:25
 mathStudent.C:26
 mathStudent.C:27
 mathStudent.C:28
 mathStudent.C:29
 mathStudent.C:30
 mathStudent.C:31
 mathStudent.C:32
 mathStudent.C:33
 mathStudent.C:34
 mathStudent.C:35
 mathStudent.C:36
 mathStudent.C:37
 mathStudent.C:38
 mathStudent.C:39
 mathStudent.C:40
 mathStudent.C:41
 mathStudent.C:42
 mathStudent.C:43
 mathStudent.C:44
 mathStudent.C:45
 mathStudent.C:46
 mathStudent.C:47
 mathStudent.C:48
 mathStudent.C:49
 mathStudent.C:50
 mathStudent.C:51
 mathStudent.C:52
 mathStudent.C:53
 mathStudent.C:54
 mathStudent.C:55
 mathStudent.C:56
 mathStudent.C:57
 mathStudent.C:58
 mathStudent.C:59
 mathStudent.C:60
 mathStudent.C:61
 mathStudent.C:62
 mathStudent.C:63
 mathStudent.C:64
 mathStudent.C:65
 mathStudent.C:66
 mathStudent.C:67
 mathStudent.C:68
 mathStudent.C:69
 mathStudent.C:70
 mathStudent.C:71
 mathStudent.C:72
 mathStudent.C:73
 mathStudent.C:74
 mathStudent.C:75
 mathStudent.C:76
 mathStudent.C:77
 mathStudent.C:78
 mathStudent.C:79
 mathStudent.C:80
 mathStudent.C:81
 mathStudent.C:82
 mathStudent.C:83
 mathStudent.C:84
 mathStudent.C:85
 mathStudent.C:86
 mathStudent.C:87
 mathStudent.C:88
 mathStudent.C:89
 mathStudent.C:90
 mathStudent.C:91
 mathStudent.C:92
 mathStudent.C:93
 mathStudent.C:94
 mathStudent.C:95
 mathStudent.C:96
 mathStudent.C:97
 mathStudent.C:98
 mathStudent.C:99
 mathStudent.C:100
 mathStudent.C:101
 mathStudent.C:102
 mathStudent.C:103
 mathStudent.C:104
 mathStudent.C:105
 mathStudent.C:106
 mathStudent.C:107
 mathStudent.C:108
 mathStudent.C:109
 mathStudent.C:110
 mathStudent.C:111
 mathStudent.C:112
 mathStudent.C:113
 mathStudent.C:114
 mathStudent.C:115
 mathStudent.C:116
 mathStudent.C:117
 mathStudent.C:118
 mathStudent.C:119
 mathStudent.C:120
 mathStudent.C:121
 mathStudent.C:122
 mathStudent.C:123
 mathStudent.C:124
 mathStudent.C:125
 mathStudent.C:126
 mathStudent.C:127
 mathStudent.C:128