# # Use a function to instanciate a TF1 object # import ROOT # define the function def myFunc(arr, par): return par[0] + par[1] * arr[0] + par[2] * arr[0] * arr[0] # create a function, need to set the number of parameters f = ROOT.TF1('pyfunc', myFunc, -5., 5.,3) # now set the function parameters f.SetParameters(5., 2., 0.5) # plot the function c = ROOT.TCanvas() f.Draw()