I want to draw a Bessel-function of zeroth order.
Therefore I used
#!/usr/bin python2
from ROOT import *
func=TF1("func","TMath.BesselJ0(x)")
This yields the error
Error in <TFormula::Compile>: Bad numerical expression : "TMath.BesselJ0(x)"
Error in <TF1::TF1>: function: func/TMath.BesselJ0(x) has 0 parameters instead of 1
I don’t know how to solve this. Where is the problem with TMath functions in TF1?
Yes because in the print command you should obey the Python syntax. But there, on the python side, the 2nd parameter of TF1 is just a character string which is passed to TFormula. And that’s TFormula which interpret it … and it follows the C++ syntax.