# Formula and functions

    //
    // To see the graphics output of this macro, click  here
    // Here we create a Canvas named "c1" with all default parameters
    //
    gROOT.Reset(c1)
    TCanvas c1(c1)
    //
    // We create a formula object and compute the value of this formula
    // for two different values of the x variable.
    //
    TFormula form1(form1,sqrt(abs(x)))
    form1.Eval(2)
    form1.Eval(-45)
    //
    // Create a one dimensional function and draw it
    //
    TF1 fun1(fun1,abs(sin(x)/x),0,10)
    c1.SetGridx
    c1.SetGridy
    fun1.Draw
    //
    // Before leaving this demo, we print the list of objects known to ROOT
    // using the command "?" and also some statistics.
    //
    ?
    gObjectTable.Print
    exit

    //----------------------------------------------------------------------
    // The log file from this macro is shown below
    //
    Root >  exec formula1.mac
    virtual Double_t  = 1.41421
    virtual Double_t  = 6.7082

    Root >  ?
     ======> Dynamic objects defined = 13
       TROOT        < gROOT>          The ROOT Interactive Interface
       TGXW         < gGXW>           ROOT interface to X11
       TPostScript  < ps>             Default PostScript object
       TStyles      < gStyle>                 Default Style
       TObjectTable < gObjectTable>   Table of active objects
       TClassTable  < gClassTable>    Table of known classes
       TMinuit      < gMinuit>        The Minimization package
       TUnixSystem  < gSystem>        Unix System
       TEnv         < gEnv>           System configuration
       TFile        < f2>             Demo ROOT file with histograms
       TCanvas      < c1>
       TFormula     < form1>          sqrt(abs(x))
       TF1          < fun1>           abs(sin(x)/x)

    Root >  gObjectTable.Print
    Object statistics
    class                     cnt    on heap     size    total size    heap size
    ============================================================================
    TROOT                       1          0    20176         20176            0
    TFile                       1          1      132           132          132
    TList                    2147       2147       36         77292        77292
    TDirectory                  1          1       88            88           88
    TCanvas                     1          1      440           440          440
    TF1                         1          1     1784          1784         1784
    TGaxis                      1          0      120           120            0
    TStyles                     1          1      364           364          364
    TClass                     73         73       76          5548         5548
    TGXW                        1          1      172           172          172
    TPostScript                 1          1      764           764          764
    TObjectTable                1          1       12            12           12
    TClassTable                 1          1       12            12           12
    TMinuit                     1          1    62680         62680        62680
    TUnixSystem                 1          1      252           252          252
    TSignalHandler              1          1       20            20           20
    TEnv                        1          1       24            24           24
    TOrdCollection              3          3       40           120          120
    TFormula                    1          1     1728          1728         1728
    TMethodArg               2203       2203       44         96932        96932
    TMethod                  1909       1909       56        106904       106904
    TDataMember               596        596       44         26224        26224
    TBaseClass                 81         81       36          2916         2916
    TDynamic                   13         13       56           728          728
    TKey                       33         33       64          2112         2112
    TColor                    160        160       40          6400         6400
    TMotifGuiFactory            1          1       28            28           28
    TGeometry                   1          1       64            64           64
    THashList                   4          4       40           160          160
    THashTable                  4          4       36           144          144
    TStopwatch                  1          0       56            56            0
    TDataType                  33         33       56          1848         1848
    TEnvRec                     6          6       48           288          288
    TGlobal                    18         18       36           648          648
    ----------------------------------------------------------------------------
    Total:                   7302       7299    89624        417180       396828
    ============================================================================

[Home page] [Class index] [Top of the page]

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.