Horner's method examples. Horner circuit, real version, serial version

reservoirs 20.09.2019
reservoirs

Etc. is of a general nature and great importance to study the WHOLE course of higher mathematics. Today we will repeat the "school" equations, but not just "school" ones - but those that are ubiquitous in various tasks vyshmata. As usual, the story will go in an applied way, i.e. I will not focus on definitions, classifications, but will share with you exactly personal experience solutions. The information is intended primarily for beginners, but more prepared readers will also find a lot for themselves. interesting moments. And of course there will be new material, out of scope high school.

So the equation... Many people remember this word with a shudder. What are the "fancy" equations with roots... ...forget about them! Because further you will meet the most harmless "representatives" of this species. Or boring trigonometric equations with dozens of solutions. To be honest, I didn't really like them either... No panic! - then you are expected mainly by "dandelions" with an obvious solution in 1-2 steps. Although the "burdock", of course, clings - here you need to be objective.

Oddly enough, in higher mathematics it is much more common to deal with very primitive equations like linear equations.

What does it mean to solve this equation? This means - to find SUCH value of "x" (root), which turns it into a true equality. Let's flip the "troika" to the right with a change of sign:

and drop the "two" in right side (or, the same thing - multiply both parts by) :

To check, we substitute the won trophy into the original equation:

The correct equality is obtained, which means that the found value is indeed the root of this equation. Or, as they say, satisfies this equation.

Note that the root can also be written as decimal fraction:
And try not to stick to this nasty style! I repeated the reason many times, in particular, at the very first lesson on higher algebra.

By the way, the equation can also be solved "in Arabic":

And what is most interesting - this record is completely legal! But if you are not a teacher, then it is better not to do this, because originality is punishable here =)

And now a little about

graphical solution method

The equation has the form and its root is "x" coordinate intersection points linear function graph with schedule linear function (abscissa axis):

It would seem that the example is so elementary that there is nothing more to analyze here, but one more unexpected nuance can be “squeezed” out of it: we represent the same equation in the form and plot the function graphs:

Wherein, please don't confuse the two: an equation is an equation, and function is a function! Functions only help find the roots of the equation. Of which there may be two, three, four, and even infinitely many. The closest example in this sense is everyone knows quadratic equation, whose solution algorithm was awarded a separate item "hot" school formulas. And this is no accident! If you can solve a quadratic equation and know the Pythagorean theorem, then, one might say, “the floor of higher mathematics is already in your pocket” =) Exaggerated, of course, but not so far from the truth!

And therefore, we are not too lazy and solve some quadratic equation according to standard algorithm:

, so the equation has two different valid root:

It is easy to verify that both found values ​​really satisfy this equation:

What to do if you suddenly forgot the solution algorithm, and there are no tools / helping hands at hand? Such a situation may arise, for example, in a test or exam. We use the graphic method! And there are two ways: you can pointwise build parabola , thereby finding out where it intersects the axis (if it crosses at all). But it is better to act more cunningly: we present the equation in the form, draw graphs of simpler functions - and "x" coordinates their points of intersection, at a glance!


If it turns out that the line touches the parabola, then the equation has two coinciding (multiple) roots. If it turns out that the line does not intersect the parabola, then there are no real roots.

To do this, of course, you need to be able to build graphs of elementary functions, but on the other hand, these skills are within the power of even a schoolboy.

And again - an equation is an equation, and functions , are functions that only helped solve the equation!

And here, by the way, it would be appropriate to remember one more thing: if all the coefficients of the equation are multiplied by a non-zero number, then its roots will not change.

So, for example, the equation has the same roots. As the simplest “proof”, I will take the constant out of brackets:
and painlessly remove it (I will divide both parts into “minus two”):

BUT! If we consider the function , then here it is already impossible to get rid of the constant! It is only possible to take the multiplier out of brackets: .

Many underestimate the graphical solution method, considering it to be something "undignified", and some even completely forget about this possibility. And this is fundamentally wrong, because plotting sometimes just saves the day!

Another example: suppose you do not remember the roots of the simplest trigonometric equation:. The general formula is in school textbooks, in all reference books on elementary mathematics but they are not available to you. However, solving the equation is critical (otherwise "two"). There is an exit! - we build graphs of functions:


after which we calmly write down the "x" coordinates of their intersection points:

There are infinitely many roots, and their folded notation is accepted in algebra:
, where ( – set of integers) .

And, without "departing from the cash desk", a few words about the graphical method for solving inequalities with one variable. The principle is the same. So, for example, any "x" is the solution to the inequality, because the sinusoid lies almost entirely under the straight line. The solution to the inequality is the set of intervals on which the pieces of the sinusoid lie strictly above the straight line (abscissa):

or, in short:

And here is the set of solutions to the inequality - empty, since no point of the sinusoid lies above the straight line.

Anything not clear? Urgently study the lessons about sets and function graphs!

Warm up:

Exercise 1

