How to calculate a definite integral using the trapezoid method? Trapezoidal method Calculation of the integral using the trapezoidal formula


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.

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 .

Solution

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 .

Solution

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 .

Solution

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.

As you can see, the required accuracy is achieved.

A little about errors.

Theoretically, the approximate value of a definite integral, calculated by the trapezoid method, tends to the true value at . However, one should take into account the fact that most intermediate calculations are carried out approximately, and for large n, the computational error begins to accumulate.

Let's take a look at the estimates of the absolute errors of the trapezoid method and the method of mean rectangles .

One can expect half the error for a given n when using the method of rectangles with the same amount of computational work, that is, using this method is, as it were, preferable. This is true when the values ​​of the function at the midpoints of the elementary segments are known. But sometimes integrable functions are specified not analytically, but as a set of values ​​at the nodes. In this case, we will not be able to apply the formula of middle rectangles, but we will be able to use the trapezoid method.

The methods of right and left rectangles are inferior to the method of trapezoids in the accuracy of the result for a given number of partitions of the integration segment.

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 . Therefore, or

This so-called small trapezoid formula.

Example 2. River width 26 m, depth measurements in the cross section of the river every 2 m gave the following results.

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 extend 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 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.

How to calculate a definite integral
using the trapezoid formula and the Simpson method?

Numerical methods is a fairly large section of higher mathematics and serious textbooks on this topic have hundreds of pages. In practice, in tests, some tasks are traditionally proposed for solving by numerical methods, and one of the common tasks is approximate calculation definite integrals. In this article, I will consider two methods for the approximate calculation of a definite integral − trapezoidal method and simpson's method.

What do you need to know to master these methods? It sounds funny, but you may not be able to take integrals at all. And even do not understand what integrals are. Of the technical means, you will need a microcalculator. Yes, yes, we are waiting for routine school calculations. Better yet, download my semi-automatic calculator for the trapezoid method and the Simpson method. The calculator is written in Excel and will allow you to reduce the time for solving and processing tasks tenfold. A video manual is included for Excel teapots! By the way, the first video with my voice.

First, let's ask ourselves the question, why do we need approximate calculations at all? It seems to be possible to find the antiderivative of the function and use the Newton-Leibniz formula, calculating the exact value of a certain integral. As an answer to the question, let's immediately consider a demo example with a picture.

Calculate a definite integral

Everything would be fine, but in this example the integral is not taken - before you is not taken, the so-called integral logarithm. Does this integral even exist? Let's depict the graph of the integrand in the drawing:

Everything is fine. The integrand is continuous on the interval and the definite integral is numerically equal to the shaded area. Yes, that's just one snag - the integral is not taken. And in such cases, numerical methods come to the rescue. In this case, the problem occurs in two formulations:

1) Calculate the definite integral approximately , rounding the result to a certain decimal place. For example, up to two decimal places, up to three decimal places, etc. Let's say you get an approximate answer of 5.347. In fact, it may not be entirely correct (actually, let's say the more accurate answer is 5.343). Our task is only in that to round the result to three decimal places.

2) Calculate the definite integral approximately, with a certain precision. For example, calculate the definite integral approximately with an accuracy of 0.001. What does it mean? This means that we must find such an approximate value that modulo (one way or the other) differs from the truth by no more than 0.001.

There are several basic methods for the approximate calculation of a definite integral that occurs in problems:

The segment of integration is divided into several parts and a stepped figure is constructed, which is close in area to the desired area:

Do not judge strictly by the drawings, the accuracy is not perfect - they only help to understand the essence of the methods.

The idea is similar. The integration segment is divided into several intermediate segments, and the graph of the integrand approaches broken line line:

So our area (blue shading) is approximated by the sum of the areas of the trapezoids (red). Hence the name of the method. It is easy to see that the trapezoid method gives a much better approximation than the rectangle method (with the same number of partition segments). And, of course, the more smaller intermediate segments we consider, the higher the accuracy will be. The trapezoid method is encountered from time to time in practical tasks, and in this article several examples will be analyzed.

Simpson's method (parabola method). This is a more perfect way - the graph of the integrand is approached not by a broken line, but by small parabolas. How many intermediate segments - so many small parabolas. If we take the same three segments, then the Simpson method will give an even more accurate approximation than the rectangle method or the trapezoid method.

I don’t see the point in building a drawing, since visually the approximation will be superimposed on the graph of the function (the broken line of the previous paragraph - and even then it almost coincided).

The task of calculating a definite integral using the Simpson formula is the most popular task in practice. And the method of parabolas will be given considerable attention.

How to calculate a definite integral using the trapezoid method?

First, the general formula. Perhaps it will not be clear to everyone and not immediately ... Yes, Karlsson is with you - practical examples will clarify everything! Calm. Only calmness.

Consider the definite integral , where is a function continuous on the segment . Let us divide the segment into equal segments:
. In this case, obviously: (lower limit of integration) and (upper limit of integration). points also called knots.

