I want to NIntegrate
my NDSolve
result. I don't have a exact function form because it is coming from the NDSolve
result. It looks like Integrate
only permit numerical forms.
The function y1[t]
could be solved through several differential equations:
S1 = NDSolve[{y1'[t] == -0.9*y1[t] + SuperPlus[z1][t] +
SuperMinus[z2][t] + 0.005*SuperPlus[z1][t]*y2[t] +
0.008*SuperMinus[z2][t]*y2[t] + 0.005*x[t]*SuperPlus[z1][t] +
0.008*x[t]*SuperMinus[z2][t] - 0.008*y1[t]*SuperMinus[z1][t] -
0.005*y1[t]*SuperPlus[z2][t],
y2'[t] == -0.8*y2[t] + SuperPlus[z2][t] + SuperMinus[z1][t] +
0.008*y1[t]*SuperMinus[z1][t] + 0.005*y1[t]*SuperPlus[z2][t] +
0.005*x[t]*SuperPlus[z2][t] + 0.008*x[t]*SuperMinus[z1][t] -
0.005*SuperPlus[z1][t]*y2[t] - 0.008*SuperMinus[z2][t]*y2[t],
SuperPlus[z1]'[t] == 0.63*y1[t] - SuperPlus[z1][t],
SuperPlus[z2]'[t] == 0.64*y2[t] - SuperPlus[z2][t],
SuperMinus[z1]'[t] == 0.27*y1[t] - SuperMinus[z1][t],
SuperMinus[z2]'[t] == 0.16*y2[t] - SuperMinus[z2][t],
x[t] + y1[t] + y2[t] + SuperPlus[z1][t] + SuperPlus[z2][t] +
SuperMinus[z1][t] + SuperMinus[z2][t] == 50000000,
SuperPlus[z1][0] == SuperPlus[z2][0] == SuperMinus[z1][0] ==
SuperMinus[z2][0] == 0, y1[0] == y2[0] == 10000000,
x[0] == 30000000}, {x, y1, y2, SuperPlus[z1], SuperMinus[z1],
SuperPlus[z2], SuperMinus[z2]}, {t, 0, 100}]
The result is quite clear in image:
Plot[Evaluate[y1[t] /. S1], {t, 0, 100}, PlotStyle -> Blue,
AxesOrigin -> {0, 0}, PlotRange -> All]
While, I can't use NIntegrate
or Integrate
to this function y1[t]
. It doesn't give me result.
NIntegrate[Boole[y1[t]], {t, 0, 100}]
NIntegrate::inumr: The integrand Boole[y1[t]] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,100}}. >>
What should I do? Shall I use Monte Carlo method??
Plot[Evaluate[y1[t] /. S1], {t, 0, 100}]
works, thenNIntegrate[Evaluate[y1[t] /. S1], {t, 0, 100}]
probably will. The similarity in the syntax of related functions is by design. $\endgroup$