• 1st method using a graph;
  • 2nd method using function Excel =LINEST();

Read more about the polynomial and how to calculate it in Excel later in our article.

Polynomial trend used to describe values ​​of time series that alternately increase and decrease. The polynomial is great for analyzing a large data set of unstable magnitude (for example, sales of seasonal items).

What is a polynomial? Polynomial is a power function y=ax 2 +bx+c (polynomial of the second degree) and y=ax 3 +bx 2 +cx+d (polynomial of the third degree), etc. Polynomial degree determines the number of extrema (peaks), i.e. maximum and minimum values ​​over the analyzed period of time.

U polynomial of the second degree y=ax 2 +bx+c (1 maximum on the chart below).

U Polynomial of the third degree y=ax 3 +bx 2 +cx+d maybe one or two extremes.

One extreme

Two extremes

U Polynomial of the fourth degree no more three extremes etc.

How to calculate polynomial values ​​in Excel?

There are 3 ways to calculate polynomial values ​​in Excel:

  • 1st method using a graph;
  • 2nd method using the Excel function = LINEST;
  • 3rd method using Forecast4AC PRO;

1st way to calculate a polynomial - using a graph

We select a series with values ​​and build a time series graph.

We add a 6th degree polynomial to the graph.

Then, in the trend line format, check the box “show equation on chart”

The equation is then plotted as y = 3.7066x 6 - 234.94x 5 + 4973.6x 4 - 35930x 3 - 7576.8x 2 + 645515x + 5E+06. In order to make the last coefficient readable, we hold down the left mouse button and select the polynomial equation

Right-click and select "trend line label format"

In the trend line caption settings, select a number and in number formats select “Numeric”.

We get the polynomial equation in a readable format:

y = 3.71x 6 - 234.94x 5 + 4,973.59x 4 - 35,929.91x 3 - 7,576.79x 2 + 645,514.77x + 4,693,169.35

From this equation we take the coefficients a, b, c, d, g, m, v, and enter into the appropriate Excel cells

We assign a serial number to each period in the time series, which we will substitute in the equation instead of X.

Let's calculate the polynomial values ​​for each period. To do this, enter the polynomial formula y = 3.71x 6 - 234.94x 5 + 4,973.59x 4 - 35,929.91x 3 - 7,576.79x 2 + 645,514.77x + 4,693,169.35 in the first cell and fix links to trend coefficients (see)

R2C8 *RC[-3]^6+ R3C8 *RC[-3]^5+ R4C8 *RC[-3]^4+ R5C8 *RC[-3]^3+ R6C8 *RC[-3]^2+ R7C8 *RC[-3]+ R8C8

R2C8*RC[-3] ^6 +R3C8*RC[-3]^5 +R4C8*RC[-3]^4 +R5C8*RC[-3]^3 +R6C8*RC[-3]^2 +R7C8*RC[-3] +R8C8

2nd way to calculate a polynomial in Excel - function LINEST()

Let's calculate the linear trend coefficients using the standard Excel functions =LINEST()

To calculate the coefficients in the formula =LINEST(known y values, known x values, constant, statistics) enter:

  • "known values ​​of y" (sales volumes for periods),
  • "known x values" (ordinal number of the time series),
  • set "1" to the constant
  • to statistics "0"

We get the following formula:

LINEST(R[-4]C:R[-4]C;R[-5]C:R[-5]C;1;0),

Now, for the formula Linear() calculated the coefficients of the polynomial, we need to add to it the degree of the polynomial whose coefficients we want to calculate.

To do this, in the part of the formula with “known values ​​of x” we enter polynomial degree:

  • ^(1:2:3:4:5:6) - for calculating the coefficients of a 6th degree polynomial
  • ^(1:2:3:4:5) - for calculating the coefficients of a 5th degree polynomial
  • ^(1:2) - for calculating the coefficients of a 2nd degree polynomial

We get the following formula:

LINEST(R[-4]C:R[-4]C; R[-5]C:R[-5]C^(1:2:3:4:5:6) ; 1; 0)

Enter the formula into the cell, we get 3.71 -- value (a) for a 6th degree polynomial y=ax^6+bx^5+cx^4+dx^3+gx^2+mx+v

In order for Excel to calculate all 7 polynomial coefficients 6th degree y=ax^6+bx^5+cx^4+dx^3+gx^2+mx+v, it is necessary:

1. Place the cursor in the cell with the formula and select 7 adjacent cells to the right, as in the figure:

2. Press the F2 key

We get 7 polynomial trend coefficients of the 6th degree.

