Calculate the integral of a function on a segment using the trapezoid method. Numerical Integration

Calculation of integrals using the formulas of rectangles, trapezoids and Simpson's formula. Estimation of errors.

Guidelines on topic 4.1:

Calculation of integrals by formulas of rectangles. Error estimate:

The solution of many technical problems is reduced to the calculation of certain integrals, the exact expression of which is difficult, requires lengthy calculations and is not always justified in practice. Here, their approximate value is quite sufficient. For example, you need to calculate the area bounded by a line whose equation is unknown, the axis X and two ordinates. In this case, you can replace this line with a simpler one, for which the equation is known. The area of ​​the curvilinear trapezoid thus obtained is taken as the approximate value of the desired integral. Geometrically, the idea behind the method of calculating the definite integral using the formula of rectangles is that the area of ​​a curvilinear trapezoid A 1 ABB 1 is replaced by the area of ​​an equal area rectangle A 1 A 2 B 1 B 2, which, according to the mean value theorem, is equal to

Where f(c)--- rectangle height A 1 A 2 B 1 B 2, which is the value of the integrand at some intermediate point c(a< c

It is practically difficult to find such a value with, at which (b-a)f(c) would be exactly equal to . To obtain a more accurate value, the area of ​​\u200b\u200ba curvilinear trapezoid is divided into n rectangles whose heights are equal y 0 , y 1 , y 2 , …,y n -1 and foundations.

If we summarize the areas of rectangles that cover the area of ​​a curvilinear trapezoid with a disadvantage, the function is non-decreasing, then instead of the formula, the formula is used

If in excess, then

Values ​​are found from equalities. These formulas are called rectangle formulas and give an approximate result. With the increase n the result becomes more accurate.

Example 1 . Calculate from the formula of rectangles

We divide the interval of integration into 5 parts. Then . Using a calculator or a table, we find the values ​​​​of the integrand (with an accuracy of 4 decimal places):

According to the formula of rectangles (with a disadvantage)

On the other hand, according to the Newton-Leibniz formula

Let's find the relative calculation error using the formula of rectangles:

Calculation of integrals by trapezoid formulas. Error estimate:

The geometric meaning of the following method for the approximate calculation of integrals is that finding the area of ​​an approximately equal-sized "rectilinear" trapezoid.

Let it be necessary to calculate the area A 1 AmBB 1 curvilinear trapezoid, expressed by the formula .

Let's replace the arc AmB chord AB and instead of the area of ​​a curvilinear trapezoid A 1 AmBB 1 calculate the area of ​​the trapezoid A 1 ABB 1: , where AA 1 and BB 1 - the base of the trapezoid, and A 1 V 1 is its height.


Denote f(a)=A 1 A,f(b)=B 1 B. trapezoid height A 1 B 1 \u003d b-a, square . Hence, or

This so-called small trapezoid formula.

Yekaterinburg


Calculation of a definite integral

Introduction

The task of numerical integration of functions is to calculate the approximate value of a certain integral:

, (1)

based on a series of values ​​of the integrand.( f(x) |x=x k = f(x k) = y k ).

Formulas for the numerical calculation of a single integral are called quadrature formulas, double and more multiple - cubature.

The usual technique for constructing quadrature formulas is to replace the integrand f(x) on a segment with an interpolating or approximating function g(x) of a relatively simple form, for example, a polynomial, followed by analytical integration. This leads to the presentation

Neglecting the remainder term R[f], we obtain the approximate formula

.

Denote by y i = f(x i) the value of the integrand at various points

on the . Quadrature formulas are formulas of closed type if x 0 =a, x n =b.

As an approximate function g(x), we consider an interpolation polynomial on

in the form of the Lagrange polynomial: , , wherein , where is the remainder term of the Lagrange interpolation formula.

Formula (1) gives

, (2) . (3)

In formula (2), the quantities (

) are called nodes, () - weights, - the error of the quadrature formula. If the weights () of the quadrature formula are calculated by formula (3), then the corresponding quadrature formula is called the quadrature formula of the interpolation type.

Summarize.

) of the quadrature formula (2) for a given arrangement of nodes do not depend on the form of the integrand.

2. In quadrature formulas of interpolation type, the remainder term R n [f] can be represented as the value of a particular differential operator on the function f(x). For

.

3. For polynomials up to order n inclusive, the quadrature formula (2) is exact, i.e.

. The highest degree of a polynomial for which the quadrature formula is exact is called the degree of the quadrature formula.

