CSC212 Numerical Method

Numerical MethodUnit 112 min read

Numerical Methods: Errors, Approximations & Foundations

Unit 1 of Numerical Method introduces core concepts of numerical analysis, including error types (truncation, rounding, absolute/relative), propagation analysis, and foundational methods like Taylor series approximations—essential for understanding all subsequent computational techniques in the syllabus.

1. Introduction to Numerical Methods

1.1 Why Numerical Methods?

  • Analytical vs. Numerical Solutions:
    • Many mathematical problems (e.g., differential equations, nonlinear systems) lack closed-form analytical solutions.
    • Numerical methods provide approximate solutions using algorithms and computational techniques.
  • Applications:
    • Engineering (stress analysis, fluid dynamics).
    • Physics (quantum mechanics, astrophysics).
    • Economics (optimization, forecasting).
    • Biology (population modeling, pharmacokinetics).

1.2 Classification of Numerical Methods

Category Examples Key Idea
Root-finding Bisection, Newton-Raphson, Secant Find such that .
Interpolation Lagrange, Newton, Splines Estimate between known data points.
Differentiation Finite differences, Taylor series Approximate derivatives numerically.
Integration Trapezoidal, Simpson’s, Gaussian Compute definite integrals numerically.
ODE/PDE Solvers Euler, Runge-Kutta, Finite Element Solve differential equations step-by-step.
Optimization Gradient descent, Newton’s method Minimize/maximize functions.

2. Error Analysis in Numerical Methods

Errors are inevitable in numerical computations. Understanding them helps in assessing accuracy and designing algorithms.

2.1 Sources of Errors

A. Truncation Error (Discretization Error)

  • Definition: Error due to approximating an infinite process (e.g., series, derivatives) with a finite one.
  • Examples:
    • Replacing a derivative with a finite difference: .
    • Using a Taylor series with a finite number of terms.
  • Reduction Techniques:
    • Use smaller step sizes ().
    • Higher-order methods (e.g., 4th-order Runge-Kutta vs. Euler’s 1st-order).

B. Rounding Error (Machine Error)

  • Definition: Error due to finite precision in computer arithmetic (e.g., floating-point representation).
  • Examples:
    • in binary floating-point.
    • Storing as 3.141592653589793 (truncated).
  • Mitigation:
    • Use higher precision (double vs. single precision).
    • Error propagation analysis (see Section 2.3).

C. Input Data Error

  • Definition: Error from imperfect or noisy input data (e.g., measurements, experimental data).
  • Example: Measuring a length as 5.0 cm when the true value is 4.98 cm.

2.2 Types of Error Measures

Term Definition Formula When to Use
Absolute Error Difference between true and approximate value. Exact comparison available.
Relative Error Absolute error normalized by true value. Comparing errors across scales.
Approximate Absolute Error Error estimate when true value is unknown (using previous iteration). Iterative methods (e.g., Newton-Raphson).
Approximate Relative Error Relative error estimate without true value. Iterative methods.

Example:

  • True value of .
  • Approximate value: .
  • Absolute Error: .
  • Relative Error: (0.0151%).

2.3 Error Propagation

When errors accumulate through computations, they grow unpredictably. The absolute error in a function due to error in is approximated by: Example: Compute if and .

  • , .
  • .

Key Insight:

  • Errors amplify in nonlinear functions (e.g., vs. ).
  • Stable algorithms minimize error growth (e.g., LU decomposition vs. naive Gaussian elimination).

3. Taylor Series and Approximations

Taylor series provides a foundation for numerical approximations by expanding functions into polynomials.

3.1 Taylor Series Expansion

For a function infinitely differentiable at : Truncation Error:

3.2 Applications in Numerical Methods

A. Approximating Functions

Example: Approximate near using 3rd-order Taylor series. For : (True value: , Error: ).

B. Numerical Differentiation

Replace derivatives with finite differences using Taylor expansions:

C. Euler’s Method (ODE Solver)

For , the Taylor expansion gives: Example: Solve , at with .

Step x y f(x,y) = 2x + y y(x+h) ≈ y(x) + h·f(x,y)
0 0.0 1.0 2(0) + 1 = 1 -
1 0.1 1 + 0.1·1 = 1.1 2(0.1) + 1.1 = 1.3 -
2 0.2 1.1 + 0.1·1.3 = 1.23 2(0.2) + 1.23 = 1.63 -
3 0.3 1.23 + 0.1·1.63 = 1.393 2(0.3) + 1.393 = 1.993 -
4 0.4 1.393 + 0.1·1.993 ≈ 1.5923 - -

Note: Euler’s method has local truncation error and global error .


4. Root-Finding Methods (Preview)

While root-finding is covered in later units, this section introduces error-based stopping criteria critical for all iterative methods.

4.1 Bisection Method (Half-Interval Method)

