mathGammaNormal.C: tutorial illustrating the use of TMath::GammaDist and TMath::LogNormal | Math tutorials | mathStudent.C: tutorial illustrating the use of the Student and F distributions |
// Test the TMath::LaplaceDist and TMath::LaplaceDistI functions // author: Anna Kreshuk #include "TMath.h" #include "TCanvas.h" #include "TF1.h" #include "TLegend.h" void mathLaplace(){ TCanvas *c1=new TCanvas("c1", "TMath::LaplaceDist",600,800); c1->Divide(1, 2); TVirtualPad *pad1 = c1->cd(1); pad1->SetGrid(); TF1 *flaplace = new TF1("flaplace", "TMath::LaplaceDist(x, [0], [1])", -10, 10); flaplace->SetParameters(0, 1); TF1 *f1 = flaplace->DrawCopy(); f1->SetLineColor(kRed); f1->SetLineWidth(1); flaplace->SetParameters(0, 2); TF1 *f2 = flaplace->DrawCopy("same"); f2->SetLineColor(kGreen); f2->SetLineWidth(1); flaplace->SetParameters(2, 1); TF1 *f3 = flaplace->DrawCopy("same"); f3->SetLineColor(kBlue); f3->SetLineWidth(1); flaplace->SetParameters(2, 2); TF1 *f4 = flaplace->DrawCopy("same"); f4->SetLineColor(kMagenta); f4->SetLineWidth(1); TLegend *legend1 = new TLegend(.7,.7,.9,.9); legend1->AddEntry(f1,"alpha=0 beta=1","l"); legend1->AddEntry(f2,"alpha=0 beta=2","l"); legend1->AddEntry(f3,"alpha=2 beta=1","l"); legend1->AddEntry(f4,"alpha=2 beta=2","l"); legend1->Draw(); TVirtualPad *pad2 = c1->cd(2); pad2->SetGrid(); TF1 *flaplacei=new TF1("flaplacei", "TMath::LaplaceDistI(x, [0], [1])", -10, 10); flaplacei->SetParameters(0, 1); TF1 *g1=flaplacei->DrawCopy(); g1->SetLineColor(kRed); g1->SetLineWidth(1); flaplacei->SetParameters(0, 2); TF1 *g2=flaplacei->DrawCopy("same"); g2->SetLineColor(kGreen); g2->SetLineWidth(1); flaplacei->SetParameters(2, 1); TF1 *g3=flaplacei->DrawCopy("same"); g3->SetLineColor(kBlue); g3->SetLineWidth(1); flaplacei->SetParameters(2, 2); TF1 *g4=flaplacei->DrawCopy("same"); g4->SetLineColor(kMagenta); g4->SetLineWidth(1); TLegend *legend2 = new TLegend(.7,.15,0.9,.35); legend2->AddEntry(f1,"alpha=0 beta=1","l"); legend2->AddEntry(f2,"alpha=0 beta=2","l"); legend2->AddEntry(f3,"alpha=2 beta=1","l"); legend2->AddEntry(f4,"alpha=2 beta=2","l"); legend2->Draw(); c1->cd(); } mathLaplace.C:1 mathLaplace.C:2 mathLaplace.C:3 mathLaplace.C:4 mathLaplace.C:5 mathLaplace.C:6 mathLaplace.C:7 mathLaplace.C:8 mathLaplace.C:9 mathLaplace.C:10 mathLaplace.C:11 mathLaplace.C:12 mathLaplace.C:13 mathLaplace.C:14 mathLaplace.C:15 mathLaplace.C:16 mathLaplace.C:17 mathLaplace.C:18 mathLaplace.C:19 mathLaplace.C:20 mathLaplace.C:21 mathLaplace.C:22 mathLaplace.C:23 mathLaplace.C:24 mathLaplace.C:25 mathLaplace.C:26 mathLaplace.C:27 mathLaplace.C:28 mathLaplace.C:29 mathLaplace.C:30 mathLaplace.C:31 mathLaplace.C:32 mathLaplace.C:33 mathLaplace.C:34 mathLaplace.C:35 mathLaplace.C:36 mathLaplace.C:37 mathLaplace.C:38 mathLaplace.C:39 mathLaplace.C:40 mathLaplace.C:41 mathLaplace.C:42 mathLaplace.C:43 mathLaplace.C:44 mathLaplace.C:45 mathLaplace.C:46 mathLaplace.C:47 mathLaplace.C:48 mathLaplace.C:49 mathLaplace.C:50 mathLaplace.C:51 mathLaplace.C:52 mathLaplace.C:53 mathLaplace.C:54 mathLaplace.C:55 mathLaplace.C:56 mathLaplace.C:57 mathLaplace.C:58 mathLaplace.C:59 mathLaplace.C:60 mathLaplace.C:61 mathLaplace.C:62 mathLaplace.C:63 mathLaplace.C:64 mathLaplace.C:65 mathLaplace.C:66 |
|