Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
mathcoreStatFunc.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_math
3/// \notebook
4/// Example macro showing some major probability density functions in ROOT.
5/// The macro shows four of them with
6/// respect to their two variables. In order to run the macro type:
7///
8/// ~~~{.cpp}
9/// root [0] .x mathcoreStatFunc.C
10/// ~~~
11///
12/// \macro_image
13/// \macro_code
14///
15/// \author Andras Zsenei
16
17#include "TF2.h"
18#include "TSystem.h"
19#include "TCanvas.h"
20
21void mathcoreStatFunc() {
22
23 TF2 *f1a = new TF2("f1a","ROOT::Math::cauchy_pdf(x, y)",0,10,0,10);
24 TF2 *f2a = new TF2("f2a","ROOT::Math::chisquared_pdf(x,y)",0,20, 0,20);
25 TF2 *f3a = new TF2("f3a","ROOT::Math::gaussian_pdf(x,y)",0,10,0,5);
26 TF2 *f4a = new TF2("f4a","ROOT::Math::tdistribution_pdf(x,y)",0,10,0,5);
27
28 TCanvas *c1 = new TCanvas("c1","c1",800,650);
29
30 c1->Divide(2,2);
31
32 c1->cd(1); f1a->SetLineWidth(1);
33 f1a->Draw("surf1");
34 c1->cd(2); f2a->SetLineWidth(1);
35 f2a->Draw("surf1");
36 c1->cd(3); f3a->SetLineWidth(1);
37 f3a->Draw("surf1");
38 c1->cd(4); f4a->SetLineWidth(1);
39 f4a->Draw("surf1");
40}
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:43
The Canvas class.
Definition TCanvas.h:23
A 2-Dim function with parameters.
Definition TF2.h:29
void Draw(Option_t *option="") override
Draw this function with its current attributes.
Definition TF2.cxx:259
return c1
Definition legend1.C:41