Simpson method with given accuracy. Trapezoidal method

Page navigation.

The method of parabolas (Simpson) - the essence of the method, formula, error estimate, illustration.

Let the function y = f(x) be continuous on the interval and we need to calculate the definite integral .

Let's divide the segment into n elementary segments of length by points . Let the points be the midpoints of the segments, respectively. In this case, all "nodes" are determined from the equality .

The essence of the parabola method.

On each interval, the integrand is approximated by a quadratic parabola passing through the points . Hence the name of the method - the method of parabolas.

This is done in order to take as an approximate value of a definite integral , which we can calculate using the Newton-Leibniz formula. This is what essence of the parabola method.

Geometrically it looks like this:


Graphic illustration of the parabola method (Simpson).

The red line shows the graph of the function y=f(x) , the blue line shows the approximation of the graph of the function y=f(x) by quadratic parabolas on each elementary segment of the partition.

Derivation of the Simpson method formula (parabolas).

By virtue of the fifth property of the definite integral, we have .

To obtain the formula for the parabola method (Simpson), we have to calculate .

Let (we can always come to this by carrying out the appropriate geometric shift transformation for any i = 1, 2, ..., n ).

Let's make a drawing.

Let us show that only one quadratic parabola passes through the points . In other words, we prove that the coefficients are uniquely defined.

Since are the points of the parabola, each of the equations of the system is valid

The written system of equations is a system of linear algebraic equations in unknown variables. The determinant of the main matrix of this system of equations is the Vandermonde determinant , and it is nonzero for non-coinciding points . This indicates that the system of equations has a unique solution (this is discussed in the article), that is, the coefficients are uniquely determined, and a single quadratic parabola passes through the points.

Let's move on to finding the integral .

Obviously:

We use these equalities to make the last transition in the following chain of equalities:

Thus, you can get the formula of the parabola method:

Simpson method formula (parabolas) has the form
.

Estimation of the absolute error of the Simpson method.

Absolute error of Simpson's method rated as .

Examples of approximate calculation of definite integrals by the Simpson method (parabolas).

Let us analyze the application of the Simpson method (parabolas) in the approximate calculation of definite integrals.

There are usually two types of tasks:

A logical question arises: "With what degree of accuracy to carry out intermediate calculations"?

The answer is simple - the accuracy of intermediate calculations should be sufficient. Intermediate calculations should be carried out with an accuracy of 3-4 orders of magnitude higher than the order of . Also, the accuracy of intermediate calculations depends on the number n - the larger n, the more accurately intermediate calculations should be carried out.

Example.

Calculate the definite integral using the Simpson method, dividing the integration segment into 5 parts.

Solution.

From the condition we know that a = 0; b = 5; n = 5 .

The Simpson method formula (parabolas) has the form . To apply it, we need to calculate the step , determine the nodes and calculate the corresponding values ​​of the integrand .

Intermediate calculations will be carried out with an accuracy of four decimal places (rounded to the fifth decimal place).

So let's calculate the step .

Let's move on to the nodes and the function values ​​in them:

For clarity and convenience, we summarize the results in a table:

We substitute the results obtained into the formula of the parabola method:

We specifically took a definite integral, which can be calculated using the Newton-Leibniz formula, in order to compare the results.

The results match to within hundredths.

Example.

Calculate Definite Integral by the Simpson method with an accuracy of 0.001 .

Solution.

In our example, a = 0 , .

First of all, we need to define n . To do this, we turn to the inequality for estimating the absolute error of the Simpson method. We can say that if we find n for which the inequality will hold , then when using the parabola method to calculate the original definite integral, the absolute error will not exceed 0.001. The last inequality can be rewritten as .

Let us find out what is the maximum value of the modulus of the fourth derivative of the integrand on the integration interval.

is an interval , and the integration segment contains extremum points, so .

We substitute the found value into the inequality and solve it:

Because n is a natural number (this is the same number of segments into which the integration segment is divided), then we can take n = 5, 6, 7, ... In order not to do unnecessary calculations, we take n = 5 .