Then the definite integral can be calculated approximately by the trapezoid formula:
, where:
step;
are the values ​​of the integrand at points .

Example 1

Calculate an approximately definite integral using the trapezoid formula. Round the results to three decimal places.

a) Dividing the integration segment into 3 parts.
b) Dividing the segment of integration into 5 parts.

Solution:
a) Especially for dummies, I tied the first paragraph to the drawing, which clearly demonstrated the principle of the method. If it will be difficult, look at the drawing in the course of the comments, here is a piece of it:

By condition, the integration segment must be divided into 3 parts, that is, .
Calculate the length of each segment of the partition: . Parameter, I remind you, is also called step.

How many points (partition nodes) will there be? There will be one more than the number of segments:

Well, the general formula of trapezoids is reduced to a pleasant size:

For calculations, you can use a regular microcalculator:

Note that, in accordance with the condition of the problem, all calculations should be rounded to the 3rd decimal place.

Finally:

From a geometric point of view, we calculated the sum of the areas of three trapezoids (see picture above).

b) We divide the integration segment into 5 equal parts, that is, . Why is this needed? So that Phobos-Grunt does not fall into the ocean - by increasing the number of segments, we increase the accuracy of calculations.

If , then the trapezoid formula takes the following form:

Let's find the partitioning step:
, that is, the length of each intermediate segment is 0.6.

When finishing the task, it is convenient to draw up all calculations with a calculation table:

In the first line we write "counter"

I think everyone can see how the second line is formed - first we write down the lower integration limit , we get the remaining values ​​by successively adding the step .

By what principle the bottom line is filled, too, I think, almost everyone understood. For example, if , then . What is called, consider, do not be lazy.

As a result:

Well, there really is a clarification, and a serious one! If for 3 segments of the partition the approximate value was, then for 5 segments . Thus, with a high degree of certainty, it can be argued that, at least .

Example 2

Calculate an approximately defined integral using the trapezoid formula with an accuracy of two decimal places (up to 0.01).

Solution: Almost the same problem, but in a slightly different formulation. The fundamental difference from Example 1 is that we we don't know, INTO HOW MANY segments to split the integration segment in order to get two correct decimal places. In other words, we do not know the value of .

There is a special formula that allows you to determine the number of partition segments to ensure that the required accuracy is achieved, but in practice it is often difficult to apply. Therefore, it is advantageous to use a simplified approach.

First, the integration segment is divided into several large segments, as a rule, into 2-3-4-5. Let us divide the integration segment, for example, into the same 5 parts. The formula is already familiar:

And the step, of course, is also known:

But another question arises, to what digit should the results be rounded? The condition does not say anything about how many decimal places to leave. The general recommendation is: 2-3 digits must be added to the required accuracy. In this case, the required accuracy is 0.01. According to the recommendation, after the comma, for fidelity, we leave five characters (four could have been):

As a result:
, we denote the approximation by .

After the primary result, the number of segments double. In this case, it is necessary to divide into 10 segments. And when the number of segments grows, then a bright thought comes to mind that poking fingers into a microcalculator is already somehow tired. Therefore, I once again propose to download and use my semi-automatic calculator (link at the beginning of the lesson).

For the trapezoid formula takes the following form:

In the paper version, the entry can be safely transferred to the next line.

Let's calculate the partition step:

The results of the calculations are summarized in the table:


When finishing in a notebook, it is advantageous to turn a long table into a two-story table.

As a result:

Now we calculate the discrepancy between the approximations:

Here we use the modulo sign, since we are interested in absolute difference, and not which result is greater, but which is less.

As for further actions, I personally encountered 2 solutions in practice:

1) The first way is a “head-to-head comparison”. Since the resulting error estimate more than the required accuracy: , then it is necessary to double the number of segments of the partition up to and calculate already . With the help of an Excel calculator, the finished result can be obtained in a matter of seconds:. Now we estimate the error again: . Score received less than the required accuracy: , therefore, the calculations are completed. It remains to round the last (most accurate) result to two decimal places and give an answer.

2) Another, more efficient method is based on the use of the so-called Runge rules, according to which we are wrong in estimating the definite integral, in fact, by no more than . In our problem: , thus, the need for calculation disappears. However, for the speed of the solution in this case, we had to pay with accuracy: . Nevertheless, this result is acceptable, since our “error limit” is exactly one hundredth.

What to choose? Focus on your training manual or the preferences of the teacher.