Solve graphically the following trigonometric equations:

Answers at the end of the lesson

As you can see, to study the exact sciences, it is not at all necessary to cram formulas and reference books! Moreover, this is a fundamentally vicious approach.

As I already reassured you at the very beginning of the lesson, complex trigonometric equations in the standard course of higher mathematics have to be solved extremely rarely. All complexity, as a rule, ends with equations like , the solution of which is two groups of roots, derived from the simplest equations and . Don’t worry too much about the solution of the latter - look in a book or find it on the Internet =)

The graphical method of solving can also help out in less trivial cases. Consider, for example, the following "motley" equation:

The prospects for its solution look ... they don’t look at all, but one has only to present the equation in the form , construct function graphs and everything will be incredibly simple. The drawing is in the middle of the article about infinitesimal functions (opens in next tab).

Using the same graphical method, you can find out that the equation already has two roots, and one of them is equal to zero, and the other, apparently, irrational and belongs to the segment . Given root can be calculated approximately, for example, tangent method. By the way, in some tasks, it happens that it is required not to find the roots, but to find out do they exist at all. And here, too, a drawing can help - if the graphs do not intersect, then there are no roots.

Rational roots of polynomials with integer coefficients.
Horner's scheme

And now I suggest you turn your eyes to the Middle Ages and feel the unique atmosphere of classical algebra. For a better understanding of the material, I recommend at least a little familiarization with complex numbers.

They are the most. Polynomials.

The object of our interest will be the most common polynomials of the form with whole coefficients . Natural number called polynomial degree, number - coefficient at the highest degree (or just the highest coefficient), and the coefficient is free member.

I will denote this polynomial folded by .

Polynomial roots called the roots of the equation

I love iron logic =)

For examples, we go to the very beginning of the article:

There are no problems with finding the roots of polynomials of the 1st and 2nd degrees, but as you increase this task becomes more and more difficult. But on the other hand, everything is more interesting! And this is what the second part of the lesson will be devoted to.

First, literally half a screen of theory:

1) According to the corollary fundamental theorem of algebra, the degree polynomial has exactly integrated roots. Some roots (or even all) can be in particular valid. Moreover, among the real roots there can be identical (multiple) roots (minimum two, maximum pieces).

If some complex number is a root of a polynomial, then conjugate its number is also necessarily the root of this polynomial (conjugate complex roots have the form ).

The simplest example- a quadratic equation, which was first encountered in 8 (like) class, and which we finally “finished off” in the topic complex numbers. I remind you: a quadratic equation has either two different real roots, or multiple roots, or conjugate complex roots.

2) From Bezout's theorems it follows that if the number is the root of the equation, then the corresponding polynomial can be factorized:
, where is a polynomial of degree .

And again, our old example: since is the root of the equation , then . After that, it is easy to get the well-known "school" decomposition .

The consequence of Bezout's theorem is of great practical value: if we know the root of the 3rd degree equation, then we can represent it in the form and from quadratic equation it is easy to recognize the rest of the roots. If we know the root of the 4th degree equation, then it is possible to expand the left side into a product, etc.

And there are two questions here:

Question one. How to find this root? First of all, let's define its nature: in many problems of higher mathematics it is required to find rational, in particular whole the roots of polynomials, and in this regard, further we will be interested mainly in them .... …they are so good, so fluffy, that you just want to find them! =)

The first thing that suggests itself is the selection method. Consider, for example, the equation . The catch here is in the free term - if it were equal to zero, then everything would be in openwork - we put the "x" out of brackets and the roots themselves "fall out" to the surface:

But our free term is equal to the "three", and therefore we begin to substitute into the equation various numbers, claiming the title of "root". First of all, the substitution of single values ​​suggests itself. Substitute :

Received incorrect equality, thus, the unit "did not fit." Okay, let's put it in:

Received correct equality! That is, the value is the root of this equation.

To find the roots of a polynomial of the 3rd degree, there is an analytical method (the so-called Cardano formulas), but now we are interested in a slightly different problem.

Since - is the root of our polynomial, then the polynomial can be represented in the form and arises Second question: how to find the "younger brother"?

The simplest algebraic considerations suggest that for this you need to divide by. How to divide a polynomial by a polynomial? The same school method that divides ordinary numbers - a "column"! I discussed this method in detail in the first examples of the lesson. Complex Limits, and now we will consider another method, which is called Horner's scheme.

First, we write the "senior" polynomial with everyone , including zero coefficients:
, after which we enter these coefficients (strictly in order) in the top row of the table:

On the left we write the root:

I’ll immediately make a reservation that Horner’s scheme also works if the “red” number not is the root of the polynomial. However, let's not rush things.

We take down the senior coefficient from above:

The process of filling in the lower cells is somewhat reminiscent of embroidery, where “minus one” is a kind of “needle” that permeates the subsequent steps. We multiply the "demolished" number by (-1) and add the number from the top cell to the product:

