I want write ROOT or c++ code of this python script:
def ode_func(x, t,a):
return -(3*pow(1+t,-1)*(a-1))*x*((1-x)/(1-2*x+a*x))
sol=lambda a,inits: odeint(ode_func,inits,t,args=(a,))
def model(a,inits):
y = np.ravel(sol(a,inits))
return interp1d(t, y, kind='cubic')
def integrand(z, omm,a):
inits=1-omm
f2= model(a,inits)
Ez = 1.0/np.sqrt((omm*(1.0+z)**3 + f2(z)))
return Ez
def integ(z, omm,a):
integral = integrate.quad(comoving_integrand, 0, z, args=(omm,a))[0]
return 300000*(1+z)*integral
first solve ODE , interpolated over interval and then use as integrand function “comoving_integrand” and finally integrate it.
Any suggestions would be greatly appreciated