Answer: accurate to 0.01 (when using Runge's rule).

Example 3

Calculate an approximately definite integral using the trapezoid formula with an accuracy of 0.001.

Before you is again an untaken integral (almost integral cosine). In the sample solution, at the first step, a division into 4 segments was carried out, that is, . A complete solution and an approximate sample of finishing at the end of the lesson.

How to calculate the definite integral using Simpson's formula?

If you were looking for only the Simpson method on this page, then I strongly recommend that you first read the beginning of the lesson and view at least the first example. For the reason that many ideas and techniques will be similar to the trapezoid method.

Again, let's start with the general formula
Consider the definite integral , where is a function continuous on the segment . Let us divide the segment into even amount equal segments. An even number of segments is denoted by .

In practice, segments can be:
two:
four:
eight:
ten:
twenty:
I don't remember any other options.

Attention! Number is understood as ONE NUMBER. That is, IT IS FORBIDDEN reduce, for example, by two, getting . Recording only stands for that the number of segments evenly. And there are no cuts to speak of.

So our partition looks like this:

The terms are similar to those of the trapezoidal method:
Dots are called knots.

Simpson formula for the approximate calculation of the definite integral has the following form:
, where:
- the length of each of the small segments or step;
are the values ​​of the integrand at the points .

Detailing this piling up, I will analyze the formula in more detail:
is the sum of the first and last values ​​of the integrand;
is the sum of members with even indexes multiplied by 2;
is the sum of members with odd index is multiplied by 4.

Example 4

Calculate the approximate integral using Simpson's formula to the nearest 0.001. Splitting start with two segments

The integral, by the way, is again not taken.

Solution: I immediately draw attention to the type of task - it is necessary to calculate a definite integral with a certain accuracy. What this means has already been commented on at the beginning of the article, as well as on concrete examples of the previous paragraph. As for the trapezoid method, there is a formula that will immediately allow you to determine the required number of segments (the “en” value) in order to guarantee the required accuracy. True, we will have to find the fourth derivative and solve the extremal problem. Who understood what I mean and estimated the amount of work, he smiled. However, there is no laughing matter here, finding the fourth derivative of such an integrand will no longer be a megabotan, but a clinical psychopath. Therefore, in practice, a simplified method for estimating the error is almost always used.

We start to decide. If we have two partition segments, then the nodes will be one more: . And Simpson's formula takes a very compact form:

Let's calculate the partition step:

Let's fill in the calculation table:


Once again I comment on how the table is filled:

In the top line we write the "counter" of indices

In the second line, we first write the lower limit of integration, and then successively add the step.

In the third line we enter the values ​​of the integrand. For example, if , then . How many decimal places to leave? Indeed, the condition again says nothing about this. The principle is the same as in the trapezoidal method, we look at the required accuracy: 0.001. And add an additional 2-3 digits. That is, you need to round up to 5-6 decimal places.

As a result:

The first result has been obtained. Now double number of segments up to four: . Simpson's formula for this partition takes the following form:

Let's calculate the partition step:

Let's fill in the calculation table:


In this way:

Let's find the absolute value of the difference between the approximations:

Runge's rule for Simpson's method is delicious. If when using middle rectangle method and the trapezoid method, we are given an “indulgence” of one third, now - as much as one fifteenth:
, and accuracy does not suffer here anymore:

But for the sake of completeness, I will also give a “simple” solution, where you have to take an additional step: since there is more than the required accuracy: , then it is necessary to double the number of segments again: .

Simpson's formula is growing by leaps and bounds:

Let's calculate the step:

Let's fill in the spreadsheet again:

In this way:

Note that here it is desirable to describe the calculations in more detail, since Simpson's formula is quite cumbersome, and if you immediately thump:
, then this booze will look like a hack. And with a more detailed recording, the teacher will get the favorable impression that you conscientiously erased the keys of the microcalculator for a good hour. Detailed calculations for "hard" cases are present in my calculator.

We estimate the error:

The error is less than the required accuracy: . It remains to take the most accurate approximation , round it up to three decimal places and write:

Answer: accurate to 0.001

Example 5

Calculate an approximate integral using Simpson's formula to the nearest 0.0001. Splitting start with two segments

This is a do-it-yourself example. A rough example of finishing work and an answer at the end of the lesson.

In the final part of the lesson, we will consider a couple more common examples.

Example 6

Calculate the approximate value of a definite integral using the Simpson formula, dividing the integration segment into 10 parts. Calculations are carried out with an accuracy of three decimal places.

Editor's Choice
By Notes of a Wild Lady There are many flowers Beautiful, discreet. But I like all the common plantain. It may be harder for him...

) a mass-bearing slowcore group. In anticipation of the May tour of the country, the PARTY asked its leader questions about creativity and not only. Tour of...

The President of Belarus proposed to consider in the Parliament the issue of starting school classes not at 8 am, but at 9 am. “Hour...

For every parent whose child went to school, it is important to know what rules the educational institution is guided by when choosing a load ...
Answer: Allah Almighty said: "Indeed, Allah is High, Great." Women 34
On October 12, new banknotes of 200 and 2000 rubles were put into circulation in Russia. The cities that are depicted on them are Sevastopol and ...
Representatives of some unusual species of frogs and toads are collected here. Amphibians are vertebrates living both in water and on...
Definition. A singular point of a function is said to be isolated if, in some neighborhood of this point, is an analytic function (i.e....
In a number of cases, by examining the coefficients of series of the form (C) or, it can be established that these series converge (perhaps excluding individual points) ...