Let's calculate the values ​​of the polynomial trend using the obtained coefficients. Substitute into the equation y=3.7* x ^ 6 -234.9* x ^ 5 +4973.5* x ^ 4 -35929.9 * x^3 -7576.7 * x^2 +645514.7* x +4693169.3 numbers of periods X for which we want to calculate the polynomial values.

We assign a serial number to each period in the time series, which we will substitute in the polynomial equation instead of X.

Let's calculate the polynomial trend values ​​for each period. To do this, enter the polynomial formula in the first cell and fix the links to the trend coefficients (see)

We get the following formula:

R2C8 *RC[-3]^6+R3C8 *RC[-3]^5+R4C8 *RC[-3]^4+R5C8 *RC[-3]^3+R6C8 *RC[-3]^2+ R7C8 *RC[-3]+R8C8

in which the trend coefficients are fixed and instead of “x” we substitute a reference to the number of the current time series (for the first the value is 1, for the second 2, etc.)

We also raise “X” to the appropriate power (the “^” icon in Excel means raising to a power)

R2C8*RC[-3]^6 +R3C8*RC[-3]^5 +R4C8*RC[-3]^4 +R5C8*RC[-3]^3 +R6C8*RC[-3]^2 + R7C8*RC[-3]+R8C8

Now we extend the formula to the end of the time series and obtain the calculated values ​​of the polynomial trend for each period.

The 2nd method is more accurate than the first, because We get trend coefficients without rounding, and this calculation is also faster.

3rd way to calculate polynomial trend values ​​- Forecast4AC PRO

Place the cursor at the beginning of the time series

Go to the Forecast4AC PRO settings, select “Forecast with growth and seasonality”, “6th degree polynomial”, click the “Calculate” button.

We go to the sheet with the step-by-step calculation "ForPol6", find the line "Emerging trend":

Copy the values ​​to our sheet.

We obtain the values ​​of the 6th degree polynomial, calculated in 3 ways using:

  1. Polynomial trend coefficients plotted on a graph;
  2. Polynomial coefficients calculated using the Excel =LINEST function
  3. and with Forecast4AC PRO at the touch of a key, quickly and easily.

Join us!

Download free forecasting and business analysis apps:


  • Novo Forecast Lite- automatic forecast calculation V Excel.
  • 4analytics - ABC-XYZ analysis and emissions analysis Excel.
  • Qlik Sense Desktop and QlikViewPersonal Edition - BI systems for data analysis and visualization.

Test the capabilities of paid solutions:

  • Novo Forecast PRO- forecasting in Excel for large data sets.

Polynomial coefficients

Multinomial coefficients- coefficients in the expansion in monomials :

Multinomial coefficient value defined for all non-negative integers n and such that:

.

Binomial coefficient for non-negative n,k is a special case of a multinomial coefficient (for m= 2 ), namely

.

In a combinatorial sense, the multinomial coefficient equal to the number of ordered partitions n-element set on m power subsets.

Properties

See also

Wikimedia Foundation. 2010.

See what “Polynomial coefficients” are in other dictionaries:

    - (from the English spline, from spline a flexible pattern, a strip of metal used for drawing curved lines) a function whose domain of definition is divided into a finite number of segments, on each of which the spline coincides with a certain ... ... Wikipedia

    Multinomial (polynomial) coefficients coefficients in monomial expansion: Explicit formula Value of multinomial coefficient ... Wikipedia

    The "Polynomial" request is redirected here; see also other meanings. A polynomial (or polynomial) of n variables is a finite formal sum of the form where there is a set of non-negative integers (called a multiindex), a number ... ... Wikipedia

    In mathematics, polynomials or polynomials in one variable are functions of the form where ci are fixed coefficients and x is a variable. Polynomials constitute one of the most important classes of elementary functions. Study of polynomial equations and their solutions... ... Wikipedia

    In mathematics, polynomials or polynomials in one variable are functions of the form where ci are fixed coefficients and x is a variable. Polynomials constitute one of the most important classes of elementary functions. Study of polynomial equations and their solutions... ... Wikipedia

    In mathematics, polynomials or polynomials in one variable are functions of the form where ci are fixed coefficients and x is a variable. Polynomials constitute one of the most important classes of elementary functions. Study of polynomial equations and their solutions... ... Wikipedia

    In mathematics, polynomials or polynomials in one variable are functions of the form where ci are fixed coefficients and x is a variable. Polynomials constitute one of the most important classes of elementary functions. Study of polynomial equations and their solutions... ... Wikipedia

    In mathematics, polynomials or polynomials in one variable are functions of the form where ci are fixed coefficients and x is a variable. Polynomials constitute one of the most important classes of elementary functions. Study of polynomial equations and their solutions... ... Wikipedia

    A rectangular table consisting of rows and n columns, the elements of which belong to a certain set K. Table (1) is called. also a matrix over K, or a matrix of size over K. Let the set of all matrices over K. If m = n, then (1) is called. square... ... Mathematical Encyclopedia

