Loading [MathJax]/extensions/tex2jax.js
ROOT
6.14/05
Reference Guide
ROOT Home
Main Page
Tutorials
Functional Parts
+
Namespaces
Namespace List
+
Namespace Members
+
All
<
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
<
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
u
w
x
+
Enumerations
a
e
f
g
m
p
t
v
w
y
+
Enumerator
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
w
+
All Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
w
y
+
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Properties
f
+
Related Functions
:
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Files
File List
+
File Members
+
All
1
2
3
4
5
6
7
8
9
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Enumerations
c
e
f
i
l
m
p
r
u
x
+
Enumerator
a
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
u
v
w
+
Macros
1
2
3
4
5
6
7
8
9
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
tutorials
pyroot
formula1.py
Go to the documentation of this file.
1
## \file
2
## \ingroup tutorial_pyroot
3
## \notebook -js
4
## TF1 example.
5
##
6
## \macro_image
7
## \macro_code
8
##
9
## \author Wim Lavrijsen
10
11
from
ROOT
import
TCanvas, TFormula, TF1
12
from
ROOT
import
gROOT, gObjectTable
13
14
c1 =
TCanvas
(
'c1'
,
'Example with Formula'
, 200, 10, 700, 500 )
15
16
# We create a formula object and compute the value of this formula
17
# for two different values of the x variable.
18
form1 =
TFormula
(
'form1'
,
'sqrt(abs(x))'
)
19
form1.Eval( 2 )
20
form1.Eval( -45 )
21
22
# Create a one dimensional function and draw it
23
fun1 =
TF1
(
'fun1'
,
'abs(sin(x)/x)'
, 0, 10 )
24
c1.SetGridx()
25
c1.SetGridy()
26
fun1.Draw()
27
c1.Update()
28
29
# Before leaving this demo, we print the list of objects known to ROOT
30
#
31
if
( gObjectTable ):
32
gObjectTable.Print()
TFormula
The Formula class.
Definition:
TFormula.h:83
TCanvas
The Canvas class.
Definition:
TCanvas.h:31
TF1
1-Dim function class
Definition:
TF1.h:211