Re: Problem with combination NDSolve NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg72755] Re: Problem with combination NDSolve NIntegrate
- From: dh <dh at metrohm.ch>
- Date: Thu, 18 Jan 2007 05:22:18 -0500 (EST)
- References: <eol09o$44r$1@smc.vnet.net>
Hi Paul,
Mamthematica tries to evaluate ti[5] and fails. Put ti[5] inside trial[]
and everything works fine:
trial[a_?NumberQ] := ti[5] /. NDSolve[{ti'[t] == ti[t], ti[0] == a}, ti,
{t, 0, 10}][[1]]
Daniel
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
>
>