It is noted that in the case when the characteristic of a nonlinear element is approximated by an expression containing more than three points, it is advisable to select the value of the function with equally spaced values ​​of the argument. In addition, if the number of specified points exceeds the number of approximation coefficients to be determined, it is recommended to use the “least squares method”, in which the root mean square error is minimal, i.e. with this method, the sum of squared deviations of a polynomial of a given degree from the curve is the smallest.

In accordance with this, despite the existing computer programs, it is advisable to provide a brief recipe for using this method, which will allow the student to comprehend the mathematical essence of the method and, using simple microcalculators, perform any approximation in the shortest possible time.

It is noted that it is most rational to calculate the polynomial coefficients using the least squares method using the ones introduced by Yu.B. Kobzarev orthogonal polynomials for given number N – equidistant points.

Let us denote by a polynomial of degree l. Then the system of polynomials will be orthogonal for a given number of points if, for any
equality holds

. (16)

Using the well-known orthogonal Chebyshev polynomials according to the method of Yu.B. Kobzarev found all seven polynomials that form such a system on the segment
for N=11 equally spaced points, i.e. at
; –0.8; ... 0 ... 0.8; 1.0 we have:

(17)

System (17) of orthogonal polynomials has the remarkable property that expansion of any given function in them gives the best approximation in the sense of least squares. Therefore, instead of, for example, expression (18) of the transmission coefficient by voltage degrees
with unknown coefficients, we can write it by presenting it as the sum (19) of the polynomials discussed above:

(18)

. (19)

Here R– degree of the polynomial; r– an integer equal to the number of the term; – coefficient having dimension
, which can be called a slope of the order r, i.e. there is a slope of zero order, – first order, etc.

The quantity included here X proportional to voltage
, measured from the middle of the approximation section
, i.e. when changing
within
,X varies from –1 to 1, so

. (20)

To determine the coefficient
in (19) we multiply both sides of the equality by the polynomial
and sum over all points . Then, using the orthogonality property (16), we find

. (21)

, (22)

Where
– normalized polynomial

. (23)

Since the zero node corresponds to the left end of the approximation section, i.e.
, then sum (22) can be conveniently divided into sums where X<0 и X>0, since even polynomials ( r= 0, 2, 4, 6) in these areas are no different, and odd ( r=1, 3, 5, 7) differ only in signs. In this regard, it is advisable to introduce an odd
and even
gain components TO:

(24)

Where
- change step X(in our case with N=11
);

- the magnitude of the gain at points
.

Now instead of sums over positive and negative values you can take the sums only over the positive ones using the even and odd components of the gain. Then

(25)

Summarized in the table. 1 values ​​of coefficients of normalized polynomials
and using them, it is easy to find the coefficients
according to formulas (25), then in (19) group the terms by powers X and move on to representing the gain as a polynomial in powers
. The coefficients of this polynomial will be selected in the best least squares sense, in which the experimental curve
will practically merge with the theoretical curve
.

We will consider the calculation of the coefficients of the polynomial used in harmonic analysis to determine the coefficients and parameters of nonlinearity and, ultimately, to select the optimal mode of the amplification device using a specific example.

Table 1

If for a polynomial nth degree If the root is found, then you can lower the degree of the polynomial by constructing a polynomial of degree whose all roots coincide with the roots of the polynomial, except that it does not have a root.

Let us write down the relation connecting the polynomials:

Taking into account relation 6.3 about the equality of two polynomials of the same degree, we can write out a relation connecting the coefficients of these polynomials. These relations are not difficult to resolve with respect to unknown coefficients. As a result we get:

(6.4)

Note that there are only unknowns, but equations can be constructed - . But the last equation is a consequence of the previous ones and is used to control calculations.

You can apply the same process to a new polynomial - find its root and then lower the degree of the polynomial. In reality, lowering the degree does not greatly simplify the task of finding the roots, so most often it is easier to find the roots of the original polynomial by changing the initial approximations in an iterative process or by finding various intervals at which the polynomial changes its sign.

Finding the coefficients of a polynomial from its roots

Until now, we have considered the problem of finding the roots of a polynomial with given coefficients. Sometimes you have to solve the inverse problem - find the coefficients of a polynomial if its roots are known - . There are countless polynomials with the same roots. However, among them there is a single polynomial with a coefficient equal to one. This polynomial is called reduced, and we will construct it. All other polynomials are obtained from the given polynomial by multiplying all coefficients by arbitrary number, which only requires that it not be equal to zero. Therefore, to uniquely solve the problem, it is necessary to specify n roots and the coefficient of the leading term of the polynomial. Then we can write the following equality:

To find the coefficients of the polynomial, we use, as usual, relation 6.3. But it is difficult to apply it directly. Therefore, we will use the process inverse to the process of reducing the degree. Let us first construct a polynomial of the first degree, which has a single root. Then we increase the degree and construct a polynomial of the second degree - , which has another root - . Continuing this process, we reach the desired polynomial. When calculating the coefficients of a new polynomial, we will use the coefficients of an already calculated polynomial of one lesser degree. The resulting relations are close to those given for the case of decreasing the degree of the polynomial.

The coefficients of a first degree polynomial are written out explicitly:

Polynomial coefficients kth degree are calculated through the coefficients of a polynomial of degree k-1:

Moving on to the coefficients, we obtain the following equations:

(6.5)

In relation 6.5, the coefficients of a polynomial of degree are denoted by . In fact, the circuit is safe and allows you to read the coefficients in the same place, without requiring additional memory. I will give an algorithm for calculating the coefficients of a polynomial from its roots in the form of a diagram close to the C# language.

Calculate:

//Calculate the coefficients of the first degree polynomial a= 1; a = -x; //cycle through the number of polynomials for(int k=2;k<=n; k++) { //Вычисляем коэффициенты полинома степени k //Вначале старший коэффициент a[k]= a; //затем остальные коэффициенты, кроме последнего for(int i=k-1;i>0; i--) ( a[i] = a- a[i]*x; ) //now the lowest coefficient a= -a*x; ) //The last stage is multiplying the coefficients by an for(int i=0; i<=n; i++) a[i] = a[i]*an;

Lagrange polynomial

Let the point on the plane be given: . A Lagrange polynomial is a polynomial of nth degree passing through all points. If the points do not form returns, then such a polynomial exists and is unique. By return we mean a situation where there are two points and such that .

How to construct such a polynomial? Lagrange proposed the following algorithm. The polynomial is constructed as the sum of nth degree polynomials:

Each of the polynomials included in the sum is constructed as follows. The roots of a polynomial are all points except the point . Uniqueness is ensured by the fact that the coefficient of the leading term an is selected so that the polynomial passes through the point . In Lagrange notation, the polynomial looks like this:

LABORATORY WORK No. 7

INTERPOLATION OF A FUNCTION BY POLYNOMIALS

LAGRANGE

Exercise. Calculate the approximate value of the function for a given value of the argument x* using the Lagrange interpolation polynomial; construct a graph of the Lagrange polynomial passing through the given six points.

Brief description of the method.

Let's start by considering the interpolation problem in the simplest and most fully studied case of interpolation by algebraic polynomials. For a given data table)

interpolation polynomial, if it satisfies the conditions

Equality (7.2) can be written as a system of equations

relative to the coefficients of the polynomial a to. This system is uniquely solvable, since the system of functions 1, x, x 2,x n linearly independent at points x 0, x and .x p. The unique solvability of system (7.3) follows from the well-known fact that the determinant of this system ( Vandermonde determinant)

is different from zero if the interpolation nodes are pairwise different. Thus, the following theorem is true.

Theorem 7.1.There is a unique interpolation polynomial of degree n satisfying the conditions(7.2).

Comment. In practice, system (7.3) is never used to calculate the coefficients of the interpolation polynomial. The fact is that it is often poorly conditioned. In addition, there are various convenient explicit forms of writing the interpolation polynomial, which are used in interpolation. Finally, in most applications of the interpolation polynomial, the explicit calculation of the coefficients a to no need.

Interpolation problem consists in constructing a function (x) that satisfies the condition. In other words, the task is to construct a function whose graph passes through given points (x i,y i) Since the function (x) passes through all given points, this method is called global interpolation. The simplest and most fully studied case is interpolation by algebraic polynomials. One form of writing the interpolation polynomial -Lagrange polynomial:

As is easy to see, it is a polynomial that satisfies the conditions

Thus, the Lagrange polynomial is indeed an interpolation polynomial.

In engineering practice, interpolation by polynomials of the first, second and third degrees is most often used. We present the corresponding formulas for writing Lagrange polynomials of the first and second degrees:

Example 7.1. Let a table of function values ​​be given at=lnx:

