Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
11from ROOT import TCanvas, TFormula, TF1
12from ROOT import gROOT, gObjectTable
13
14c1 = 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.
18form1 = TFormula( 'form1', 'sqrt(abs(x))' )
19form1.Eval( 2 )
20form1.Eval( -45 )
21
22# Create a one dimensional function and draw it
23fun1 = TF1( 'fun1', 'abs(sin(x)/x)', 0, 10 )
24c1.SetGridx()
25c1.SetGridy()
26fun1.Draw()
27c1.Update()
28
29# Before leaving this demo, we print the list of objects known to ROOT
30#
31if ( gObjectTable ):
32 gObjectTable.Print()
The Canvas class.
Definition TCanvas.h:23
1-Dim function class
Definition TF1.h:233
The Formula class.
Definition TFormula.h:89