Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
mathcoreSpecFunc.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_math
3/// \notebook
4/// Example macro showcasing some special mathematical functions.
5///
6/// To execute the macro type in:
7///
8/// ~~~{.cpp}
9/// root[0] .x mathcoreSpecFunc.C
10/// ~~~
11///
12/// It will create a canvas with the representation of the tgamma, lgamma, erf and erfc functions.
13///
14/// \macro_image
15/// \macro_code
16///
17/// \author Andras Zsenei
18
19#include "TF1.h"
20#include "TSystem.h"
21#include "TCanvas.h"
22
23void mathcoreSpecFunc() {
24
25 TF1 *f1a = new TF1("f1a","ROOT::Math::tgamma(x)",0,20);
26 TF1 *f2a = new TF1("f2a","ROOT::Math::lgamma(x)",0,100);
27 TF1 *f3a = new TF1("f3a","ROOT::Math::erf(x)",0,5);
28 TF1 *f4a = new TF1("f4a","ROOT::Math::erfc(x)",0,5);
29
30 TCanvas *c1 = new TCanvas("c1","c1",800,600);
31
32 f1a->SetLineColor(kBlue);
33 f2a->SetLineColor(kBlue);
34 f3a->SetLineColor(kBlue);
35 f4a->SetLineColor(kBlue);
36
37 c1->Divide(2,2);
38
39 c1->cd(1);
40 f1a->Draw();
41 c1->cd(2);
42 f2a->Draw();
43 c1->cd(3);
44 f3a->Draw();
45 c1->cd(4);
46 f4a->Draw();
47
48}
@ kBlue
Definition Rtypes.h:66
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
The Canvas class.
Definition TCanvas.h:23
1-Dim function class
Definition TF1.h:234
return c1
Definition legend1.C:41