Now we act as in the previous example. In intermediate calculations, we will round to the sixth order.

Calculate the step .

We find the nodes and the values ​​of the integrand in them:

We combine the results of calculations in a table:

We substitute the values ​​into the formula of the parabola method:

Thus, using the Simpson method, an approximate value of a definite integral is obtained accurate to 0.001 .

Indeed, having calculated the original integral using the Newton-Leibniz formula, we obtain

Comment.

Finding is difficult in many cases. You can get around this by taking an alternative approach to using the parabola method. Its principle is described in the trapezoid method section, so we will not repeat it.

What method should be used for numerical integration?

The accuracy of the Simpson method (parabolas) is higher than the accuracy of the method of rectangles and trapezoids for a given n (this can be seen from the absolute error estimate), so its use is preferable.

It should be remembered that the computational error affects the result for large n, which can move the approximate value away from the exact one.

(1710-1761).

Let's consider a segment. Let the values ​​of the real function f(x) at the points a, (a+b)/2, b be known. There is a single 2nd degree polynomial p 2 (x) whose graph passes through the points (a, f(a)), ((a+b)/2,f((a+b)/2), (b, f(b)). Simpson formula is called the integral of this polynomial on the interval :

Simpson's method has an order of error of 4 and an algebraic order of accuracy of 3.

Error when integrating over the segment [ a,b] with step h is determined by the formula:

,

where is the maximum of the fourth derivative of the function.

Also, if it is impossible to estimate the error using the maximum of the fourth derivative (for example, it does not exist on a given interval, or tends to infinity), a rougher estimate can be used:

,

where is the maximum of the third derivative of the function.

Links

  • Kostomarov D. P., Favorsky A. P. "Introductory Lectures on Numerical Methods"

Wikimedia Foundation. 2010 .

  • Runge-Kutta Method
  • Fibonacci method of finding an extremum

See what the "Simpson Method" is in other dictionaries:

    Simpson formula- The essence of the method is the approximation of the function f (x) (blue graph) by a quadratic polynomial P (x) (red) Simpson's formula (also ... Wikipedia

    ROMBERG METHOD- Romberg's rule, a method for calculating a definite integral based on Richardson extrapolation. Let the value I of a certain functional be calculated, while the calculated approximate value T(h) depends on the parameter h, so that in ... ... Mathematical Encyclopedia

    Numerical integration- (historical name: (numerical) quadrature) calculation of the value of a definite integral (usually approximate). Numerical integration is understood as a set of numerical methods for finding the value of a certain integral. Numerical ... ... Wikipedia

    Quadrature formulas

    Quadrature formula- A definite integral as the area of ​​\u200b\u200ba figure Numerical integration (historical name: quadrature) calculation of the value of a definite integral (usually approximate), based on the fact that the value of the integral is numerically equal to the area ... ... Wikipedia

    Rectangle formula- A definite integral as the area of ​​\u200b\u200ba figure Numerical integration (historical name: quadrature) calculation of the value of a definite integral (usually approximate), based on the fact that the value of the integral is numerically equal to the area ... ... Wikipedia

    Rectangle Formula- A definite integral as the area of ​​\u200b\u200ba figure Numerical integration (historical name: quadrature) calculation of the value of a definite integral (usually approximate), based on the fact that the value of the integral is numerically equal to the area ... ... Wikipedia

    Trapezoidal formula- A definite integral as the area of ​​\u200b\u200ba figure Numerical integration (historical name: quadrature) calculation of the value of a definite integral (usually approximate), based on the fact that the value of the integral is numerically equal to the area ... ... Wikipedia

    BIRTH- BIRTH. Contents: I. Definition of the concept. Changes in the body during R. Causes of the onset of R ............................ 109 II. Clinical current of physiological R. . 132 Sh. Mechanics R. ................. 152 IV. Leading P .............. 169 V ... Big Medical Encyclopedia

    Integral calculus- a branch of mathematics that studies the properties and methods for calculating integrals and their applications. I. and. is closely related to differential calculus (See. Differential calculus) and together with it constitutes one of the main parts ... ... Great Soviet Encyclopedia

