Clear["Global`*"]
pts = {{1, 0}, {2, -1 + 2/E}, {3, -1 + 3/E^2}, {4, -1 + 4/E^3}};
p[x_] = a (x^3) + b (x^2) + c (x) + d;
print["p[x]=", p[x]];
eq1 = p[1] == 0;
eq2 = p[2] == -1 + 2/E;
eq3 = p[3] == -1 + 3/E^2;
eq4 = p[4] == -1 + 4/E^3;
eqns = {eq1, eq2, eq3, eq4};
vars = {a, b, c, d};
solset = Solve[eqns, vars];
Print[TableForm[eqns]];
Print["Solve and get"];
Print[solset];
p[x];
ReplaceAll[p[x],solset[[1]]]; (*Note this is solset subscript [[1]] but I didnt know how to write it onto here*)
p3[x_]=ReplaceAll[p[x],solset[[1]]];(*Note this is solset subscript [[1]] but I didnt know how to write it onto here, it is also p subscript 3*)
Needs["Graphics`Colors`"];
dots = ListPlot[pts, PlotStyle -> {Red,
PointSize[0.02]},
DisplayFunction -> Identity]
gr = Plot[[p3][x], {x, 1.0, 10.0}, PlotStyle -> Blue, DisplayFunction -> Identity]; (Note it is also p subscript 3)
graph1 = Show[gr, dots, PlotRange -> {{0, 10}, {-10, 3}},
Ticks -> {Range[0, 3, 1], Range[0, 3, 1]},
DisplayFunction -> $DisplayFunction]
I am getting an error and the need function as well as there being an issue with posting my curve against the original functions curve. For now, I do see the curve plotted using the show function above but when I try to add the function before the beziur curve, it messes up.
[p3][x]
is invalid syntax. Tryp3[x]
. $\endgroup$Colors
. and 2. Needs:Context GraphicsColors
was not created when Needs was evaluated. It only prints out my Beziur curve $\endgroup$