X 1,0 1,1 1,2 1,3 1,4
U 0,000000 0,095310 0,182322 0,262364 0,336472

To approximately calculate the value of ln(1.23), we use linear and quadratic interpolation.

Let's take x 0 =1.2 and x 1 =1.3. Calculation using formula (7.4) gives the value 1n(1.23) 0.206335.

To apply quadratic interpolation, take x 0 =1.1, x 1 =1.2, x 2 =1.3 - the three closest to the point x =1.23

node. Calculating using formula (7.5), we have 1n(1.23) 0.207066.

We present without proof the most well-known theorem about interpolation error.

Theorem 7.1. Let the function f(x) differentiable n+1

once on a segment [a, b], containing interpolation nodes. Then for the interpolation error at the point equality is true

in which

- some point belonging to the interval (a, b).

The main disadvantage in using this theorem is that the point is unknown. Therefore, most often it is not the theorem itself that is used, but its corollary.

Consequence.A fair estimate of the interpolation error at the point , having the form

as well as an estimate of the maximum module of the interpolation error on the segment, which has the form

Example 7.2. Let us estimate the error of approximations to

ln(1,23) obtained in Example 7.1 using interpolation with polynomials of the first and second degrees. In these cases, inequality (7.7) takes the form

Note that for we have and . Therefore here

Then, due to inequalities (7.9) and (7.10), we obtain the following error estimates:

If on the segment , the derivative changes slightly, then the magnitude of the absolute error is almost completely determined by the value of the function. An idea of ​​the typical behavior of this function can be obtained from Fig. 1. Let us pay attention to the fact that when the argument x goes beyond the observation interval, the value quickly becomes very large. This explains the unreliability of function extrapolation for argument values ​​distant from the observation segment.

Let it be now and let it be i th step of the table, and Somewhat roughening the estimate (7.8), we can obtain the following inequality

It allows us to state that for a sufficiently smooth function with a fixed degree of the interpolation polynomial, the interpolation error on the segment [x 0 , x n ] at tends to zero no slower than a certain value proportional to . This fact is usually formulated as follows: interpolation by a polynomial of degree n has the (n+1)th order of accuracy with respect to h max . In particular, linear and quadratic interpolation have second and third order accuracy, respectively.

Options x* x i y i Options x* x i y i
0,702 0,43 0,48 0,55 0,62 0,70 0,75 1,63597 1,73234 1,87686 2,03345 2,22846 2,35973 0,152 0,02 0,08 0,12 0,17 0,23 0,30 1,02316 1,09590 1,14725 1,21483 1,30120 1,40976
0,512 0,174
0,645 0,185
0,736 0,203
0,526 0,35 0,41 0,47 0,51 0,56 0,64 2,73951 2,30080 1,96864 1,78776 1,59502 1,34310 0,616 0,41 0,46 0,52 0,60 0,65 0,72 2,57418 2,32513 2,09336 1,?6203 1,74260 1,62098
0,453 0,478
. 15 0,482 0,665
0,552 0,537
0,896 0,68 0,73 0,80 0,88 0,93 0,99 0.80866 0,89492 1,02964 1,20966 1,34087 1,52368 0,314 0,11 0,15 0,21 0,29 0,35 0.40 9,05421 6,61659 4,69170 3,35106 2,73951 2,36522
0,812 0,235
0,774 0,332
0,915 0,275

Program algorithm

Use modules crt And graph;

definition of variables;

start of the executable part of the program

setting the values ​​of array elements x[i] and y[i]; setting the value of the argument xz; уz = 0; in a cycle by i from 0 to 5 perform

| in a loop through ] from 0 to 5 execute if * / then |xx =xx (xz - x[j]/(x[i] - x[j]);

| y z =y z+y[i] x x

end of cycle i;

displaying values xz And yz;.

waiting for the Enter key to be pressed;

switch to graphic mode;

image of given points (x i,y i);

image of the graph of the Lagrange polynomial;

Waiting for any key to be pressed ends the program.

Note. When working in graphical mode, use the programs from previous labs.

Security questions

1. What is the task of interpolation?

2. Which polynomial is called an interpolation polynomial?

3. What is the difference between global and local interpolation?

4. How does the degree of the Lagrange interpolation polynomial depend on the number of nodes?

5. How many polynomials exist that satisfy the interpolation condition?

6. What are the disadvantages of the Lagrange interpolation polynomial?

7. How is the interpolation error estimated?

8. How does the interpolation accuracy change depending on the distance from the observation segment and why?

The report must contain initial data, problem statement, information about the solution method, program text, results obtained and a schedule.