We multiply the found value by the “red needle” and add the following equation coefficient to the product:

And, finally, the resulting value is again “processed” with a “needle” and an upper coefficient:

Zero in the last cell tells us that the polynomial has divided into without a trace (as it should be), while the expansion coefficients are "removed" directly from the bottom row of the table:

Thus, we moved from the equation to an equivalent equation, and everything is clear with the two remaining roots (in this case conjugate complex roots are obtained).

Equation, by the way, can also be solved graphically: build "zipper" and see that the graph crosses the x-axis () at point . Or the same "cunning" trick - we rewrite the equation in the form , draw elementary graphs and detect the "x" coordinate of their intersection point.

By the way, the graph of any polynomial function of the 3rd degree crosses the axis at least once, which means that the corresponding equation has at least one valid root. This fact is true for any polynomial function of odd degree.

And here I also want to stop at important point regarding terminology: polynomial and polynomial functionit's not the same! But in practice, they often talk, for example, about the “polynomial graph”, which, of course, is negligent.

But let's get back to Horner's scheme. As I recently mentioned, this scheme works for other numbers as well, but if the number not is the root of the equation, then a non-zero additive (remainder) appears in our formula:

Let's "drive" the "unsuccessful" value according to Horner's scheme. At the same time, it is convenient to use the same table - we write down a new “needle” on the left, we demolish the highest coefficient from above (left green arrow), and away we go:

To check, we open the brackets and give like terms:
, OK.

It is easy to see that the remainder (“six”) is exactly the value of the polynomial at . And in fact - what is it:
, and even nicer - like this:

From the above calculations, it is easy to understand that Horner's scheme allows not only to factorize the polynomial, but also to carry out a "civilized" selection of the root. I suggest that you independently fix the calculation algorithm with a small task:

Task 2

Using Horner's scheme, find the whole root of the equation and factorize the corresponding polynomial

In other words, here you need to sequentially check the numbers 1, -1, 2, -2, ... - until a zero remainder is “drawn” in the last column. This will mean that the "needle" of this line is the root of the polynomial

Calculations are conveniently arranged in a single table. Detailed solution and answer at the end of the lesson.

The method of selecting roots is good for relatively simple cases, but if the coefficients and/or the degree of the polynomial are large, then the process may be delayed. Or maybe some values ​​​​from the same list 1, -1, 2, -2 and it makes no sense to consider? And, besides, the roots may turn out to be fractional, which will lead to a completely non-scientific poke.

Fortunately, there are two powerful theorems that can significantly reduce the enumeration of “candidate” values ​​for rational roots:

Theorem 1 Consider irreducible fraction , where . If the number is the root of the equation, then the free term is divisible by and the leading coefficient is divisible by.

In particular, if the leading coefficient is , then this rational root is integer:

And we begin to exploit the theorem just from this tasty particular:

Let's go back to the equation. Since its leading coefficient is , then the hypothetical rational roots can be exclusively integer, and the free term must necessarily be divided by these roots without a remainder. And the "three" can only be divided into 1, -1, 3 and -3. That is, we have only 4 "candidates for the roots." And, according to Theorem 1, other rational numbers cannot be the roots of this equation IN PRINCIPLE.

There are a little more “applicants” in the equation: the free term is divided into 1, -1, 2, -2, 4 and -4.

Please note that the numbers 1, -1 are "regulars" of the list of possible roots (an obvious consequence of the theorem) and most the best choice for the first check.

Let's move on to more meaningful examples:

Task 3

Solution: since the leading coefficient , then the hypothetical rational roots can only be integers, while they must necessarily be divisors of the free term. "Minus forty" is divided into the following pairs of numbers:
- a total of 16 "candidates".

And here a tempting thought immediately appears: is it possible to weed out all negative or all positive roots? In some cases you can! I will formulate two signs:

1) If all If the coefficients of a polynomial are non-negative, then it cannot have positive roots. Unfortunately, this is not our case (Now, if we were given an equation - then yes, when substituting any value of the polynomial is strictly positive, which means that all positive numbers (and irrational too) cannot be roots of the equation.

2) If the coefficients for odd powers are non-negative, and for all even powers (including free member) are negative, then the polynomial cannot have negative roots. This is our case! Looking closely, you can see that when any negative “x” is substituted into the equation, the left side will be strictly negative, which means that the negative roots disappear

Thus, 8 numbers are left for research:

Consistently "charge" them according to the Horner scheme. I hope you have already mastered the mental calculations:

Luck was waiting for us when testing the "deuce". Thus, is the root of the equation under consideration, and

It remains to investigate the equation . It is easy to do this through the discriminant, but I will conduct an exponential test in the same way. First, note that the free term is equal to 20, which means that according to Theorem 1 the numbers 8 and 40 drop out of the list of possible roots, and the values ​​remain for research (one was eliminated according to the Horner scheme).

