Re: Combining InterpolatingFunctions
- To: mathgroup at smc.vnet.net
- Subject: [mg107186] Re: Combining InterpolatingFunctions
- From: Roland Franzius <roland.franzius at uos.de>
- Date: Fri, 5 Feb 2010 03:20:53 -0500 (EST)
- References: <hk8nqs$8ne$1@smc.vnet.net>
Simon Pearce schrieb:
> Hi MathGroup,
>
>
>
> I have two sets of InterpolatingFunctions coming from two separate
> NDSolve's. One of them is defined over the region [0,rc] and the other
> over the region [rc,2]. I would like Mathematica to automatically choose
> the correct one when I use a replacement rule. If I could tell it never
> to extrapolate this would be perfect, though I don't seem to be able to.
>
>
>
> I've tried using FunctionInterpolation, but in order to keep my error
> terms down I had to increase the InterpolationPoints to 1000, which
> increases the calculation time from approximately .5sec to 1.5sec.
>
>
>
> Can anyone suggest an efficient way of combining InterpolatingFunctions
> without re-interpolating them? Or turning the extrapolation off!
The interpolating functions have standard data structures, eg
a=NDSolve[{y'[x]== Cos[x],y[0]==1},y,{x,0,2pi} ]//First
b=NDSolve[{y'[x]== -Sin[x],y[2Pi]==(y/.a)[2Pi]},y,{x,2pi,4PI}]//First
a[[1,2,1]] etc
The domains and value tables of a and b can be combined in an obvious
way using Part to construct the joined List of domains and value tables.
The List, then, may be converted Applying InterpolatingFunction.
--
Roland Franzius