I want write ROOT or c++ code of this python script:
def ode_func(x, t,a):
sol=lambda a,inits: odeint(ode_func,inits,t,args=(a,))
y = np.ravel(sol(a,inits))
return interp1d(t, y, kind='cubic')
def integrand(z, omm,a):
Ez = 1.0/np.sqrt((omm*(1.0+z)**3 + f2(z)))
def integ(z, omm,a):
integral = integrate.quad(comoving_integrand, 0, z, args=(omm,a))
first solve ODE , interpolated over interval and then use as integrand function “comoving_integrand” and finally integrate it.
Any suggestions would be greatly appreciated
I this this can be done with RDataFrame. I will involve @eguiraud, maybe he knows the answer.
Thank s for the reply.Is it possible I mention @eguiraud for answering or I should change category to ROOTfit?
You do not have to perform any further action :-). I am also inviting @StephanH.
I’m afraid this is really a statistics/scientific computation problem. Maybe @moneta can help.
ROOT is not having any specific code for solving ODE. But there is code to integrate functions, so based on that you could maybe implement the code above in C++.
Otherwise, you can also use th GSL C library, (used internally in ROOT in the MathMore) library, that provides functions to solve ODE systems (see https://www.gnu.org/software/gsl/doc/html/ode-initval.html )
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.