MathGroup Archive 2007

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

Search the Archive

Re: Problem with combination NDSolve NIntegrate


Hi,

Clear[trial]

trial[a_?NumericQ, where_] := (ti[t] /. NDSolve[{ti'[t] == ti[t], ti[0] ==
    a}, ti, {t, 0, 10}][[1]]) /. t -> where

NIntegrate[trial[a, 5], {a, 0, 10}]

and
Plot[trial[a, 5], {a, 0, 10}]

Regards
   Jens

Paul Schneider wrote:
> I am using version 5.2
> 
> 
> 
> NIntegrate tries to evaluate the integrand symbolically. I try to 
> 
> circumvent this by using ?NumberQ but without success. Please try the 
> 
> following toy example:
> 
> 
> 
> trial[a_?NumberQ] :=
> 
>      NDSolve[{ti'[t] == ti[t] , ti[0] == a} , ti, {t, 0, 10}];
> 
> NIntegrate[ (ti[5] /. trial[a]), {a, 0, 10}]
> 
> Plot[ (ti[5] /. trial[a]), {a, 0, 10}]
> 
> 
> 
> NIntegrate does not evaluate to a number and throws a warning, while I 
> 
> get a perfect plot from Plot.
> 
> 
> 
> Does anybody know what to do?
> 
> 
> 
> Cheers,
> 
> 
> 
> Paul
> 
> 


  • Prev by Date: A Series test
  • Next by Date: Re: Problem with combination NDSolve NIntegrate
  • Previous by thread: Re: Problem with combination NDSolve NIntegrate
  • Next by thread: Re: Problem with combination NDSolve NIntegrate