Re: Merging InterpolatingFunctions
- To: mathgroup at smc.vnet.net
- Subject: [mg9734] Re: Merging InterpolatingFunctions
- From: "Stephen P Luttrell" <luttrell at signal.dra.hmg.gb>
- Date: Tue, 25 Nov 1997 00:06:35 -0500
- Organization: Defence Evaluation and Research Agency
- Sender: owner-wri-mathgroup at wolfram.com
> I have a set of InterpolatingFunctions, such that the endpoint of each > is the starting point of the next. Is there any way to merge them into > one InterpolationFunction? I tried myself and produced the following > program: > > Merge[f1_,f2_] := Module[{Start,Stop}, Start=Extract[f1,{1,1,1}]; > Stop = Extract[f2,{1,1,2}]; > Part1 = Extract[f1,2]; > Part21=Extract[f1,{3,1}]; > Part22=Delete[Extract[f2,{3,1}],1]; Part31= Extract[f1,4]; > Part32=Delete[Extract[f2,4],1]; > InterpolatingFunction[{{Start,Stop}},Part1,{Join[Part21,Part22]}, > Join[Part31, Part32]] > ]; > > I guessed the meaning of the entries in an InterpolatingFunction from > looking at examples, and the program does work in many cases. But > sometimes it produces an expression that looks to me like an > InterpolationFunction, but is not treated as one by Mathematica. > Unfortunately, I did not find a full documentation of > InterpolatingFunction Objects. > Can anybody help me with this? The documentation on FunctionInterpolation (Mathematica 3 Help Browser) states: "You can use FunctionInterpolation to generate a single InterpolatingFunction object from an expression containing several such objects." Here is demonstration of this, where I create 2 InterpolatingFunction objects (f1 and f2), which I then combine to make a single such object (f12) that works over the whole range. f1 = FunctionInterpolation[E^(-x^2), {x, -1, 0}] f2 = FunctionInterpolation[E^(-x^2), {x, 0, 1}] f12 = FunctionInterpolation[Which[-1 <= x <= 0, f1[x], 0 <= x <= 1, f2[x]], {x, -1, 1}] -- Stephen P Luttrell luttrell at signal.dra.hmg.gb Adaptive Systems Theory 01684-894046 (phone) Room EX21, DERA 01684-894384 (fax) Malvern, Worcs, WR14 3PS, U.K. http://www.dra.hmg.gb/cis5pip/Welcome.html