# Graph two interpolations together

I have created two functions, inter1=Interpolation[points1] and inter2=Interpolation[points2]. This creates two functions, I then created a graph Manipulate[ListLinePlot[inter1, InterpolationOrder -> n],{n, 0, 6, 1}]. However I need to combine these functions together. I want to be able to graph each function together and manipulate each function separately based on InterpolationOrder. Can someone please help?

This is how far I've come

points = {{1,79},{2,181},{3,181},{4,52},{5,49},{6,8},{7,137},{8,79},{9,112},{10,164}};
inter1 = Interpolation[points];
inter2 = Interpolation[points];
Manipulate[ListLinePlot[inter1, InterpolationOrder -> n], {n,0,6,1}]


Regards

New to Mathematica

• Could you add a minimal complete example ? – b.gates.you.know.what Jul 12 '13 at 7:40
• Ive added what ive done so fare, I just want does functions together and be able to manipulate InterpolationOrder of each function by itself. – ALEXANDER Jul 12 '13 at 7:55
• in the code you posted, where's the diff between inter1 and inter2? – Pinguin Dirk Jul 12 '13 at 8:08
• Use two ListLinePlots and combine them using Show – Sjoerd C. de Vries Jul 12 '13 at 8:10
• There is no difference between inter1 and inter 2. I just want to be able to manipulate the difference in the graph based on interpolation order of each function. Would you be able to show a more specific answere then combining them with Show? Ive just started using mathematica and I dont know how this is done. – ALEXANDER Jul 12 '13 at 8:17

Since the data you provide overlap I created some variation:

points = {{1, 79}, {2, 181}, {3, 181}, {4, 52}, {5, 49}, {6, 8}, {7,
137}, {8, 79}, {9, 112}, {10, 164}};
inter1 = Interpolation[points];
inter2 = Interpolation[
points +
Transpose[{ConstantArray[0, {Length[points]}],
RandomInteger[{-15, 15}, {Length[points]}]}]];
Manipulate[
ListLinePlot[{inter1, inter2}, InterpolationOrder -> n], {n, 0, 6,
1}] Perhaps you are looking for the difference in quality of various interpolation orders:

points = {{1, 79}, {2, 181}, {3, 181}, {4, 52}, {5, 49}, {6, 8}, {7,
137}, {8, 79}, {9, 112}, {10, 164}};
Manipulate[
Plot[Evaluate[
Interpolation[points, InterpolationOrder -> n1][t] -
Interpolation[points, InterpolationOrder -> n2][t]], {t,
Min[points[[All, 1]]], Max[points[[All, 1]]]}], {n1, 0, 6, 1}, {n2,
0, 6, 1}] Yet another alternative:

points = {{1, 79}, {2, 181}, {3, 181}, {4, 52}, {5, 49}, {6, 8}, {7,
137}, {8, 79}, {9, 112}, {10, 164}};
Manipulate[
Plot[Evaluate[{Interpolation[points, InterpolationOrder -> n1][t],
Interpolation[points, InterpolationOrder -> n2][t]}], {t,
Min[points[[All, 1]]], Max[points[[All, 1]]]}], {n1, 0, 6, 1}, {n2,
0, 6, 1}] • This is great, I dont think I am explaining my self well, in this case you have made two different functions because the data overlap. I want the data to overlap, because its the same function, but when I change the Interpolation order(n) to 6 on one function(inter1) and interpolation order (n) to 1 on one function(inter2) then i would be able to see the difference. – ALEXANDER Jul 12 '13 at 8:26
• @ALEXANDER, see the edit. Does that help? – user21 Jul 12 '13 at 8:28
• I don´t know how to explain it, this is all great but I need to functions on top of each other initially. Then when i change one function based on its interpolation order i get one line which is different from the second line. The example shown above i dont understand, because I want two lines and be able to manipulate the interpolation order by itself for each line. – ALEXANDER Jul 12 '13 at 8:35
• @ALEXANDER, most welcome ;-) I like to share my passing for Mathematica. I remember very well when I started using it and did not "get" it. I did not like using Mathematica at all, but slowly I realized to someone had put quite a lot of thought into it. Mathematica's consistency and the benefits of that are amazing. In fact I liked it so much that I started consulting WRI...that's a long story put very short. – user21 Jul 12 '13 at 9:20
• @ALEXANDER Don't forget to upvote Ruebenko's answer if it helps you! – cormullion Jul 12 '13 at 9:42

Just for completeness, here's the Show approach that was suggested:

Manipulate[
Show[
ListLinePlot[inter1,
PlotStyle -> Red,
PlotMarkers -> {Graphics[{Opacity[0.25], Disk[]}], .025},
PlotRange -> All,
InterpolationOrder -> order1],
ListLinePlot[inter2,
PlotStyle -> Blue,
InterpolationOrder -> order2]
],
{order1, 0, 6, 1},
{order2, 0, 6, 1}]
` 