-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathmathcoreSpecFunc.C
48 lines (40 loc) · 1016 Bytes
/
mathcoreSpecFunc.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/// \file
/// \ingroup tutorial_math
/// \notebook
/// Example macro showcasing some special mathematical functions.
///
/// To execute the macro type in:
///
/// ~~~{.cpp}
/// root[0] .x mathcoreSpecFunc.C
/// ~~~
///
/// It will create a canvas with the representation of the tgamma, lgamma, erf and erfc functions.
///
/// \macro_image
/// \macro_code
///
/// \author Andras Zsenei
#include "TF1.h"
#include "TSystem.h"
#include "TCanvas.h"
void mathcoreSpecFunc() {
TF1 *f1a = new TF1("f1a","ROOT::Math::tgamma(x)",0,20);
TF1 *f2a = new TF1("f2a","ROOT::Math::lgamma(x)",0,100);
TF1 *f3a = new TF1("f3a","ROOT::Math::erf(x)",0,5);
TF1 *f4a = new TF1("f4a","ROOT::Math::erfc(x)",0,5);
TCanvas *c1 = new TCanvas("c1","c1",800,600);
f1a->SetLineColor(kBlue);
f2a->SetLineColor(kBlue);
f3a->SetLineColor(kBlue);
f4a->SetLineColor(kBlue);
c1->Divide(2,2);
c1->cd(1);
f1a->Draw();
c1->cd(2);
f2a->Draw();
c1->cd(3);
f3a->Draw();
c1->cd(4);
f4a->Draw();
}