Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NIntegrate in NDSolve?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89092] Re: NIntegrate in NDSolve?
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sun, 25 May 2008 03:24:24 -0400 (EDT)
  • References: <g18hon$kg7$1@smc.vnet.net>

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.
> 


  • Prev by Date: Re: Caution! Reuse of variables within Manipulate
  • Next by Date: Re: NIntegrate in NDSolve?
  • Previous by thread: Re: NIntegrate in NDSolve?
  • Next by thread: Re: NIntegrate in NDSolve?