We write the coefficients of the trinomial in the top row of the new table and we start checking with the same "two". Why? And because the roots can be multiples, please: - this equation has 10 identical roots. But let's not digress:

And here, of course, I was a little cunning, knowing that the roots are rational. After all, if they were irrational or complex, then I would have an unsuccessful check of all the remaining numbers. Therefore, in practice, be guided by the discriminant.

Answer: rational roots: 2, 4, 5

In the analyzed problem, we were lucky, because: a) negative values ​​fell off immediately, and b) we found the root very quickly (and theoretically we could check the entire list).

But in reality the situation is much worse. I invite you to view exciting game entitled " The last Hero»:

Task 4

Find rational roots of an equation

Solution: on Theorem 1 numerators of hypothetical rational roots must satisfy the condition (read "twelve is divisible by ale"), and the denominators to the condition . Based on this, we get two lists:

"list el":
and "list em": (fortunately, here the numbers are natural).

Now let's make a list of all possible roots. First, we divide the “list of ale” by . It is quite clear that the same numbers will turn out. For convenience, let's put them in a table:

Many fractions have been reduced, resulting in values ​​that are already in the "list of heroes". We add only "newcomers":

Similarly, we divide the same "list of ale" by:

and finally on

Thus, the team of participants in our game is staffed with:


Unfortunately, the polynomial of this problem does not satisfy the "positive" or "negative" criterion, and therefore we cannot discard the top or bottom row. You have to work with all the numbers.

How is your mood? Come on, turn your nose up - there is another theorem that can be figuratively called the “killer theorem” .... ... "candidates", of course =)

But first you need to scroll through Horner's diagram for at least one the whole numbers. Traditionally, we take one. In the upper line we write the coefficients of the polynomial and everything is as usual:

Since four is clearly not zero, the value is not the root of the polynomial in question. But she will help us a lot.

Theorem 2 If for some in general value of the polynomial is nonzero: , then its rational roots (if they are) satisfy the condition

