In some unsuccessful situation, I am trying to convert a program from the depths of CERN ROOT to python. In the ROOT code (CINT itself is an abomination of imo), you can store mathematical functions as a "string" and pass them along with ROOT for fitting, building, etc. Because of how ROOT defines them as "strings".
Currently, mathematical functions are stored in simple text files as a string, i.e.
(1+[1])^(1+[1])/TMath::Gamma(1+[1]) * x^[1]/[0]^(1+[1]) * exp(-(1+[1])*x/[0])
and then retrieved as C ++ strings when read in a file. Is there something similar in python? I know about numexpr, but I cannot get it to work with the equivalent 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 for the bunch in advance.
source share