Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Convert from python language to matlab. def f(x): return 0.2+(25*x)-(200*x**2)+(675*x**3)-(900*x**4)+(400*x**5) a=0 b=0.8 n=1 print ('n tt h tt I tt ea tt et tt Ea')

Convert from python language to matlab.

def f(x): return 0.2+(25*x)-(200*x**2)+(675*x**3)-(900*x**4)+(400*x**5)

a=0 b=0.8 n=1 print ('n \t\t h \t\t I \t\t ea \t\t et \t\t Ea')

while n<11: n=n+2 h=(b-a)/n suma=0 suma1=0

for i in range (1,n,2): xi=a+i*h suma=suma+f(xi) for j in range (2,n,2): xj=a+j*h suma1=suma1+f(xj) I=(b-a)*(f(a)+4*suma+2*suma1+f(b))/(3*n) Ia=I Ea=-((b-a)**(5)*(-2400))/(180*n**4) ea=abs((I-Ia)/I)*100 et=abs((1.640533-I)/1.640533)*100 print ('%f\t %f\t %f\t %f\t %f\t %f'% (n,h,I,ea,et,Ea))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions