2077 4

CSC212 · 2077 · 5 marks

Define the terms true error and relative error? Use Horner' method to evaluate polynomial at x = 3 and write down its algorithm. 2x3 - 3x2 + 5x - 2

Define the terms true error and relative error? Use Horner' method to evaluate polynomial at x = 3 and write down its algorithm. $2x^3 - 3x^2 + 5x - 2$ [5]

Numerical MethodChapter 1: Solution of Nonlinear EquationsHorner's methodNumerical: Horner's method evaluation

True Error and Relative Error + Horner's Method

Given Data

  • Polynomial: $P(x) = 2x^3 - 3x^2 + 5x - 2$
  • Evaluation point: $x = 3$
  • Coefficients: $a_3 = 2,\ a_2 = -3,\ a_1 = 5,\ a_0 = -2$

Part 1: Definitions

True Error

True error is the difference between the exact (true) value of a quantity and its approximate (computed) value.

$$E_t = \text{True Value} - \text{Approximate Value}$$

It measures the actual (absolute) magnitude of the discrepancy in a numerical computation.

Relative Error

Relative error is the ratio of the true error to the true value, giving the error relative to the size of the exact quantity.

$$E_r = \frac{E_t}{\text{True Value}} = \frac{\text{True Value} - \text{Approximate Value}}{\text{True Value}}$$

Often expressed as a percentage:

$$E_r% = \left|\frac{\text{True Value} - \text{Approximate Value}}{\text{True Value}}\right| \times 100%$$


Part 2: Horner's Method

Concept

Horner's method reduces the number of multiplications by nesting coefficients:

$$P(x) = a_nx^n + \cdots + a_1x + a_0 = \big(\cdots((a_n x + a_{n-1})x + a_{n-2})\cdots\big)x + a_0$$

For our polynomial:

$$P(x) = ((2x - 3)x + 5)x - 2$$

Step-by-Step Evaluation at $x = 3$

StepOperationResult
Start$b_3 = a_3$$2$
1$b_2 = b_3 \cdot 3 + a_2 = 2(3) - 3$$3$
2$b_1 = b_2 \cdot 3 + a_1 = 3(3) + 5$$14$
3$b_0 = b_1 \cdot 3 + a_0 = 14(3) - 2$$40$

$$\boxed{P(3) = 40}$$

Verification (Direct Substitution)

$$P(3) = 2(27) - 3(9) + 5(3) - 2 = 54 - 27 + 15 - 2 = 40 \checkmark$$


Algorithm for Horner's Method

Algorithm: Horner's Method for Polynomial Evaluation

Input  : Degree n, coefficients a[n], a[n-1], ..., a[0], value x
Output : P(x)

Step 1: Start
Step 2: Read n, coefficients a[n] down to a[0], and value x
Step 3: Set result = a[n]              // leading coefficient
Step 4: For i = n-1 down to 0 do
            result = result * x + a[i]
        End For
Step 5: Print result as P(x)
Step 6: Stop

Therefore, $P(3) = 40$.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.