I am in the somewhat unfortunate position to try to convert a program from the depths of CERN ROOT to python. In ROOT code (CINT in itself is an abomination imo), one can store mathematical functions as a "string" and pass these along to ROOT for fitting, plotting, etc. because of how ROOT defines these as "strings."
At the moment, the mathematical functions are stored in simple text files as a line, i.e.
(1+[1])^(1+[1])/TMath::Gamma(1+[1]) * x^[1]/[0]^(1+[1]) * exp(-(1+[1])*x/[0])
and are then extracted as strings by C++ when reading in the file. Is there something similar in python? I know of numexpr, but I cant seem to get it to work with the equivalent of the above, i.e.
(1+p[1])**(1+p[1])/scipy.special.Gamma(1+p[1]) * x**p[1]/p[0]**(1+p[1]) * numpy.exp(-(1+p[1])*x/p[0])
Thanks a bunch in advance.
ROOT.TF1
in python, as in C++ – Foust