Let us split the integration interval [ a, b] to an even number n equal parts in increments h. On each segment [ X 0, X 2], [X 2, X 4],..., [x i-1, x i+1],...,[ x n-2, x n] integrand f(X) is replaced by an interpolation polynomial of the second degree:

The coefficients of these square trinomials can be found from the conditions for the equality of the polynomial at the points of the corresponding tabular data. It can be taken as the Lagrange interpolation polynomial of the second degree passing through the points :

The sum of elementary areas and (Fig. 3.3) can be calculated using a certain integral. Taking into account the equalities, we obtain

-

Rice. 3.3. Illustration for the Simpson Method

Having carried out such calculations for each elementary segment , we sum the resulting expressions:

This expression for S is taken as the value of a definite integral:

(3.35)

The resulting ratio is called Simpson's formula or parabola formula.

This formula can also be obtained in other ways, for example, by applying the trapezoid method twice when partitioning the segment [ a, b] into parts with steps h and 2 h or by combining the formulas of rectangles and trapezoids (see section 3.2.6).

Sometimes Simpson's formula is written using half-integer indices. In this case, the number of partition segments P arbitrary (not necessarily even), and Simpson's formula is

(3.36)

It is easy to see that formula (3.36) coincides with (3.35) if formula (3.35) is applied to the number of partition segments 2 n and step h/2.

Example. Calculate the integral using the Simpson method

Function values ​​at n = 10, h = 0.1 are given in table. 3.3. Applying formula (3.35), we find

The result of numerical integration using the Simpson method turned out to be the same as the exact value (six significant figures).

One of the possible algorithms for calculating a definite integral using the Simpson method is shown in Fig. 3.4. The boundaries of the integration interval [ a, b],error ε, as well as the formula for calculating the values ​​of the integrand y=f(x) .

Rice. 3.4. Simpson method algorithm

Initially, the segment is divided into two parts with a step h =(b- a)/2. The value of the integral is calculated I 1. Then the number of steps is doubled, the value is calculated I 2 in increments h/2. The end-of-count condition is taken as . If this condition is not met, a new division of the step in half occurs, and so on.

Note that shown in Fig. 3.4 the algorithm is not optimal: when calculating each approximation I 2 function values ​​are not used f(x), already found in the previous step. More economical algorithms will be discussed in Sec. 3.2.7.

To construct the Simpson formula, we first consider the following problem: calculate the area S of a curvilinear trapezoid bounded from above by the graph of the parabola y \u003d Ax 2 + Bx + C, from the left by the straight line x \u003d - h, from the right by the straight line x \u003d h and from below by the segment [-h; h]. Let the parabola pass through three points (Fig. 8): D (-h; y 0) E (0; y 1) and F (h; y 2), and x 2 - x 1 = x 1 - x 0 = h . Consequently,

x 1 \u003d x 0 + h \u003d 0; x 2 = x 0 + 2h.

Then the area S is equal to the integral:

We express this area in terms of h, y 0 , y 1 and y 2 . To do this, we calculate the coefficients of the parabola A, B, C. From the condition that the parabola passes through the points D, E and F, we have:

Solving this system, we get: C = y 1 ; A=

Substituting these values ​​A and C into (3), we obtain the desired area

Let us now turn to the derivation of Simpson's formula for calculating the integral

To do this, we divide the integration segment into 2n equal parts of length

At the division points (Fig. 4). a \u003d x 0, x 1, x 2, ..., x 2n-2, x 2n-1, x 2n \u003d b,

We calculate the values ​​of the integrand f: y 0 , y 1 , y 2 , ...,y 2n-2 , y 2n-1 , y 2n , de y i = f(x i), x i = a + ih (i = 0, 1, 2,...,2n).

On the segment, we replace the integrand with a parabola passing through the points (x 0; y 0), (x 1; y 1) and (x 2; y 2), and to calculate the approximate value of the integral from x 0 to x 2, we use the formula (4 ). Then (the shaded area in Fig. 4):

Similarly, we find:

................................................

