Here is an example of obtaining a formula for f''(x) at a left endpoint. We'll usefour points and a cubic. The points are x_0, x_0+h, x_0+2h, x_0+3h.x1:=x0+h; x2:=x0+2*h; x3:=x0+3*h;Here are the Lagrange Polynomials:L0:=(x-x1)*(x-x2)*(x-x3)/((x0-x1)*(x0-x2)*(x0-x3));L1:=(x-x0)*(x-x2)*(x-x3)/((x1-x0)*(x1-x2)*(x1-x3));L2:=(x-x0)*(x-x1)*(x-x3)/((x2-x0)*(x2-x1)*(x2-x3));L3:=(x-x0)*(x-x1)*(x-x2)/((x3-x0)*(x3-x2)*(x3-x1));The error term is a function of x:E:=F(x)*(x-x0)*(x-x1)*(x-x2)*(x-x3);The full function is P. Differentiate twice and evaluate at x0:P:=y0*L0+y1*L1+y2*L2+y3*L3+E;P1:=simplify(diff(P,x$2));simplify(subs(x=x0,P1));