# differential equations – Passing ParametricNDSolve through NIntegrate?

I am trying to integrate (function2) an integrand (function1) that is a function of a `ParametricNDSolve` output (solution1). This somehow works if I use `Integrate` for function1, as opposed to using `NIntegrate`. But, if I use NIntegrate, I receive a ParametricNDSolve error saying “500 cannot be used as a parameter.” Is there a solution to this? Any help would be greatly appreciated!

Alex

``````a = 0.03; b = d = 1; c = 0.5; K = HMax = 2000; v = 10^(-7);

solution1(g_, t0_) := H(t) /. ParametricNDSolve({X'(t) ==
X(t)*b*H(t)/HMax - X(t)*d*(X(t) + Y(t))/K,
Y'(t) ==
Y(t)*b*(1 - c*g)*H(t)/HMax +
Y(t)*b*(1 - c*g)*g*(1 - H(t)/HMax) - Y(t)*d*(X(t) + Y(t))/K,
H'(t) == Y(t)*b*(1 - c*g)*(1 - H(t)/HMax)*g - a*H(t),
X(0) == ((b E^((b E^(-a t0) K t0)/HMax) K^2)/(d E^(a t0) (-1 +
E^((b E^(-a t0) K t0)/HMax)) HMax + b K)), Y(0) == 1,
H(0) == Exp(-a*t0)*HMax}, {X(t), Y(t), H(t)}, {t, 0,
10000}, {t0}) // First;

function1(g_, t0_) := NIntegrate(t*solution1(g, t0)/K, {t, 0, 200})

function2(g_) :=Block({},1 -Exp(-v*NIntegrate(function1(g, T), {T, 0, 500},Method -> {Automatic, "SymbolicProcessing" -> 0})))

function2(0.4)
``````

Posted on