Problem 19.5.
The function f(x) = e-x can be used to generate the following table of unequally spaced data:
Evaluate the integral from a = 0 to b = 1.2 using (a) analytical means, (b) the trapezoidal rule, and (c) a combination of the trapezoidal and Simpson's rules wherever possible to attain the highest accuracy. For (b) and (c), compute the true percent relative error.
Solution:
(a) The analytical solution can be evaluated as
(b) Apply trapezoidal rule to each segment and sum the results
(c) Apply trapezoidal rule to the first segment (h = 0.1), Simpson's 3/8 rule to the next three segments (h = 0.2), and Simpson's 1/3 rule to the last two segments (h = 0.25). Then, sum the results
No comments:
Post a Comment