f[x_]=Log[1+x]; 
dfdx[x_]=D[f[x],{x,1}]
d4fdx4[x_]=D[f[x],{x,4}]

x0=0
x1=.6
x2=.9
f0=f[x0]
f1=f[x1]
f2=f[x2]
f01=(f1-f0)/(x1-x0)
f12=(f2-f1)/(x2-x1)
f012=(f12-f01)/(x2-x0)

Linear[x_]=f0+f01*(x-x0)
Quadratic[x_]=f0+f01*(x-x0)+f012*(x-x0)*(x-x1)
Plot[{f[x],Linear[x],Quadratic[x]},{x,x0,x2},PlotStyle->{Red,Blue,Green}]

Linear[.45]
Abs[Linear[.45]-f[.45]]
Quadratic[.45]
Abs[Quadratic[.45]-f[.45]]

f[x_]=Exp[2x]; 
dfdx[x_]=D[f[x],{x,1}]
d4fdx4[x_]=D[f[x],{x,4}]

x0=0
x1=.25
x2=.5
x3=.75
a=.43
f0=f[x0]
f1=f[x1]
f2=f[x2]
f3=f[x3]
f01=(f1-f0)/(x1-x0)
f12=(f2-f1)/(x2-x1)
f23=(f3-f2)/(x3-x2)
f012=(f12-f01)/(x2-x0)
f123=(f23-f12)/(x3-x1)
f0123=(f123-f012)/(x3-x0)

Linear[x_]=f1+f12*(x-x1)
Quadratic[x_]=Linear[x]+f123*(x-x1)*(x-x2)
Cubic[x_]=Quadratic[x]+f0123*(x-x1)*(x-x2)*(x-x3)
Plot[{f[x],Linear[x],Quadratic[x],Cubic[x]},{x,x0,x3},PlotStyle->{Red,Blue,Green}]

Linear[a]
Abs[Linear[a]-f[a]]
Quadratic[a]
Abs[Quadratic[a]-f[a]]
Cubic[a]
Abs[Cubic[a]-f[a]]

f[x_]=x*Log[x]; 
d2fdx2[x_]=D[f[x],{x,2}]
d3fdx3[x_]=D[f[x],{x,3}]

x0=8.1
x1=8.3
x2=8.6
x3=8.7
a=8.4
f0=f[x0]
f1=f[x1]
f2=f[x2]
f3=f[x3]
f01=(f1-f0)/(x1-x0)
f12=(f2-f1)/(x2-x1)
f23=(f3-f2)/(x3-x2)
f012=(f12-f01)/(x2-x0)
f123=(f23-f12)/(x3-x1)
f0123=(f123-f012)/(x3-x0)

Linear[x_]=f1+f12*(x-x1)
Quadratic[x_]=Linear[x]+f123*(x-x1)*(x-x2)
Cubic[x_]=Quadratic[x]+f0123*(x-x1)*(x-x2)*(x-x3)
Plot[{f[x],Linear[x],Quadratic[x],Cubic[x]},{x,x0,x3},PlotStyle->{Red,Blue,Green}]

Linear[a]
Abs[Linear[a]-f[a]]
Quadratic[a]
Abs[Quadratic[a]-f[a]]
Cubic[a]
Abs[Cubic[a]-f[a]]

ActualErrorLinear=Abs[Linear[a]-f[a]]
ErrorBoundLinear=Abs[d2fdx2[x1]/Factorial[2]*(a-x1)*(a-x2)]
ActualErrorQuadratic=Abs[Quadratic[a]-f[a]]
ErrorBoundQuadratic=Abs[d3fdx3[x1]/Factorial[3]*(a-x1)*(a-x2)*(a-x3)]

Expand[Quadratic[x]]

Quadratic[x0]
Quadratic[x1]
Quadratic[x2]
Quadratic[x3]

f[x_]=Exp[2x]; 
d2fdx2[x_]=D[f[x],{x,2}]
d3fdx3[x_]=D[f[x],{x,3}]

x0=0
x1=.25
x2=.5
x3=.75
a=.43
f0=f[x0]
f1=f[x1]
f2=f[x2]
f3=f[x3]
f01=(f1-f0)/(x1-x0)
f12=(f2-f1)/(x2-x1)
f23=(f3-f2)/(x3-x2)
f012=(f12-f01)/(x2-x0)
f123=(f23-f12)/(x3-x1)
f0123=(f123-f012)/(x3-x0)

Linear[x_]=f1+f12*(x-x1)
Quadratic[x_]=Linear[x]+f012*(x-x1)*(x-x2)
Cubic[x_]=Quadratic[x]+f0123*(x-x1)*(x-x2)*(x-x3)
Plot[{f[x],Linear[x],Quadratic[x],Cubic[x]},{x,x0,x3},PlotStyle->{Red,Blue,Green,Black}]

ActualErrorLinear=Abs[Linear[a]-f[a]]
ErrorBoundLinear=Abs[d2fdx2[x2]/Factorial[2]*(a-x1)*(a-x2)]
ActualErrorQuadratic=Abs[Quadratic[a]-f[a]]
ErrorBoundQuadratic=Abs[d3fdx3[x2]/Factorial[3]*(a-x1)*(a-x2)*(a-x3)]