BIT203 · 0 · 5 marks
Define the terms true error and relative error? Write down algorithm for Horner' method to evaluate polynomial and use the method to evaluate the polynomial 2x3 - 3x2 + 5x - 2 at x=3.
Define the terms true error and relative error? Write down algorithm for Horner' method to evaluate polynomial and use the method to evaluate the polynomial $2x^3 - 3x^2 + 5x - 2$ at x=3. [5]
True Error, Relative Error, and Horner's Method
Given
- Polynomial: $P(x) = 2x^3 - 3x^2 + 5x - 2$
- Coefficients (high to low degree): $a_3 = 2,\ a_2 = -3,\ a_1 = 5,\ a_0 = -2$
- Evaluation point: $x = 3$
Solution
1. True Error
The true error is the difference between the exact (true) value and the approximate (computed) value.
$$E_t = X_{\text{true}} - X_{\text{approx}}$$
It expresses the actual magnitude of the deviation but does not indicate how significant that deviation is relative to the quantity being measured.
2. Relative Error
The relative error is the true error divided by the true value (often given as a percentage).
$$\epsilon_t = \frac{X_{\text{true}} - X_{\text{approx}}}{X_{\text{true}}} = \frac{E_t}{X_{\text{true}}}$$
$$\epsilon_t(%) = \frac{E_t}{X_{\text{true}}} \times 100%$$
It provides a normalized (scale-independent) measure of accuracy.
3. Horner's Method
Horner's method (nested multiplication / synthetic division) rewrites
$$P(x) = a_n x^n + a_{n-1}x^{n-1} + \cdots + a_1 x + a_0$$
as
$$P(x) = (\cdots((a_n x + a_{n-1})x + a_{n-2})x + \cdots)x + a_0$$
reducing the count to $n$ multiplications and $n$ additions.
Algorithm:
Algorithm Horner(a[0..n], n, x):
Step 1: result = a[n]
Step 2: for i = n-1 down to 0:
result = result * x + a[i]
Step 3: return result
4. Evaluation of $P(x) = 2x^3 - 3x^2 + 5x - 2$ at $x = 3$
| Degree | 3 | 2 | 1 | 0 |
|---|---|---|---|---|
| Coeff | 2 | -3 | 5 | -2 |
Step 1: $b_3 = 2$
Step 2: $b_2 = 2 \times 3 + (-3) = 6 - 3 = 3$
Step 3: $b_1 = 3 \times 3 + 5 = 9 + 5 = 14$
Step 4: $b_0 = 14 \times 3 + (-2) = 42 - 2 = 40$
$$\boxed{P(3) = 40}$$
Verification (direct): $$P(3) = 2(27) - 3(9) + 5(3) - 2 = 54 - 27 + 15 - 2 = 40 \checkmark$$
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.