In: Physics
\(\int_{0}^{\pi}e^xsinx dx\) with n=6 subdivisions
1) Find the exact value of the integral
2) Approximate the integral using the trapezoidal rule, midpoint rule and simpson rule.
3) Find the errors using each of these rules
4) For each of these rules, show how large n should be, to be within .0001 of the actual answer.
dividing in 6 subdivisions 0, pi/6 , 2pi/6 , 3pi/6, 4pi/6, 5pi/6, pi
hence value of function f =e^x *sin x at these 7 values are
f0 =0
f1 =e^(pi/6) *sin pi/6 =0.84
f2 =2.4655
f3 =4.81
f4 =7.03
f5 =6.86
f6 =e^(pi) *sin pi = 0
BY
Trapezoidal rule
given integral = [(h)/2] *(f0 +f6 +2(f1+f2+f3 +f4+f5))
here h is difference between to consecutive x ie pi/6
hence given integral by trapezoidal rule is =11.51
...........
by midpoint rule GIVEN INTEGRAL IS calculated at midpoints ie at x =3pi/6
hence at 3pi/6
fx =e^(3pi/6) *sin 3pi/6 =4.81
...
hence by midpoint rule given integral is 4.81*(3pi/6) = 7.55
.........................
by simpsons rule
int =h/3 (f0 +4(f1+f3+f5) +2(f2+f4) +f6)
f0 to f6 are same as calculated in first part
h =pi/6
hence given intgral =18.063
.................
f" =d^2(e^xsinx) /dx^2 =d(e^x cosx +e^x sinx)/dx =-e^x sinx +e^x cos x +e^x cosx +e^x sinx =2e^x cosx
it has maximum value at x =pi as e^x is increasing with x and max value of cos x is =1 at pi
d
for error calculation f" taken which is max for limits ,, here coming out on pi
f" (pi) =46.21
n =6
error in trapezoidal rule = (pi - 0)^3/12n^2 *f" = 10.398
for 0.0001 error we have (pi - 0)^3/12n^2 *f" = 0.0001
hence n =1091 intervals
...........
for error in si,pson rule take b =pi a = 0 ie limits
error in simpsons rule =((b-a)/2)^5* f"" /90
f'''' =d^2 f" /dx^2
we have calculated f'' for the trapezoidal rule
hence f" =2 e^x cosx
hence d^2 2e^xcosx /dx^2 =2*d(-e^x sinx+e^xcosx)/dx = 2*(-e^xcosx -e^x sinx -e^x sin x +e^x cosx ) = -4 e^xsinx
max value at x =3 pi /4
hence f"" =29.84 .. we have to take mod value.. as we are finding error
..
hence error =3.16