ListPlot[{{3,1.6},{4,3.6},{5,4.4},{7,3.4},{8,2.2},{9,2.8},{11,3.8},{12,4.6}}]

Print["Zadacha 1"]
X = {3,4, 5, 7, 8, 9, 11,12};
Y = {1.6, 3.6, 4.4, 3.4, 2.2, 2.8, 3.8,4.6};
n = Length[X];
plotList = 
    ListPlot[Table[{X[[i]], Y[[i]]}, {i, 1, n}]];
f[x_,a_,b_,c_,d_,f_,e_,l_]:=a*x^6+b*x^5+c*x^4+d*x^3+f*x^2+e;
error[x_,y_,a_,b_,c_,d_,f_,e_]:=f[x,a,b,c,d,f,e]-y;
F[a_, b_,c_,d_,f_,e_] := (∑_(i=1)^n)error[ X[[i]],Y[[i]],a,b,c,d,f,e]^2;

solution = Solve[{
D[F[a,b,c,d,f,e],a]==0,
D[F[a,b,c,d,f,e],b]==0,
D[F[a,b,c,d,f,e],c]==0,
D[F[a,b,c,d,f,e],d]==0,
D[F[a,b,c,d,f,e],f]==0,
D[F[a,b,c,d,f,e],e]==0
      }, {a,b,c,d,f,e}]
vals = {a,b,c,d,f,e}/. solution[[1]];
fx[x_]:=vals[[1]]*x^5+vals[[2]]*x^4+vals[[3]]*x^3+vals[[4]]*x^2+vals[[5]]*x+vals[[6]];
Print[fx[8]]
plotFunc = Plot[fx[x], {x, 3, 12}];
Show[plotList, plotFunc]

Print["Zadacha 4"]

n = Input["Vuvedete n:"]
X = Range[-3, 3];
Y= {0,1,3,2,6,4,5};
len = Length[X];
pointPlot = ListPlot[Table[{X[[i]], Y[[i]]}, {i, 1,len}]];
MatA = Table[(∑_(k=1)^len) If[X[[k]]==0,0,X[[k]]^(i+j)], {i, 0, n}, {j, 0, n}];
MatY = Table[(∑_(k=1)^len)If[X[[k]]==0, 0, Y[[k]] * X[[k]]^i], {i, 0, n}];
SolutionCoeff = LinearSolve[MatA, MatY];
Polynomial[x_] = (∑_(k=0)^n)SolutionCoeff[[k+1]]*x^k
plotPoly = Plot[Polynomial[x], {x, X[[1]], X[[len]]}];
Show[ pointPlot, plotPoly]