Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'software solution for engineers and scientist episode 5', kỹ thuật - công nghệ, cơ khí - chế tạo máy phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 334 Chapter 12 Figure 12.14 Solving the Trapezoids In the case shown in Figure 12.14 the trapezoid labeled A has heights hl and h2 and base b. The area of this trapezoid is obtained by the formula ._b h h2 Area 1 2 2 In this case h corresponds with the value y1 and h2 with y2. The base b is obtained by subtracting x2 minus x1. Thus in terms of the coordinate points the area A1 of the first trapezoid is calculated by the formula A x2 - 1Xyi y2 1 2 The remaining trapezoids can be obtained similarly. The general formula is easier to derive if we assume that the coordinate points are equally spaced along the x axis. Therefore the value b is the same for all trapezoids. In this case the area under a curve defined by N trapezoids between points a and b can be approximated by the equation b b J f x dx yi 2 yk yN 1 a 2 k 2 This equation which is one of the Newton-Cotes formulae is called the trapezoidal rule. It allows computing the integral from the curve s equation or from data points obtained experimentally as long as the x-axis points are equidistant. When the curve s equation is at hand the calculations can place the data points as close as necessary to approximate the integral to any degree of accuracy. On the other hand experimentally collected information is limited to the furnished data points. Interpolation Differentiation and Integration 335 In cases in which the .c-axis points are not equidistant we cannot use the same base for all trapezoids. In this case the formula becomes a sum of the areas of the individual trapezoids f Xid ỵ a k 1 xk - xk 1 yk yk 1 2 where N is the number of points in the data arrays. A computer algorithm is easily developed to accommodate the case in which the x-axis coordinates may not be equidistant. This requires calculating the base of each trapezoid individually which is accomplished by a simple subtraction of the x-coordinate points for the trapezoid as in the preceding formula. The following function named TrapRule calculates .