Algorithm:

  1. Choose such that (Intermediate Value Theorem).
  2. Compute .
  3. If , stop. Else:
    • If , set .
    • Else, set .
  4. Repeat.

Error Analysis:

  • Absolute Error: .
  • Convergence: Linear with rate .

Example: Find root of to 3 significant figures.

  • Initial guess: , (since , ).
  • Iterations:
    1. , → .
    2. , → .
    3. , → .
    4. , → .
    5. , → Stop.
  • Root ≈ 1.66 (3 significant figures).

4.2 Newton-Raphson Method

Formula: Convergence: Quadratic () if initial guess is close.

Example: Solve with tolerance .

  • , .
  • Initial guess: .
    Iteration x_n f(x_n) f'(x_n) x_{n+1} = x_n - f/f'
    0 1.0 -4 6 1.0 - (-4)/6 ≈ 1.6667
    1 1.6667 0.1111 7.3334 1.6667 - 0.1111/7.3334 ≈ 1.6515
    2 1.6515 0.0003 7.3030 1.6515 - 0.0003/7.3030 ≈ 1.6515

Stopping: → Root ≈ 1.6515.

Drawbacks:

  • Requires (may be complex).
  • Divergence if or poor initial guess.
  • Oscillations near multiple roots.

5. Horner’s Method for Polynomial Evaluation

Efficiently evaluates polynomials by reducing multiplications:

Example: Evaluate at . Using Horner’s form: Steps:

Algorithm:

def horner(poly, x):
    result = 0
    for coeff in reversed(poly):
        result = result * x + coeff
    return result

Advantages:

  • Fewer operations ( multiplications vs. for naive method).
  • Numerically stable (reduces rounding errors).

Exam Tip: How to Score Full Marks in Unit 1

1. Key Topics to Master

Topic Weightage Focus Areas
Error Analysis 25% Absolute/relative errors, truncation vs. rounding, propagation.
Taylor Series 20% Expansion, truncation error, applications (differentiation, Euler’s method).
Root-Finding (Preview) 20% Bisection (error bounds), Newton-Raphson (convergence, drawbacks).
Horner’s Method 15% Algorithm, efficiency, polynomial evaluation.
Numerical Stability 10% Error growth, condition number, algorithm choice.
Euler’s Method 10% Derivation, step-by-step computation, error analysis.

2. Common Pitfalls to Avoid

  • Ignoring error bounds: Always state whether you’re using absolute/relative error and how it’s calculated.
  • Incorrect Taylor expansions: Remember the factorial denominators and signs.
  • Stopping criteria: For iterative methods, show both the error check (e.g., ) and the function value ().
  • Horner’s method misuse: Ensure coefficients are ordered from highest to lowest degree.

3. Model Answer Structure

For theoretical questions (e.g., "Define absolute error and discuss bisection method"):

  1. Definition (1 mark).
  2. Key properties (e.g., bisection’s linear convergence, error bound formula) (2 marks).
  3. Algorithm steps (with pseudocode if possible) (3 marks).
  4. Example trace (show 2-3 iterations) (3 marks).
  5. Advantages/disadvantages (1 mark).

For computational questions (e.g., "Solve using Newton-Raphson"):

  1. Write the formula and state and (1 mark).
  2. Show iteration table with all columns (3 marks).
  3. State stopping criterion and final answer (1 mark).
  4. Discuss convergence (e.g., "Method converged quadratically") (1 mark).

4. High-Scoring Techniques

  • Derivations: Always show how you arrived at a formula (e.g., Taylor expansion steps).
  • Error analysis: For iterative methods, compute both absolute and relative errors at the final step.
  • Comparisons: If asked about multiple methods (e.g., bisection vs. Newton-Raphson), use a table to highlight speed, convergence, and requirements.
  • Units and precision: State whether answers are correct to 3 decimal places, 3 significant figures, etc.

5. Past Exam Patterns

  • 2022 TU Exam: Derive Newton-Raphson + solve (10 marks).
    • Key: Show and iteration table with error checks.
  • 2021 PU Exam: Compare bisection and Newton-Raphson for .
    • Key: Use a table with iterations, errors, and convergence rates.
  • 2020 NEB Exam: Evaluate polynomial using Horner’s method + discuss its advantage.
    • Key: Show step-by-step computation and mention "reduces multiplications from to ".

Summary Checklist

Before submitting, verify: ✅ All error types (absolute/relative/truncation/rounding) are clearly defined. ✅ Taylor series expansions include all terms and truncation error. ✅ Iterative methods show full iteration tables with error checks. ✅ Horner’s method is applied correctly (order of coefficients). ✅ Exam tips are tailored to past question patterns.

Based on the TU BSc CSIT syllabus for Numerical Method (CSC212), unit 1.

Discussion

Loading…