Exercise · Volume 1 · 2.2.4-10
Exercise 2.2.4-10
not stated yet in Lean solution written
| Rating | 20 |
|---|---|
| Kind | K3, find a value: compute a number, a set or a closed form from the written solution |
| Section | Section 2.2.4 of Volume 1 |
The task
Suppose the polynomials have only one variable , with exponents up to . Say what has to be changed in Algorithms A and M.
The exact wording is in your copy of the book.
Hints
Open one hint at a time. Try the exercise again after each.
Hint 1
Look at where the algorithms treat , , separately.
Solution
Show the solution
Nothing needs to change. In Algorithm A the three exponents are compared as a single number , and in the same way they are added in Algorithm M, where the exponent fields of and are added as numbers of three bytes. If the field holds the exponent of in base , the compare, the order of the terms, and the sum of exponents are the same operations. The only place where the old program looks at , , individually is the check for overflow of one exponent in step M2, and the text does not carry out this check.
One can say it differently. The algorithms handle polynomials in , and , and so any polynomial in with exponents below is covered, since with .
Check
Take and the exponents and . In base they are and . The three-byte numbers add as , which is , a correct field, and the carry between the bytes is done by the ordinary addition of the machine. The test in Algorithm A compares the three-byte numbers and in the right order.
Remarks
The multiplication of two polynomials in one variable is then the same program, and the only limit is that the sum of two exponents must stay below .
This solution is drafted, and a person has not reviewed it yet. The source.
In Lean
not stated yet The exercise is not stated in Lean yet.
The status is computed from the Lean build. The node of the map.
Something is wrong? Report it.