ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
formula1.py
Go to the documentation of this file.
1 #
2 # To see the graphics output of this macro, click begin_html <a href="gif/formula1.gif">here</a>. end_html
3 #
4 
5 from ROOT import TCanvas, TFormula, TF1
6 from ROOT import gROOT, gObjectTable
7 
8 
9 c1 = TCanvas( 'c1', 'Example with Formula', 200, 10, 700, 500 )
10 
11 # We create a formula object and compute the value of this formula
12 # for two different values of the x variable.
13 form1 = TFormula( 'form1', 'sqrt(abs(x))' )
14 form1.Eval( 2 )
15 form1.Eval( -45 )
16 
17 # Create a one dimensional function and draw it
18 fun1 = TF1( 'fun1', 'abs(sin(x)/x)', 0, 10 )
19 c1.SetGridx()
20 c1.SetGridy()
21 fun1.Draw()
22 c1.Update()
23 
24 # Before leaving this demo, we print the list of objects known to ROOT
25 #
26 if ( gObjectTable ):
27  gObjectTable.Print()