Re: using InterpolationFunction in NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg42566] Re: using InterpolationFunction in NDSolve
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 16 Jul 2003 09:13:30 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <bf08jt$sl$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
sol = NDSolve[{f'[x] == E^-x, f[0] == 0}, f[x], {x, 0, 1}]
fi[x_?NumericQ] := Evaluate[f[x] /. sol[[1]]]
NDSolve[{y'[x] == fi[x], y[0] == 1}, y[x], {x, 0, 1}]
work fine. You have to select which solution of NDSolve[]
you want.
Regards
Jens
"Hammond, Richard (Civ, ARL/ARO)" wrote:
>
> Hi,
>
> How can you use an InterpolationFunction object
> in NDSolve? For example suppose you define
>
> sol=NDSolve[{f'[x]==E^-x,f[0]==0},f[x],{x,0,1}]
> fi[x_]:=Evaluate[f[x]/.sol]
>
> Ok, now we have fi[x], but if I try to use it in
> NDSolve, or even NSolve, it does not work (although
> I can do an NIntegrate with it, and of course plot it).
>
> The same, or related, problems occurs if fi[x] is defined
> from NIntegrate.
>
> Thanks
>
> Rich Hammond