# I am having trouble with the Show[] section of this code

Question: I am unsure how to graph the interpolated graph with the regular graph on the interval $$[1,4]$$. Not even the Show line works about even if I'm pretty sure it's written correctly.

Clear["Global*"]

f[x_] = x e^-x - 1

f;

f;

f;

f;

XY = {{1, -1 + 1/e}, {2, -1 + 2/e^2}, {3, -1 + 3/e^3}, {4, -1 + 4/
e^4}};

p4[x_] = Fit[XY, {1, x, x^2, x^3, x^4}, x]

dots = ListPlot[XY, PlotStyle -> {PointSize[0.02]}];

gr5 = Plot[{f[x], p4[x]}, {x, -0.6, 2.1}, PlotStyle -> {Red, Green}];

Show[gr5, dots, PlotRange -> {{0, 1.2}, {0.0, 1.15}}]


Here you go!

f[x_] := x*Exp[-x - 1];
XY = {{1, -1 + 1/Exp}, {2, -1 + 2/Exp}, {3, -1 + 3/Exp}, {4, -1 + 4/Exp}};
p4 = Fit[XY, {1, x, x^2, x^3, x^4}, x];
dots = ListPlot[XY, PlotStyle -> {PointSize[0.02]}]
gr5 = Plot[{f[x], p4}, {x, -0.6, 2.1}, PlotStyle -> {Red, Green}]
Show[gr5, dots, PlotRange -> {{0, 1.2}, {0., 1.15}}]
` • OHH yes now I see why my code was incomplete.Thank you so much! Although, now I think there must be a mistake with the code itself for I assumed the dots would be on the interpolated functions line, since isn't that the whole point of interpolation hm.. – Sherien Hassan Oct 20 '19 at 21:21