Re: using InterpolationFunction in NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg42573] Re: [mg42552] using InterpolationFunction in NDSolve
- From: Selwyn Hollis <selwynh at earthlink.net>
- Date: Wed, 16 Jul 2003 09:13:35 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Rich,
You just need to pull the solution out of the list that it's in. Try
this:
sol=NDSolve[{f'[x]==E^-x,f[0]==0},f[x],{x,0,1}];
fi[x_] = First[ f[x]/.sol ];
NDSolve[{f'[x]==fi[x],f[0]==0},f[x],{x,0,1}]
-----
Selwyn Hollis
http://www.math.armstrong.edu/faculty/hollis
On Tuesday, July 15, 2003, at 02:54 AM, 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
>
>
>