Re: Combining several InterploatingFunction to one
- To: mathgroup at smc.vnet.net
- Subject: [mg30254] Re: Combining several InterploatingFunction to one
- From: Max Ulbrich <ulbrich at biochem.mpg.de>
- Date: Sat, 4 Aug 2001 01:14:22 -0400 (EDT)
- References: <9kb06q$c4d$1@smc.vnet.net> <9kdb83$f1k$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Jens, thanks for your answer! This works really well if the number of x- and y-values in the InterpolatingFunction are equal. However, when I tried to apply it to my problem, it didn't work! You can see the problem when you try to combine Sin1 and Sin2 from Sin1 = n /. NDSolve[{n''[x] == -n[x], n[0] == 0, n'[0] == 1}, n, {x, 0, 2}][[1]] Sin2 = n /. NDSolve[{n''[x] == -n[x], n[2] == Sin1[2], n'[2] == Sin1'[2]}, n, {x, 2, 4}][[1]] I found the difference using InputForm[Sin1]. In your answer, you get an interpolation table in your Sin interpolations with the same number of x- and y-values. In my example, the lists have various lengths. Do you have any idea how to proceed now? Max >Hi, > >have the functions continuous derivatives at the interval ends ??? >If yes > >GlueInterpolation[ips : {__InterpolatingFunction}] := > Module[{dta}, > dta = > Union[Transpose[ > Join @@@ Transpose[{#[[3, 1]], Last[Last[#]]} & /@ ips]]]; > Interpolation[dta] > ] > > >and > >itab = Table[ > FunctionInterpolation[Sin[x], {x, i*0.6, (i + 1)*0.6}], {i, 0, 2}]; > >dd = GlueInterpolation[itab]; > >Plot[Evaluate[dd[x]], {x, 0, 1.8}]; > >works fine. You should be carefull look if you have a argument >in the interpolation function. > >Regards > Jens > > >Max Ulbrich wrote: > > Hi, > > does anyone know how to combine several interpolating functions to ONE > single interploating function? > I now have > > Which[0. <= t <= 0.01, InterpolatingFunction[{{0., 0.01}}, "<>"], > 0.01 <= t <= 0.02, InterpolatingFunction[{{0.01, 0.02}}, "<>"], > 0.02 <= t <= 0.03, InterpolatingFunction[{{0.02, 0.03}}, > "<>"]][t] > > but I would like to have > > InterpolatingFunction[{{0., 0.03}}, "<>"][t] > > that is piecewise defined from all of the three. > Suggestions please to > > ulbrich at biochem.mpg.de > > Thanks! > > Max