SetDirectory[NotebookDirectory[]]

"Implement the Lagrange polynomial function for interpolation purpose, using dat_gaussian.dat as sample data. Compare the result against those obtained using Interpolation"
rawdata=Import["gaussian.dat"]
lp=ListPlot[rawdata]
y=Interpolation[rawdata];
plt=Plot[y[x],{x,25,30}];
Show[plt,lp]

lrawdata=Length[rawdata];
xdat[i_]:=rawdata[[i,1]];ydat[i_]:=rawdata[[i,2]];
r[x_,j_,k_]:=(x-xdat[k])/(xdat[j]-xdat[k]);
Pxj[x_,j_]:=ydat[j]*Product[r[x,j,k],{k,1,j-1}]*Product[r[x,j,k],{k,j+1,lrawdata}];
P[x_]:=Sum[Pxj[x,j],{j,1,lrawdata}];
pltP=Plot[P[x],{x,25,30},PlotStyle->Red];
Show[plt,lp,pltP]