f(x) is a large matrix and
Topic 2: Numerical Integration To calculate an approximate value of the integral */(x) dx, the interval (a, b) is subdivided into m subintervals of width = (b-a)/m cach. On each subinterval [Xk, Xk+1), where Xx = a + kh, k = 0,1.... m, one of many numerical integration rules (also known as quadrature rules) can be used to approximate the integral, f) dx. For example: Midpoint rule: 8**/(x) dx = f(x), where Rx = ? Trapezoidal rule:*** (x) dx = [(xx) + f(*x+)] Simpson's rule: *P(x) dx = 6) + 4f() + f(*x+)] AX Gauss's 3-point rule: /(x) dx - sr&x-ah) + B/(*) +51 + ah)], where a + The total approximate value of S/(x) dx is then given by the sum of the approximate values on the subintervals. Note that, the larger m, the more accurate the approximation. Note also that different rules require different number of function evaluations for a given m, hence different computational cost. So, to determine relative accuracy of different rules, we need to calculate the error of integration with the same (or similar) number of function evaluations, not the same m. Looking at the rules above, it is not hard to determine the number of function evaluations necessary for the approximation with m subintervals MA2252 Introduction to Computing 2021/22 1-1 Midpoint rule: N =m: Trapezoidal rule: N; = m+1; Simpson's rule: N = 2m + 1. Gauss's 3-point rule: N; = 3m. Task 4 Calculate approximate value of the integral () dx where /(x) is the function defined in Task 2. Obtain results for each of the four rules above with N; = 33. Try to write your code in such a way that it uses not more than N evaluations of function ()
f(x) is a large matrix and
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
f(x) is a large matrix and
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!