Question: Switching from python programming language to matlab. def f(x): return (-0.1*x**4)-(0.15*x**3)-(0.5*x**2)-(0.25*x)+1.2 x=0.5 h=0.0000000001 df=-0.9125 print ('Estimacion ttet ttEt') #Centrada #Primera aproximacion df1=(f(x+h)-f(x-h))/(2*h) et=abs((df-df1)/df)*100 Et=abs(df1-df) print
Switching from python programming language to matlab.
def f(x): return (-0.1*x**4)-(0.15*x**3)-(0.5*x**2)-(0.25*x)+1.2
x=0.5 h=0.0000000001 df=-0.9125
print ('Estimacion \t\tet \t\tEt')
#Centrada #Primera aproximacion df1=(f(x+h)-f(x-h))/(2*h) et=abs((df-df1)/df)*100 Et=abs(df1-df) print ("%f\t %f\t %f" % (df1,et,Et))
#Segunda aproximacion dff1=(-f(x+h*2)+8*f(x+h)-8*f(x-h)+f(x-h*2))/(12*h) et1=abs((df-dff1)/df)*100 Et=abs(dff1-df) print ("%f\t %f\t %f" % (dff1,et1,Et))
Ea=abs((dff1-df1)/dff1)*100 print ("Ea=",Ea)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