Consider special cases of formulas (2) and (3): the method of rectangles, trapezoids, parabolas (Simpson's method). The names of these methods are due to the geometric interpretation of the corresponding formulas.

Rectangle Method

The definite integral of the function of the function f(x):

numerically equal to the area of ​​a curvilinear trapezoid bounded by curves y=0, x=a, x=b, y=f(x) (Figure 1).
Rice. 1 Area under the curve y=f(x) To calculate this area, the entire integration interval is divided into n equal subintervals of length h=(b-a)/n. The area under the integrand is approximately replaced by the sum of the areas of the rectangles, as shown in Figure (2).
Rice. 2 The area under the curve y=f(x) is approximated by the sum of the areas of the rectangles
The sum of the areas of all rectangles is calculated by the formula (4)

The method represented by formula (4) is called the left box method, and the method represented by formula (5) is called the right box method:

(5) The error in calculating the integral is determined by the value of the integration step h. The smaller the integration step, the more accurately the integral sum S approximates the value of the integral I. Based on this, an algorithm is built to calculate the integral with a given accuracy. It is considered that the integral sum S represents the value of the integral I with an accuracy of eps, if the difference in absolute value between the integral sums and calculated with the step h and h/2, respectively, does not exceed eps.

To find a definite integral using the method of middle rectangles, the area bounded by lines a and b is divided into n rectangles with the same bases h, the heights of the rectangles will be the points of intersection of the function f(x) with the midpoints of the rectangles (h/2). The integral will be numerically equal to the sum of the areas of n rectangles (Figure 3).


Rice. 3 The area under the curve y=f(x) is approximated by the sum of the areas of the rectangles ,

n is the number of partitions of the segment .

Trapezoidal method

To find a definite integral using the trapezoid method, the area of ​​a curvilinear trapezoid is also divided into n rectangular trapezoids with heights h and bases y 1, y 2, y 3,..y n, where n is the number of the rectangular trapezoid. The integral will be numerically equal to the sum of the areas of rectangular trapezoids (Figure 4).


Rice. 4 The area under the curve y=f(x) is approximated by the sum of the areas of rectangular trapezoids.

n is the number of partitions

(6)

The error of the trapezoid formula is estimated by the number

The error of the trapezoid formula with growth

decreases faster than the error of the formula of rectangles. Therefore, the trapezoid formula allows you to get more accuracy than the rectangle method.

Simpson formula

If for each pair of segments

construct a polynomial of the second degree, then integrate it on the segment and use the additivity property of the integral, then we obtain the Simpson formula. In Simpson's method for calculating the definite integral, the entire integration interval is divided into subintervals of equal length h=(b-a)/n. The number of partition segments is an even number. Then, on each pair of adjacent subintervals, the subintegral function f(x) is replaced by a Lagrange polynomial of the second degree (Figure 5). Rice. 5 The function y=f(x) on the segment is replaced by a polynomial of the 2nd order Consider the integrand on the segment . Let us replace this integrand with a second-degree Lagrange interpolation polynomial coinciding with y= at the points :

Today we will get acquainted with another method of numerical integration, the trapezoidal method. With its help, we will calculate definite integrals with a given degree of accuracy. In the article, we will describe the essence of the trapezoid method, analyze how the formula is derived, compare the trapezoid method with the rectangle method, and write down the estimate of the absolute error of the method. We will illustrate each of the sections with examples for a deeper understanding of the material.

Yandex.RTB R-A-339285-1

Suppose that we need to approximately calculate the definite integral ∫ a b f (x) d x , whose integrand y = f (x) is continuous on the segment [ a ; b] . To do this, we divide the segment [ a ; b ] into several equal intervals of length h with points a = x 0< x 1 < x 2 < . . . < x n - 1 < x n = b . Обозначим количество полученных интервалов как n .

Let's find the partition step: h = b - a n . We define nodes from the equality x i = a + i h , i = 0 , 1 , . . . , n .

On elementary intervals, consider the integrand x i - 1 ; x i , i = 1 , 2 , . . , n .

With an infinite increase in n, we reduce all cases to the four simplest options:

Select segments x i - 1 ; x i , i = 1 , 2 , . . . , n . Let's replace the function y = f (x) on each of the graphs with a straight line segment that passes through the points with coordinates x i - 1 ; f x i - 1 and x i ; f x i . We mark them in the figures in blue.

Let's take the expression f (x i - 1) + f (x i) 2 h as an approximate value of the integral ∫ x i - 1 x if (x) d x . Those. take ∫ x i - 1 x i f (x) d x ≈ f (x i - 1) + f (x i) 2 h .

Let's see why the numerical integration method we are studying is called the trapezoidal method. To do this, we need to find out what the written approximate equality means from the point of view of geometry.

To calculate the area of ​​a trapezoid, multiply the half sums of its bases by the height. In the first case, the area of ​​a curvilinear trapezoid is approximately equal to a trapezoid with bases f (x i - 1) , f (x i) height h . In the fourth of the cases we are considering, the given integral ∫ x i - 1 x f (x) d x is approximately equal to the area of ​​a trapezoid with bases - f (x i - 1) , - f (x i) and height h, which must be taken with the sign "-". In order to calculate the approximate value of the definite integral ∫ x i - 1 x i f (x) d x in the second and third of the considered cases, we need to find the difference between the areas of the red and blue regions, which we marked with hatching in the figure below.

Let's summarize. The essence of the trapezoidal method is as follows: we can represent the definite integral ∫ a b f (x) d x as a sum of integrals of the form ∫ x i - 1 x i f (x) d x on each elementary segment and in the subsequent approximate change ∫ x i - 1 x i f (x) d x ≈ f (x i - 1) + f (x i) 2 h.

Trapezoidal formula

Recall the fifth property of the definite integral: ∫ a b f (x) d x = ∑ i = 1 n ∫ x i - 1 x i f (x) d x . In order to obtain the formula of the trapezoidal method, instead of the integrals ∫ x i - 1 x i f (x) d x, substitute their approximate values: ∫ x i - 1 x i f (x) d x = ∑ i = 1 n ∫ x i - 1 x i f (x) d x ≈ ∑ i = 1 n f (x i - 1) + f (x i) 2 h = = h 2 (f (x 0) + f (x 1) + f (x 1) + f (x 2) + f (x 2) + f (x 3) + . . . + f (x n)) = = h 2 f (x 0) + 2 ∑ i = 1 n - 1 f (x i) + f (x n) ⇒ ∫ x i - 1 x i f (x) d x ≈ h 2 f (x 0) + 2 ∑ i = 1 n - 1 f (x i) + f (x n)

Definition 1

Trapezoidal formula:∫ x i - 1 x i f (x) d x ≈ h 2 f (x 0) + 2 ∑ i = 1 n - 1 f (x i) + f (x n)

Estimation of the absolute error of the trapezoidal method

Let us estimate the absolute error of the trapezoidal method as follows:

Definition 2

δ n ≤ m a x x ∈ [ a ; b ] f "" (x) n h 3 12 = m a x x ∈ [ a ; b ] f "" (x) b - a 3 12 n 2

A graphic illustration of the trapezoidal method is shown in the figure:

Calculation examples

Let us analyze examples of using the trapezoid method for the approximate calculation of definite integrals. We will pay special attention to two types of tasks:

  • calculation of a definite integral by the trapezoid method for a given number of partitions of the segment n;
  • finding an approximate value of a certain integral with a specified accuracy.

For a given n, all intermediate calculations must be carried out with a sufficiently high degree of accuracy. The accuracy of the calculations should be those higher, the larger n .

If we have a given accuracy of calculating a definite integral, then all intermediate calculations must be carried out two or more orders of magnitude more accurately. For example, if the accuracy is set to 0 . 01 , then we perform intermediate calculations with an accuracy of 0 . 0001 or 0 . 00001 . For large n, intermediate calculations must be carried out with even higher accuracy.

Let's take the above rule as an example. To do this, we compare the values ​​of a definite integral calculated by the Newton-Leibniz formula and obtained by the trapezoid method.

So, ∫ 0 5 7 d x x 2 + 1 = 7 a r c t g (x) 0 5 = 7 a r c t g 5 ≈ 9 , 613805 .

Example 1

Using the trapezoidal method, we calculate the definite integral ∫ 0 5 7 x 2 + 1 d x for n equal to 10 .

Decision

The formula for the trapezoidal method is ∫ x i - 1 x i f (x) d x ≈ h 2 f (x 0) + 2 ∑ i = 1 n - 1 f (x i) + f (x n)

In order to apply the formula, we need to calculate the step h using the formula h = b - a n , determine the nodes x i = a + i h , i = 0 , 1 , . . . , n , calculate the values ​​of the integrand f (x) = 7 x 2 + 1 .

The partition step is calculated as follows: h = b - a n = 5 - 0 10 = 0 . 5 . To calculate the integrand at the nodes x i = a + i · h , i = 0 , 1 , . . . , n we will take four decimal places:

i \u003d 0: x 0 \u003d 0 + 0 0. 5 = 0 ⇒ f (x 0) = f (0) = 7 0 2 + 1 = 7 i = 1: x 1 = 0 + 1 0 . 5 = 0 . 5 ⇒ f (x 1) = f (0 . 5) = 7 0 . 5 2 + 1 = 5 . 6 . . . i = 10: x 10 = 0 + 10 0 . 5 = 5 ⇒ f(x 10) = f(5) = 7 5 2 + 1 ≈ 0 , 2692

Let's enter the results of the calculations in the table:

i 0 1 2 3 4 5 6 7 8 9 10
x i 0 0 . 5 1 1 , 5 2 2 , 5 3 3 , 5 4 4 , 5 5
f (x i) 7 5 , 6 3 , 5 2 , 1538 1 , 4 0 , 9655 0 , 7 0 , 5283 0 , 4117 0 , 3294 0 , 2692

Substitute the obtained values ​​into the formula of the trapezoidal method: ∫ 0 5 7 d x x 2 + 1 ≈ h 2 f (x 0) + 2 ∑ i = 1 n - 1 f (x i) + f (x n) = = 0 , 5 2 7 + 2 5 , 6 + 3 , 5 + 2 , 1538 + 1 , 4 + 0 , 9655 + 0 , 7 + 0 , 5283 + 0 , 4117 + 0 , 3294 + 0 , 2692 = 9 , 6117

Let's compare our results with the results calculated by the Newton-Leibniz formula. The received values ​​coincide up to hundredths.

Answer:∫ 0 5 7 d x x 2 + 1 = 9 , 6117

Example 2

Using the trapezoid method, we calculate the value of the definite integral ∫ 1 2 1 12 x 4 + 1 3 x - 1 60 d x with an accuracy of 0 , 01 .

Decision

According to the condition of the problem a = 1 ; b = 2 , f (x) = 1 12 x 4 + 1 3 x - 1 60 ; δn ≤ 0 , 01 .

Find n , which is equal to the number of split points of the integration segment, using the inequality for estimating the absolute error δ n ≤ m a x x ∈ [ a ; b ] f "" (x) (b - a) 3 12 n 2 . We will do it in the following way: we will find the values ​​n for which the inequality m a x x ∈ [ a ; b ] f "" (x) (b - a) 3 12 n 2 ≤ 0 , 01 . Given n, the trapezoid formula will give us an approximate value of a certain integral with a given accuracy.

First, let's find the largest value of the modulus of the second derivative of the function on the interval [ 1 ; 2].

f "(x) = 1 12 x 4 + 1 3 x - 1 60" = 1 3 x 3 + 1 3 ⇒ f "" (x) = 1 3 x 3 + 1 3 " = x 2

The second derivative function is a quadratic parabola f "" (x) = x 2 . We know from its properties that it is positive and increases on the segment [ 1 ; 2]. In this regard, m a x x ∈ [ a ; b ] f "" (x) = f "" (2) = 2 2 = 4 .

In the given example, the process of finding m a x x ∈ [ a ; b ] f "" (x) turned out to be rather simple. In complex cases, for calculations, you can refer to the largest and smallest values ​​of the function. After considering this example, we present an alternative method for finding m a x x ∈ [ a ; b ] f "" (x) .

Let us substitute the obtained value into the inequality m a x x ∈ [ a ; b ] f "" (x) (b - a) 3 12 n 2 ≤ 0 , 01

4 (2 - 1) 3 12 n 2 ≤ 0 . 01 ⇒ n 2 ≥ 100 3 ⇒ n ≥ 5 . 7735

The number of elementary intervals into which the integration segment is divided n is a natural number. For calculation behavior, let's take n equal to six. Such a value of n will allow us to achieve the specified accuracy of the trapezoid method with a minimum of calculations.

Let's calculate the step: h = b - a n = 2 - 1 6 = 1 6 .

Find nodes x i = a + i h , i = 1 , 0 , . . . , n , we determine the values ​​of the integrand at these nodes:

i = 0: x 0 = 1 + 0 1 6 = 1 ⇒ f (x 0) = f (1) = 1 12 1 4 + 1 3 1 - 1 60 = 0 , 4 i = 1: x 1 \u003d 1 + 1 1 6 \u003d 7 6 ⇒ f (x 1) \u003d f 7 6 \u003d 1 12 7 6 4 + 1 3 7 6 - 1 60 ≈ 0, 5266. . . i \u003d 6: x 10 \u003d 1 + 6 1 6 \u003d 2 ⇒ f (x 6) \u003d f (2) \u003d 1 12 2 4 + 1 3 2 - 1 60 ≈ 1, 9833

We write the calculation results in the form of a table:

i 0 1 2 3 4 5 6
x i 1 7 6 4 3 3 2 5 3 11 6 2
f x i 0 , 4 0 , 5266 0 , 6911 0 , 9052 1 , 1819 1 , 5359 1 , 9833

We substitute the results obtained into the trapezoid formula:

∫ 1 2 1 12 x 4 + 1 3 x - 1 60 d x ≈ h 2 f (x 0) + 2 ∑ i = 1 n - 1 f (x i) + f (x n) = = 1 12 0 , 4 + 2 0, 5266 + 0, 6911 + 0, 9052 + 1, 1819 + 1, 5359 + 1, 9833 ≈ 1, 0054

To compare, we calculate the original integral using the Newton-Leibniz formula:

∫ 1 2 1 12 x 4 + 1 3 x - 1 60 d x = x 5 60 + x 2 6 - x 60 1 2 = 1

As you can see, we have achieved the obtained accuracy of calculations.

Answer: ∫ 1 2 1 12 x 4 + 1 3 x - 1 60 d x ≈ 1, 0054

For complex integrands, finding the number n from the inequality for estimating the absolute error is not always easy. In this case, the following method would be appropriate.

Let us denote the approximate value of the definite integral, which was obtained by the trapezoid method for n nodes, as I n . Let's choose an arbitrary number n . Using the formula of the trapezoid method, we calculate the initial integral for a single (n = 10) and double (n = 20) number of nodes and find the absolute value of the difference between the two obtained approximate values ​​I 20 - I 10 .

If the absolute value of the difference between the two obtained approximate values ​​is less than the required accuracy I 20 - I 10< δ n , то мы прекращаем вычисления и выбираем значение I 20 , которое можно округлить до требуемого порядка точности.

If the absolute value of the difference between the two obtained approximate values ​​is greater than the required accuracy, then it is necessary to repeat the steps with twice the number of nodes (n = 40).

This method requires a lot of calculations, so it is wise to use computer technology to save time.

Let's solve the problem using the above algorithm. In order to save time, we omit intermediate calculations using the trapezoid method.

Example 3

It is necessary to calculate the definite integral ∫ 0 2 x e x d x using the trapezoid method with an accuracy of 0 , 001 .

Decision

Let's take n equal to 10 and 20 . According to the trapezoid formula, we get I 10 \u003d 8, 4595380, I 20 \u003d 8, 4066906.

I 20 - I 10 = 8, 4066906 - 8, 4595380 = 0, 0528474 > 0, 001, which requires further calculations.

Let's take n equal to 40: I 40 = 8, 3934656.

I 40 - I 20 = 8, 3934656 - 8, 4066906 = 0, 013225 > 0, 001, which also requires further calculations.

Let's take n equal to 80: I 80 = 8 , 3901585 .

I 80 - I 40 = 8.3901585 - 8.3934656 = 0.0033071 > 0.001, which requires another doubling of the number of nodes.

Let's take n equal to 160: I 160 = 8, 3893317.

I 160 - I 80 = 8, 3893317 - 8, 3901585 = 0, 0008268< 0 , 001

You can get an approximate value of the original integral by rounding I 160 = 8 , 3893317 to thousandths: ∫ 0 2 x e x d x ≈ 8 , 389 .

For comparison, we calculate the original definite integral using the Newton-Leibniz formula: ∫ 0 2 x e x d x = e x · (x - 1) 0 2 = e 2 + 1 ≈ 8 , 3890561 . The required accuracy has been achieved.

Answer: ∫ 0 2 x e x d x ≈ 8, 389

Errors

Intermediate calculations to determine the value of a definite integral are carried out, for the most part, approximately. This means that as n increases, the computational error begins to accumulate.

Let us compare the estimates of the absolute errors of the trapezoidal method and the method of mean rectangles:

δ n ≤ m a x x ∈ [ a ; b ] f "" (x) n h 3 12 = m a x x ∈ [ a ; b ] f "" (x) b - a 3 12 n 2 δ n ≤ m a x x ∈ [ a ; b ] f "" (x) n h 3 24 = m a x x ∈ [ a ; b ] f "" (x) b - a 3 24 n 2 .

The method of rectangles for a given n with the same amount of computational work gives half the error. This makes the method more preferable in cases where the values ​​of the function are known in the middle segments of elementary segments.

In those cases when the integrable functions are specified not analytically, but as a set of values ​​at the nodes, we can use the trapezoidal method.

If we compare the accuracy of the trapezoidal method and the method of right and left rectangles, then the first method surpasses the second in the accuracy of the result.

If you notice a mistake in the text, please highlight it and press Ctrl+Enter


Trapezoidal method is one of the numerical integration methods. It allows you to calculate definite integrals with a predetermined degree of accuracy.

First, we describe the essence of the trapezoid method and derive the trapezoid formula. Next, we write an estimate of the absolute error of the method and analyze in detail the solution of typical examples. In conclusion, let's compare the method of trapezoids with the method of rectangles.

Page navigation.

The essence of the trapezoid method.

Let's set ourselves the following task: let us need to approximately calculate the definite integral , where the integrand y=f(x) is continuous on the interval .

Let's divide the segment into n equal intervals of length h with points . In this case, the partition step is found as the nodes are determined from the equality .

Consider the integrand on elementary intervals .

Four cases are possible (the figure shows the simplest of them, to which everything reduces as n increases infinitely):


On every segment let's replace the function y=f(x) with a line segment passing through the points with coordinates and . We depict them in the figure with blue lines:


As an approximate value of the integral, we take the expression , that is, let's take .

Let's find out what the written approximate equality means in a geometric sense. This will make it possible to understand why the considered method of numerical integration is called the trapezoidal method.

We know that the area of ​​a trapezoid is found as the product of half the sum of the bases times the height. Therefore, in the first case, the area of ​​a curvilinear trapezoid is approximately equal to the area of ​​a trapezoid with bases and height h, in the latter case, the definite integral is approximately equal to the area of ​​the trapezoid with bases and height h taken with a minus sign. In the second and third cases, the approximate value of the definite integral is equal to the difference between the areas of the red and blue regions shown in the figure below.


Thus, we have come to the essence of the trapezoid method, which consists in representing a definite integral as a sum of integrals of the form on each elementary interval and in the subsequent approximate replacement .

Trapezoidal formula.

By virtue of the fifth property of the definite integral .

If we substitute their approximate values ​​instead of integrals, we get:

Estimation of the absolute error of the trapezoidal method.

Absolute error of the trapezoidal method rated as
.

Graphic illustration of the trapezoidal method.

Let's bring graphic illustration of the trapezoidal method:

Examples of approximate calculation of definite integrals by the trapezoidal method.

Let's use examples to analyze the application of the trapezoid method in the approximate calculation of certain integrals.

Basically there are two types of tasks:

  • or calculate the definite integral by the trapezoid method for a given number of partitions of the segment n,
  • or find an approximate value of a definite integral with the required accuracy.

It should be noted that for a given n, intermediate calculations should be carried out with a sufficient degree of accuracy, and the larger n, the higher the accuracy of the calculations should be.

If it is required to calculate a definite integral with a given accuracy, for example, up to 0.01 , then we recommend that intermediate calculations be carried out two or three orders of magnitude more accurately, that is, up to 0.0001 - 0.00001 . If the specified accuracy is achieved at large n, then intermediate calculations should be carried out with even higher accuracy.

For example, let's take a definite integral, the value of which we can calculate using the Newton-Leibniz formula, so that we can compare this result with an approximate value obtained using the trapezoid method.

So, .

Example.

Calculate the definite integral using the trapezoidal method for n = 10 .

Decision.

The formula for the trapezoid method is . That is, to apply it, it is enough for us to calculate the step h using the formula , determine the nodes and calculate the corresponding values ​​of the integrand .

Let's calculate the partition step: .

We define the nodes and calculate the values ​​of the integrand in them (we will take four decimal places):

For convenience, the calculation results are presented in the form of a table:

We substitute them into the formula of the trapezoid method:

The obtained value coincides up to hundredths with the value calculated by the Newton-Leibniz formula.

Example.

Calculate Definite Integral trapezoidal method with an accuracy of 0.01 .

Decision.

What do we get from the condition: a = 1; b=2; .

In this case, first of all, we find the number of split points of the integration segment, that is, n. We can do this by using the inequality to estimate the absolute error . Thus, if we find n for which the inequality will hold , then the trapezoid formula for given n will give us an approximate value of a definite integral with the required accuracy.

Let us first find the largest value of the modulus of the second derivative of the function on the interval .

The second derivative of the function is a quadratic parabola, we know from its properties that it is positive and increasing on the segment, therefore . As you can see, in our example, the process of finding is quite simple. For more complex cases, refer to the section. If it is very difficult to find, then after this example we will give an alternative method of action.

Let's go back to our inequality and substitute the resulting value into it:

As n is a natural number (n is the number of elementary intervals into which the integration segment is divided), then we can take n = 6, 7, 8, ... Let's take n = 6 . This will allow us to achieve the required accuracy of the trapezoidal method with a minimum of calculations (although for our case with n = 10 it is more convenient to perform manual calculations).

So, n found, now proceed as in the previous example.

Calculate step: .

Find the grid nodes and the values ​​of the integrand at them:

Let's put the results of the calculations in the table:

We substitute the results obtained into the trapezoid formula:

We calculate the original integral using the Newton-Leibniz formula to compare the values:

Therefore, the required accuracy is achieved.

It should be noted that finding the number n from the inequality for estimating the absolute error is not a very simple procedure, especially for complex integrands. Therefore, it is logical to resort to the following method.

The approximate value of the definite integral obtained by the trapezoid method for n nodes will be denoted by .

Choose an arbitrary number n , for example n = 10 . Using the formula of the trapezoid method, we calculate the initial integral for n = 10 and for twice the number of nodes, that is, for n = 20. We find the absolute value of the difference between the two obtained approximate values. If it is less than the required accuracy , then we stop the calculations and take the value as an approximate value of the definite integral, having previously rounded it up to the required order of accuracy. Otherwise, we double the number of nodes (we take n = 40 ) and repeat the steps.

Teaching and educational tasks:

  • didactic purpose. To introduce students to the methods of approximate calculation of a definite integral.
  • educational goal. The topic of this lesson is of great practical and educational value. The simplest approach to the idea of ​​numerical integration is based on the definition of a definite integral as the limit of integral sums. For example, if we take some sufficiently small partition of the segment [ a; b] and construct an integral sum for it, then its value can be approximately taken as the value of the corresponding integral. At the same time, it is important to quickly and correctly perform calculations using computer technology.

Basic knowledge and skills. Have an understanding of approximate methods for calculating a definite integral using the formulas of rectangles and trapezoids.

Ensuring the lesson

  • Handout. Task cards for independent work.
  • TSO. Multiprojector, PC, laptops.
  • TCO equipment. Presentations: "Geometric meaning of the derivative", "Method of rectangles", "Method of trapezoids". (Presentation can be borrowed from the author).
  • Computing tools: PC, microcalculators.
  • Guidelines

Class type. Integrated practical.

Motivation of cognitive activity of students. Very often one has to calculate definite integrals for which it is impossible to find an antiderivative. In this case, approximate methods for calculating definite integrals are used. Sometimes the approximate method is also used for "taking" integrals, if the calculation by the Newton-Leibniz formula is not rational. The idea of ​​an approximate calculation of the integral is that the curve is replaced by a new curve that is sufficiently “close” to it. Depending on the choice of a new curve, one or another approximate integration formula can be used.

Lesson sequence.

  1. Rectangle formula.
  2. Trapezoidal formula.
  3. Solution of exercises.

Lesson Plan

  1. Repetition of basic knowledge of students.

Repeat with students: the basic formulas of integration, the essence of the studied methods of integration, the geometric meaning of a definite integral.

  1. Performing practical work.

The solution of many technical problems is reduced to the calculation of certain integrals, the exact expression of which is difficult, requires lengthy calculations and is not always justified in practice. Here, their approximate value is quite sufficient.

Let, for example, it is necessary to calculate the area bounded by a line whose equation is unknown. In this case, you can replace this line with a simpler one, the equation of which is known. The area of ​​the curvilinear trapezoid thus obtained is taken as an approximate value of the desired integral.

The simplest approximate method is the method of rectangles. Geometrically, the idea behind the way to calculate the definite integral using the formula of rectangles is that the area of ​​a curvilinear trapezoid ABCD is replaced by the sum of the areas of rectangles, one side of which is , and the other is .

If we summarize the areas of the rectangles that show the area of ​​a curvilinear trapezoid with a disadvantage [Figure 1], then we get the formula:

[Picture 1]

then we get the formula:

If in abundance

[Figure2],

then

Values y 0 , y 1 ,..., y n found from equalities , k = 0, 1..., n.These formulas are called rectangle formulas and give approximate results. With the increase n the result becomes more accurate.

So, to find the approximate value of the integral, you need:

In order to find the calculation error, you need to use the formulas:


Example 1 Calculate by the formula of rectangles. Find the absolute and relative errors of calculations.

Let's split the segment [ a, b] into several (for example, 6) equal parts. Then a = 0, b = 3 ,

x k = a + k x
X
0 = 2 + 0 = 2
X 1 = 2 + 1 = 2,5
X 2 = 2 + 2 =3
X 3 = 2 + 3 = 3
X 4 = 2 + 4 = 4
X 5 = 2 + 5 = 4,5

f(x 0) = 2 2 = 4
f (x 1) = 2 ,5 2 = 6,25
f (x 2) = 3 2 = 9
f (x 3) = 3,5 2 = 12,25
f (x 4) = 4 2 = 16
f (x 5) = 4,5 2 = 20,25.

X 2 2,5 3 3,5 4 4,5
at 4 6,25 9 12,25 16 20,25

According to formula (1):

In order to calculate the relative error of calculations, it is necessary to find the exact value of the integral:



The calculations took a long time and we got a rather rough rounding. To calculate this integral with a smaller approximation, you can use the technical capabilities of the computer.

To find a definite integral by the method of rectangles, it is necessary to enter the values ​​of the integrand f(x) to an Excel worksheet in the range X with a given step X= 0,1.

  1. Compiling a data table (X and f(x)). X f(x). Argument, and in cell B1 - the word Function2 2,1 ). Then, having selected the block of cells A2:A3, we get all the values ​​of the argument by auto-completion (we stretch beyond the lower right corner of the block to cell A32, to the value x=5).
  2. Next, we introduce the values ​​of the integrand. In cell B2, you need to write its equation. To do this, place the table cursor in cell B2 and enter the formula from the keyboard =A2^2(for English keyboard layout). Press the key Enter. In cell B2 appears 4 . Now you need to copy the function from cell B2. Autocomplete copy this formula to the range B2:B32.
    As a result, a data table should be obtained for finding the integral.
  3. Now in cell B33 an approximate value of the integral can be found. To do this, in cell B33, enter the formula = 0,1*, then call the Function Wizard (by pressing the Insert Function button on the toolbar (f(x)). In the Function Wizard-Step 1 of 2 dialog box that appears, on the left, in the Category field, select Math. On the right in the Function field - the Sum function. We press the button OK. The Sum dialog box appears. Enter the summation range B2:B31 into the working field with the mouse. We press the button OK. In cell B33, an approximate value of the desired integral appears with a disadvantage ( 37,955 ) .

Comparing the obtained approximate value with the true value of the integral ( 39 ), it can be seen that the approximation error of the method of rectangles in this case is equal to

= |39 - 37 , 955| = 1 ,045

Example 2 Using the method of rectangles, calculate with a given step X = 0,05.

Comparing the obtained approximate value with the true value of the integral , it can be seen that the approximation error of the method of rectangles in this case is equal to

The trapezoid method usually gives a more accurate integral value than the rectangle method. The curvilinear trapezoid is replaced by the sum of several trapezoids and the approximate value of the definite integral is found as the sum of the areas of the trapezoids

[Picture3]

Example 3 Trapezoidal find step by step X = 0,1.

  1. Open a blank worksheet.
  2. Compiling a data table (X and f(x)). Let the first column be the values X, and the second corresponding indicators f(x). To do this, in cell A1, enter the word Argument, and in cell B1 - the word Function. In cell A2, the first value of the argument is entered - the left border of the range ( 0 ). In cell A3, the second value of the argument is entered - the left border of the range plus the construction step ( 0,1 ). Then, having selected the block of cells A2:A3, we get all the values ​​of the argument by auto-completion (we stretch beyond the lower right corner of the block to cell A33, to the value x=3.1).
  3. Next, we introduce the values ​​of the integrand. In cell B2, you must write its equation (in the example of a sine). To do this, the table cursor must be placed in cell B2. There should be a sine value corresponding to the value of the argument in cell A2. To get the value of the sine, we will use a special function: click the Insert function button on the toolbar f(x). In the Function Wizard-Step 1 of 2 dialog box that appears, on the left, in the Category field, select Math. On the right in the Function field - a function SIN. We press the button OK. A dialog box appears SIN. Hovering the mouse pointer over the gray field of the window, with the left button pressed, move the field to the right to open the data column ( BUT). Specify the value of the sine argument by clicking on cell A2. We press the button OK. 0 appears in cell B2. Now you need to copy the function from cell B2. Autocomplete copy this formula to the range B2:B33. As a result, a data table should be obtained for finding the integral.
  4. Now in cell B34 an approximate value of the integral can be found using the trapezoid method. To do this, in cell B34, enter the formula \u003d 0.1 * ((B2 + B33) / 2+, then call the Function Wizard (by pressing the Insert Function button on the toolbar (f(x)). In the Function Wizard-Step 1 of 2 dialog box that appears, on the left, in the Category field, select Math. On the right in the Function field - the Sum function. We press the button OK. The Sum dialog box appears. Enter the summation range B3:B32 into the working field with the mouse. We press the button OK once again OK. In cell B34, an approximate value of the sought-for integral appears with a disadvantage ( 1,997 ) .

Comparing the obtained approximate value with the true value of the integral, one can see that the approximation error of the method of rectangles in this case is quite acceptable for practice.

  1. Solution of exercises.