f= lambda x: -0.1*x**4-0.15*x**3-0.5*x**2-0.25*x+1.2 x=0.5 h=0.25 Dh1=(f(x+2*h)-f(x-2*h))/((x+2*h)-(x-2*h)) Dh2=(f(x+h)-f(x-h))/((x+h)-(x-h)) D=(4*Dh2-Dh1)/3 print('Dh1= %f Dh2= %f D= %f'%(Dh1,Dh2,D))