Hi,
and we have answered questions of that type several million times
and the archive is full of it, anyway
foo[y_?NumericQ] := NIntegrate[z , {z, 0, 1}]
NDSolve[{y'[t] == foo[ y[t]], y[0] == 1}, y[t], {t, 0, 1}]
work as it should.
Regards
Jens
EcoTheory wrote:
> Hello, This is my first Mathematica question ... of many to come, I'm sure. My question is, can you use NIntegrate within NDSolve? My attempts lead to this error:
>
> NIntegrate::inum : Integrand is non - numerical etc.
>
> Here is a simple example:
> NDSolve[{y'[t] == NIntegrate[z y[t], {z, 0, 1}], y[0] == 1}, y[t], {t, 0, 1}]
>
> As far as I can tell, Mathematica does not believe that y[t] is a number. But shouldn't the numerical solver give y[t] as a number to NIntegrate?
>
> Obviously, Mathematica can do this problem easily enough using Integrate instead of NIntegrate, but it cannot integrate the messier double integral in the actual system of ODE's I want to solve. Thanks for suggestions.
>