Adding the resulting equalities, we have:

Formula (5) is called generalized Simpson formula or parabola formula, since when deriving it, the graph of the integrand on a partial segment of length 2h is replaced by a parabola arc.

Job assignment:

1. As directed by the teacher or in accordance with an option from tables 4 tasks (see Appendix) to take the conditions - the integrand, the limits of integration.

2. Draw up a flowchart of the program and a program that should:

Request the accuracy of calculating a definite integral, the lower and upper limits of integration;

Calculate the given integral by methods: for options 1,4,7, 10… - right, for options 2,5,8,… - average; for options 2,5,8,… - left rectangles. Output the number of partitions of the integration range at which the specified calculation accuracy is achieved;

Calculate the given integral using the trapezoid method (for even options) and Simpson's method (for odd options).

Output the number of partitions of the integration range at which the specified calculation accuracy is achieved;

Output the values ​​of the control function for the given value of the argument and compare with the calculated values ​​of the integral. To conclude.


test questions

1. What is a definite integral?

2. Why, along with analytical methods, numerical methods for calculating definite integrals are used.

3. What is the essence of the main numerical methods for calculating definite integrals.

4. Influence of the number of partitions on the accuracy of calculating a definite integral by numerical methods.

5. How to calculate the integral by any method with a given accuracy?

In this method, it is proposed to approximate the integrand on a partial interval by a parabola passing through the points
(x j , f(x j)), where j = i-1; i-0.5; i, that is, we approximate the integrand by the Lagrange interpolation polynomial of the second degree:

(10.14)

After integrating, we get:

(10.15)

That's what it is simpson's formula or the formula of parabolas. On the segment
[a, b] Simpson's formula takes the form

(10.16)

A graphical representation of Simpson's method is shown in fig. 2.4.

Rice. 10.4. Simpson method

Let's get rid of fractional indices in expression (2.16) by renaming the variables:

(10.17)

Then Simpson's formula takes the form

(10.18)

The error of formula (2.18) is estimated by the following expression:

, (10.19)

where h n = b-a, . Thus, the error of Simpson's formula is proportional to O(h 4).

Comment. It should be noted that in the Simpson formula, the integration segment is necessarily divided into even number of intervals.

10.5. Calculation of definite integrals by methods
Monte Carlo

The previously discussed methods are called deterministic , that is, devoid of the element of chance.

Monte Carlo Methods(MMK) are numerical methods for solving mathematical problems by modeling random variables. MCM allow to successfully solve mathematical problems caused by probabilistic processes. Moreover, when solving problems that are not associated with any probabilities, one can artificially come up with a probabilistic model (and even more than one) that allows solving these problems. Consider the calculation of the definite integral

(10.20)

When calculating this integral using the formula of rectangles, the interval [ a, b] split into N identical intervals, in the middle of which the values ​​of the integrand were calculated. By calculating the function values ​​at random nodes, you can get a more accurate result:

(10.21)

(10.22)

Here γ i is a random number uniformly distributed over the interval
. The error in calculating the MMK integral ~ , which is much larger than that of the previously studied deterministic methods.

On fig. 2.5 shows a graphical implementation of the Monte Carlo method for calculating a single integral with random nodes (2.21) and (2.22).


(2.23)

Rice. 10.6. Monte Carlo integration (2nd case)

As seen in fig. 2.6, the integral curve lies in the unit square, and if we can get pairs of random numbers uniformly distributed over the interval, then the obtained values ​​(γ 1, γ 2) can be interpreted as the coordinates of a point in the unit square. Then, if there are enough of these pairs of numbers, we can approximately assume that
. Here S is the number of pairs of points that fall under the curve, and N is the total number of pairs of numbers.

Example 2.1. Calculate the following integral:

The problem was solved by various methods. The results obtained are summarized in table. 2.1.

Table 2.1

Comment. The choice of the table integral allowed us to compare the error of each method and find out the influence of the number of partitions on the accuracy of calculations.

11 APPROXIMATE SOLUTION OF NONLINEAR
AND TRANSCENDENT EQUATIONS