- 论坛徽章:
- 0
|
Exercise 2.34.
Exercise 2.34. Evaluating a polynomial in x at a given value of x can be formulated as an accumulation. We evaluate the polynomial
using a well-known algorithm called Horner's rule, which structures the computation as
In other words, we start with a_n, multiply by x, add a_{n-1}, multiply by x, and so on, until we reach a0. Fill in the following template to produce a procedure that evaluates a polynomial using Horner's rule. Assume that the coefficients of the polynomial are arranged in a sequence, from a0 through an.
[ 本帖最后由 win_hate 于 2008-9-30 12:04 编辑 ] |
|