In our case and therefore all possible roots must satisfy the condition (let's call it Condition #1). This four will be the "killer" of many "candidates". As a demonstration, I'll look at a few checks:

Let's check the candidate. To do this, we artificially represent it as a fraction , from which it is clearly seen that . Let's calculate the check difference: . Four is divided by "minus two": which means that the possible root has passed the test.

Let's check the value. Here, the test difference is: . Of course, and therefore the second "test subject" also remains on the list.


Horner William George () English mathematician. The main research relates to the theory algebraic equations. Developed a method for the approximate solution of equations of any degree. In 1819, he introduced an important for algebra way of dividing a polynomial into a binomial (x - a) (Horner's scheme).


Derivation of Formulas for Horner's Scheme Dividing a polynomial f(x) into a binomial (x-c) with a remainder means finding a polynomial q(x) and a number r such that f(x)=(x-c)q(x)+r Let's write this equality in detail : f 0 x n + f 1 x n-1 + f 2 x n-2 + …+f n-1 x + f n = =(x-c) (q 0 x n-1 + q 1 x n-2 + q 2 x n-3 +…+ q n-2 x + q n-1)+r Equate the coefficients at the same powers: x n: f 0 = q 0 => q 0 = f 0 x n-1: f 1 = q 1 - c q 0 => q 1 = f 1 + c q 0 x n-2: f 2 = q 2 - c q 1 => q 2 = f 2 + c q 1 … X 0: f n = q n - c q n-1 => q n = f n + c q n-1 q 0 = f 0 x n-1: f 1 = q 1 - c q 0 => q 1 = f 1 + c q 0 x n-2: f 2 = q 2 - c q 1 => q 2 = f 2 + c q 1 … X 0: f n = q n - c q n-1 => q n = f n + c q n-1">


Demonstration of the operation of the Horner scheme Using the Horner scheme, we divide the polynomial f (x) = x 3 - 5x with a remainder by the binomial x-2 Write down the coefficients of the original polynomial f 0, f 1, f 2, f 3. f0f0 f1f1 f2f2 f3f c 2 If we divide on (x-c), then in the second line on the left we write c Prepare empty cells for the remainder r and the coefficients of the incomplete quotient q 0, q 1,q 2 q0q0 q1q1 q2q2 r g 0:=f 0 =1 1 g 1:= c *g 0 + f 1 * + =2 * 1 + (-5)=-3 g 2:= c *g 1 + f 2 =2 * (-3) + 0=-6 * + r:= c *g 2 + f 3 =2 * (-6) + 8= * + -4 Answer: g(x)=x 2 -3x-6 ; r=-4. f(x)= (x-2)(x 2 -3x-6)-4


Expansion of a polynomial in powers of a binomial Using Horner's scheme, we expand the polynomial f(x)=x 3 +3x 2 -2x+4 in powers of a binomial (x+2) f(x)=x 3 +3x 2 -2x+4 =(x +2)(x 2 +x-4) f(x)=x 3 +3x 2 -2x+4= (x+2)((x-1)(x+2)-2) f(x)= x 3 +3x 2 -2x+4= (((1*(x+2)-3)(x+2)-2)(x+2)) f(x) = x 3 +3x 2 -2x+ 4 = (x+2)(x 2 +x-4)+12 = (x+2)((x-1)(x+2)-2)+12 = = (((1*(x+2 )-3)(x+2)-2)(x+2))+12 = (x+2) 3 -3(x+2) 2 -2(x+2)+12


Home work a 1. Divide f(x)=2x 5 -x 4 -3x 3 +x-3 by x-3; 2. Using Horner's scheme, find the integer roots of the polynomial f(x)=x 4 -2x 3 +2x 2 -x-6 3;±6)



Horner's scheme - a way of dividing a polynomial

$$P_n(x)=\sum\limits_(i=0)^(n)a_(i)x^(n-i)=a_(0)x^(n)+a_(1)x^(n-1 )+a_(2)x^(n-2)+\ldots+a_(n-1)x+a_n$$

on the binomial $x-a$. You will have to work with a table, the first row of which contains the coefficients of a given polynomial. The first element of the second line will be the number $a$ taken from the binomial $x-a$:

After dividing the polynomial of the nth degree by the binomial $x-a$, we get a polynomial whose degree is one less than the original one, i.e. equals $n-1$. The direct application of Horner's scheme is easiest to show by examples.

Example #1

Divide $5x^4+5x^3+x^2-11$ by $x-1$ using Horner's scheme.

Let's make a table of two lines: in the first line we write the coefficients of the polynomial $5x^4+5x^3+x^2-11$, arranged in descending order of the powers of the variable $x$. Note that this polynomial does not contain $x$ to the first power, i.e. the coefficient in front of $x$ is equal to 0 to the first power. Since we are dividing by $x-1$, we write the unit in the second line:

Let's start filling in the empty cells in the second row. In the second cell of the second row, we write the number $5$, simply transferring it from the corresponding cell of the first row:

Fill in the next cell as follows: $1\cdot 5+5=10$:

Similarly, fill in the fourth cell of the second line: $1\cdot 10+1=11$:

For the fifth cell, we get: $1\cdot 11+0=11$:

And finally, for the last, sixth cell, we have: $1\cdot 11+(-11)=0$:

The problem is solved, it remains only to write down the answer:

As you can see, the numbers in the second line (between one and zero) are the coefficients of the polynomial obtained after dividing $5x^4+5x^3+x^2-11$ by $x-1$. Naturally, since the degree of the original polynomial $5x^4+5x^3+x^2-11$ was equal to four, the degree of the resulting polynomial $5x^3+10x^2+11x+11$ is one less, i.e. . is equal to three. The last number in the second line (zero) means the remainder after dividing the polynomial $5x^4+5x^3+x^2-11$ by $x-1$. In our case, the remainder is zero, i.e. polynomials are divisible. This result can also be characterized as follows: the value of the polynomial $5x^4+5x^3+x^2-11$ for $x=1$ is equal to zero.

The conclusion can also be formulated in the following form: since the value of the polynomial $5x^4+5x^3+x^2-11$ is equal to zero for $x=1$, then one is the root of the polynomial $5x^4+5x^3+ x^2-11$.

Example #2

Divide the polynomial $x^4+3x^3+4x^2-5x-47$ by $x+3$ according to Horner's scheme.

Let us stipulate right away that the expression $x+3$ must be represented in the form $x-(-3)$. It is $-3$ that will participate in Horner's scheme. Since the degree of the original polynomial $x^4+3x^3+4x^2-5x-47$ is equal to four, then as a result of division we get a polynomial of the third degree:

The result obtained means that

$$x^4+3x^3+4x^2-5x-47=(x+3)(x^3+0\cdot x^2 +4x-17)+4=(x+3)(x^ 3+4x-17)+4$$

In this situation, the remainder after dividing $x^4+3x^3+4x^2-5x-47$ by $x+3$ is $4$. Or, what is the same, the value of the polynomial $x^4+3x^3+4x^2-5x-47$ for $x=-3$ is equal to $4$. By the way, this is easy to double-check by directly substituting $x=-3$ into the given polynomial:

$$x^4+3x^3+4x^2-5x-47=(-3)^4+3 \cdot (-3)^3-5 \cdot (-3)-47=4.$$

Those. Horner's scheme can be used if it is necessary to find the value of a polynomial for a given value of a variable. If our goal is to find all the roots of the polynomial, then Horner's scheme can be applied several times in a row, until we exhaust all the roots, as discussed in example No. 3.

Example #3

Find all integer roots of the polynomial $x^6+2x^5-21x^4-20x^3+71x^2+114x+45$ using Horner's scheme.

The coefficients of the polynomial under consideration are integers, and the coefficient before the highest power of the variable (that is, before $x^6$) is equal to one. In this case, the integer roots of the polynomial must be sought among the divisors of the free term, i.e. among the divisors of 45. For a given polynomial, such roots can be the numbers $45; \; fifteen; \; 9; \; 5; \; 3; \; $1 and $-45; \; -fifteen; \; -9; \; -5; \; -3; \; -1$. Let's check, for example, the number $1$:

As you can see, the value of the polynomial $x^6+2x^5-21x^4-20x^3+71x^2+114x+45$ for $x=1$ is $192$ (the last number in the second line), not $0 $, so one is not a root of this polynomial. Since the check for unity failed, let's check the value of $x=-1$. We will not compile a new table for this, but we will continue to use the table. No. 1, adding a new (third) line to it. The second line, in which the value of $1$ was checked, will be highlighted in red and will not be used in further reasoning.

You can, of course, just rewrite the table again, but when filling in manually, it will take a lot of time. Moreover, there may be several numbers, the verification of which will fail, and it is difficult to write a new table each time. When calculating “on paper”, red lines can simply be crossed out.

So, the value of the polynomial $x^6+2x^5-21x^4-20x^3+71x^2+114x+45$ is zero for $x=-1$, i.e. the number $-1$ is the root of this polynomial. After dividing the polynomial $x^6+2x^5-21x^4-20x^3+71x^2+114x+45$ by the binomial $x-(-1)=x+1$ we get the polynomial $x^5+x ^4-22x^3+2x^2+69x+45$, whose coefficients are taken from the third row of Table. No. 2 (see example No. 1). The result of the calculation can also be presented in the following form:

\begin(equation)x^6+2x^5-21x^4-20x^3+71x^2+114x+45=(x+1)(x^5+x^4-22x^3+2x^2 +69x+45) \end(equation)

Let's continue the search for integer roots. Now we need to look for the roots of the polynomial $x^5+x^4-22x^3+2x^2+69x+45$. Again, the integer roots of this polynomial are sought among the divisors of its free term, the number $45$. Let's try to check the number $-1$ again. We will not compile a new table, but will continue to use the previous table. No. 2, i.e. Let's add one more line to it:

So, the number $-1$ is the root of the polynomial $x^5+x^4-22x^3+2x^2+69x+45$. This result can be written like this:

\begin(equation)x^5+x^4-22x^3+2x^2+69x+45=(x+1)(x^4-22x^2+24x+45) \end(equation)

Taking into account equality (2), equality (1) can be rewritten in the following form:

\begin(equation)\begin(aligned) & x^6+2x^5-21x^4-20x^3+71x^2+114x+45=(x+1)(x^5+x^4-22x ^2+2x^2+69x+45)=\\ & =(x+1)(x+1)(x^4-22x^2+24x+45)=(x+1)^2(x^ 4-22x^2+24x+45)\end(aligned)\end(equation)

Now we need to look for the roots of the polynomial $x^4-22x^2+24x+45$, naturally, among the divisors of its free term (number $45$). Let's check the number $-1$ again:

The number $-1$ is the root of the polynomial $x^4-22x^2+24x+45$. This result can be written like this:

\begin(equation)x^4-22x^2+24x+45=(x+1)(x^3-x^2-21x+45) \end(equation)

Taking into account equality (4), we rewrite equality (3) in the following form:

\begin(equation)\begin(aligned) & x^6+2x^5-21x^4-20x^3+71x^2+114x+45=(x+1)^2(x^4-22x^3 +24x+45)= \\ & =(x+1)^2(x+1)(x^3-x^2-21x+45)=(x+1)^3(x^3-x^ 2-21x+45)\end(aligned)\end(equation)

Now we are looking for the roots of the polynomial $x^3-x^2-21x+45$. Let's check the number $-1$ again:

The check ended in failure. Let's highlight the sixth line in red and try to check another number, for example, the number $3$:

The remainder is zero, so the number $3$ is the root of the polynomial under consideration. So $x^3-x^2-21x+45=(x-3)(x^2+2x-15)$. Now equality (5) can be rewritten as follows.

1.1 General description of the algorithm

1.1.1 Problem to be solved

The first estimate is based on the daps characteristic, which measures the number of memory accesses (reads and writes) made per second. This characteristic is analogous to the flops estimate in relation to working with memory and is more of an estimate of the performance of interaction with memory than a locality estimate. However, it serves as a good source of information, including for comparison with the results for the following cvg feature.

Figure 4 shows the daps values ​​for implementations of common algorithms, sorted in ascending order (the more daps, the higher the performance in general). According to this figure, the implementation of Horner's scheme shows poor memory performance. It may seem strange that the value of daps in this case is significantly less than for the STREAM tests, despite the fact that the access profile is very similar in all cases - several simultaneous sequential enumerations of arrays.

The reason for this behavior is related to the structural features of the memory subsystem. In the implementation of the Horner scheme, as noted above, the elements of one of the arrays are accessed twice in a row. However, if you look at the source code of the implementation, you can see that in fact the second call is made on the next iteration - this is a call to the previous element:

for (int i = 1 ; i< size ; i ++ ) { c [ i ] = a [ i ] + c [ i - 1 ] * x ; }

As a result, due to iteration dependency, the hardware prefetcher is much worse at pulling up the required cache lines, which leads to a noticeable slowdown in program execution compared to other implementations based on sequential search (for example, STREAM tests).

Similar example once again shows how complex the memory subsystem is tripled - a very small change in the structure of the loop body leads to a rather unexpected serious slowdown of the program.

Figure 4. Comparison of daps score values

The second characteristic, cvg, is intended to provide a more machine-independent locality estimate. It determines how often the program needs to pull data into the cache. Accordingly, the smaller the cvg value, the less often it needs to be done, the better the locality.

Figure 5 shows the cvg values ​​for the same set of implementations, sorted in descending order (the smaller the cvg, the higher the locality in general). It can be seen that the implementation of Horner's scheme has a very high locality according to cvg.

Figure 5. Comparison of cvg score values

As we saw earlier, this does not correlate well with actual memory performance due to the nature of memory design. However, two remarks must be made here. Firstly, such cases, when the performance of working with memory depends so much on the specific hardware features of the structure of the memory subsystem, are not so common in practice. Second, cvg is intended to provide a machine-independent locality estimate; at this level, it is hardly possible to take into account such hardware features, at least without losing the share of machine-independent properties.

2.3 Possible methods and features of the parallel implementation of the algorithm

The described algorithm does not imply parallel implementation.

2.4 Scalability of the algorithm and its implementation

The concept of scalability is inapplicable, since the described algorithm does not imply parallel implementation. Let us study the scalability in breadth of the implementation of the algorithm according to the methodology. The study was conducted on the Lomonosov supercomputer of the Supercomputer Complex of Moscow University. The set and bounds of the values ​​of the variable parameters for launching the algorithm implementation:

  • number of processors 1;
  • area size in increments of 10240.

As a result of the experiments, the following range of algorithm implementation efficiency was obtained:

  • minimum implementation efficiency 0.0324%;
  • the maximum implementation efficiency is 0.0331%.

The following figures show graphs of the performance and efficiency of the selected implementation of the algorithm depending on the changeable launch parameters.

Figure 6. Implementation of the algorithm. Change in performance depending on the size of the vector.

Figure 7. Implementation of the algorithm. Change in efficiency depending on the size of the vector.

The meager efficiency seems to be due to the excessive locality described in the section on .

2.5 Dynamic performance and algorithm implementation efficiency

Due to the sequence of the algorithm and its excessive locality, the study of its dynamic characteristics is of little value.

For the experiments, an implementation of the Horner scheme algorithm was used, in the implementation available. All results were obtained on the GrafIT! supercomputer. used Intel processors Xeon X5570 with 94 Gflops peak performance and Gnu 4.4.7 compiler. The figures show the efficiency of the implementation of the counter-sweep algorithm.








Back forward

Attention! The slide preview is for informational purposes only and may not represent the full extent of the presentation. If you are interested this work please download the full version.

Lesson type: A lesson in the assimilation and consolidation of primary knowledge.

The purpose of the lesson:

  • To acquaint students with the concept of the roots of a polynomial, to teach how to find them. Improve skills in applying Horner's scheme for expanding a polynomial in powers and dividing a polynomial by a binomial.
  • Learn how to find the roots of an equation using Horner's scheme.
  • Develop abstract thinking.
  • Cultivate a computing culture.
  • Development of interdisciplinary connections.

During the classes

1. Organizational moment.

Inform the topic of the lesson, formulate goals.

2. Checking homework.

3. Learning new material.

Let F n (x) = a n x n +a n-1 x n-1 +...+ a 1 x +a 0 - a polynomial with respect to x of degree n, where a 0 , a 1 ,...,a n are given numbers, and a 0 is not equal to 0. If the polynomial F n (x) is divided with a remainder by the binomial x-a, then the quotient (incomplete quotient) is polynomial Q n-1 (x) of degree n-1, the remainder R is a number, and the equality F n (x)=(x-a) Q n-1 (x) +R. The polynomial F n (x) is completely divisible by the binomial (x-a) only in the case of R=0.

Bezout's theorem: The remainder R from dividing the polynomial F n (x) by the binomial (x-a) is equal to the value of the polynomial F n (x) at x=a, i.e. R= P n (a).

A bit of history. Bezout's theorem, despite its external simplicity and obviousness, is one of the fundamental theorems of the theory of polynomials. In this theorem, the algebraic properties of polynomials (which allow one to work with polynomials as integers) are associated with their functional properties (which allow one to consider polynomials as functions). One of the ways to solve equations of higher degrees is the method of factoring the polynomial on the left side of the equation. The calculation of the coefficients of the polynomial and the remainder is written in the form of a table, which is called Horner's scheme.

Horner's scheme is a polynomial division algorithm written for the special case when the quotient is equal to the binomial x-a.

Horner William George (1786 - 1837), English mathematician. The main research concerns the theory of algebraic equations. Developed a method for the approximate solution of equations of any degree. In 1819, he introduced an important for algebra way of dividing a polynomial by a binomial x - a (Horner's scheme).

Conclusion general formula for Horner's scheme.

Dividing a polynomial f(x) with a remainder by a binomial (x-c) means finding a polynomial q(x) and a number r such that f(x)=(x-c)q(x)+r

Let's write this equation in detail:

f 0 x n + f 1 x n-1 + f 2 x n-2 + ...+f n-1 x + f n =(x-c) (q 0 x n-1 + q 1 x n-2 + q 2 x n-3 +...+ q n-2 x + q n-1)+r

Equate the coefficients at the same powers:

xn: f 0 = q 0 => q 0 = f 0
xn-1: f 1 \u003d q 1 - c q 0 => q 1 = f 1 + c q 0
xn-2: f 2 \u003d q 2 - c q 1 => q 2 = f 2 + c q 1
... ...
x0: f n = q n - c q n-1 => q n \u003d f n + c q n-1.

Demonstration of Horner's scheme by example.

Exercise 1. Using the Horner scheme, we divide the polynomial f (x) \u003d x 3 - 5x 2 + 8 with the remainder into the binomial x-2.

1 -5 0 8
2 1 2*1+(-5)=-3 2*(-3)+0=-6 2*(-6)+8=-4

f(x) \u003d x 3 - 5x 2 + 8 \u003d (x-2) (x 2 -3x-6) -4, where g (x) \u003d (x 2 -3x-6), r \u003d -4 remainder.

Expansion of a polynomial in powers of a binomial.

Using Horner's scheme, we expand the polynomial f(x)=x 3 +3x 2 -2x+4 in powers of the binomial (x+2).

As a result, we should get a decomposition f (x) = x 3 +3x 2 -2x+4 = (x+2)(x 2 +x-4)+12 = (x+2)((x-1)(x+ 2)-2)+12 = (((1*(x+2)-3)(x+2)-2)(x+2))+12 = (x+2) 3 -3(x+2 ) 2 -2(x+2)+12

Horner's scheme is often used when solving equations of the third, fourth and higher degrees, when it is convenient to expand the polynomial into a binomial x-a. Number a called polynomial root F n (x) = f 0 x n + f 1 x n-1 + f 2 x n-2 + ...+f n-1 x + f n if x=a the value of the polynomial F n (x) is equal to zero: F n (a)=0, i.e. if the polynomial is evenly divisible by the binomial x-a.

For example, the number 2 is the root of the polynomial F 3 (x)=3x 3 -2x-20, since F 3 (2)=0. it means. That the factorization of this polynomial contains the factor x-2.

F 3 (x)=3x 3 -2x-20=(x-2)(3x 2 +6x+10).

Any polynomial F n (x) of degree n 1 can have no more n real roots.

Any integer root of an equation with integer coefficients is a divisor of its free term.

If the leading coefficient of the equation is 1, then all rational roots of the equation, if they exist, are integer.

Consolidation of the studied material.

To consolidate the new material, students are invited to complete the numbers from the textbook 2.41 and 2.42 (p. 65).

(2 students decide at the blackboard, and the rest, having decided, check the tasks in the notebook with the answers on the blackboard).

Summarizing.

Having understood the structure and principle of operation of the Horner scheme, it can also be used in computer science lessons, when the issue of translating integers from decimal to binary and vice versa is considered. The translation from one number system to another is based on the following general theorem

Theorem. To translate an integer Ap from p-ary number system to base number system d necessary Ap sequentially divide with a remainder by a number d written in the same p-ary system, until the resulting quotient becomes zero. The remainder of the division will then be d-digital digits Ad starting from low order to high order. All actions must be carried out in p-ary number system. For a person this rule convenient only when p= 10, i.e. when translating from decimal system. As for the computer, on the contrary, it is “more convenient” for it to perform calculations in the binary system. Therefore, to translate “2 to 10”, sequential division by ten in the binary system is used, and “10 to 2” is the addition of powers of ten. To optimize the calculations of the "10 in 2" procedure, the computer uses Horner's economical computational scheme.

Homework. There are two tasks to complete.

1st. Using Horner's scheme, divide the polynomial f(x)=2x 5 -x 4 -3x 3 +x-3 into the binomial (x-3).

2nd. Find the integer roots of the polynomial f (x) \u003d x 4 -2x 3 + 2x 2 -x-6. (Given that any integer root of an equation with integer coefficients is a divisor of its free term)

Literature.

  1. Kurosh A.G. "Course of Higher Algebra".
  2. Nikolsky S.M., Potapov M.K. etc. Grade 10 “Algebra and the beginnings of mathematical analysis”.
  3. http://inf.1september.ru/article.php?ID=200600907.

We recommend reading

Top