2079

BIT203 · TU past paper

Numerical Methods 2079 question paper

The complete TU 2079 exam paper for Numerical Methods (BIT203), all 12 questions with solved model answers written to the mark scheme.

Past Papers2082208020792078

Tap a question to open its answer.

  1. 110 marksNumericalBisection method derivation and applicatioAnswer

    Question

    Define true error and relative error. Derive the bisection method for solving non-linear equation and using this method solve $2x^3 - 2x - 5$ with initial $x_0 = 1$ and $x_1 = 2$. Calculate upto 10th iteration.[10]

    True Error is the difference between the exact (true) value and the approximate value: $$Et = \text{True Value} - \text{Approximate Value}$$ Relative Error is the true error normalized by the true value (often as a percentage): $$\epsilo...

  2. 210 marksNumericalLagrange interpolation formula and algoritAnswer

    Question

    What are the applications of interpolation? Differentiate between interpolation and regression. Consider the following data points estimate the $f(10)$ using Lagrange's interpolation.

    $$\begin{array}{|c|c|c|c|c|}\hline x & 5 & 6 & 9 & 11 \ \hline y & 13 & 14 & 15 & 16 \ \hline \end{array}$$

    [10]

    • Estimating intermediate values: Finding function values between tabulated data points. - Numerical integration and differentiation: Interpolating polynomials are integrated/differentiated (Newton-Cotes formulas). - Computer graphics an...
  3. 310 marksAlgorithm and program for numerical integrAnswer

    What do you mean by numerical integration? Write any one application of numerical integration. Write an algorithm and c program to implement multi-segment trapezoidal rule.[10]

    Numerical Integration: Multi-Segment Trapezoidal Rule


    1. What is Numerical Integration? (2 marks)

    Numerical Integration (also called numerical quadrature) is the process of computing the approximate value of a definite integral using numerical methods when:

    • The integrand f(x) is too complex to integrate analytically, or
    • The function is given only as a set of discrete data points (tabular data), or
    • The antiderivative does not exist in closed form.

    The general goal is to approximate:

    $$I = \int_a^b f(x), dx$$

    by replacing the integrand with a simpler approximating function (such as polynomials) and summing the areas of geometric shapes under the curve.


    2. Application of Numerical Integration (1 mark)

    Engineering Application: Computing the area under a velocity-time curve to find displacement, or calculating the work done by a variable force:

    $$W = \int_{x_1}^{x_2} F(x), dx$$

    where F(x) may be given only as experimental data points, making analytical integration impossible.


    3. Multi-Segment Trapezoidal Rule (7 marks)

    Concept

    The interval [a, b] is divided into n equal sub-intervals (segments), each of width:

    $$h = \frac{b - a}{n}$$

    The nodes are: $x_0 = a,; x_1 = a+h,; x_2 = a+2h,; \ldots,; x_n = b$

    Each sub-interval is approximated by a trapezoid. The formula is:

    $$\boxed{I \approx \frac{h}{2}\left[f(x_0) + 2f(x_1) + 2f(x_2) + \cdots + 2f(x_{n-1}) + f(x_n)\right]}$$

    Or equivalently:

    $$I \approx \frac{h}{2}\left[f(x_0) + f(x_n) + 2\sum_{i=1}^{n-1} f(x_i)\right]$$


    Algorithm

    Algorithm: Multi-Segment Trapezoidal Rule
    Input : a (lower limit), b (upper limit), n (number of segments)
    Output: Approximate value of integral I
    
    Step 1: START
    Step 2: Read a, b, n
    Step 3: Compute h = (b - a) / n
    Step 4: Set sum = f(a) + f(b)          [first and last terms]
    Step 5: Set i = 1
    Step 6: WHILE i <= n-1 DO
                x = a + i * h
                sum = sum + 2 * f(x)       [middle terms multiplied by 2]
                i = i + 1
            END WHILE
    Step 7: I = (h / 2) * sum
    Step 8: Print I
    Step 9: STOP
    

    C Program

    #include <stdio.h>
    #include <math.h>
    
    /* Define the function to be integrated */
    /* Example: f(x) = x^2, change as needed */
    double f(double x) {
        return x * x;   /* Replace with desired function */
    }
    
    int main() {
        double a, b, h, sum, x, result;
        int n, i;
    
        /* Input */
        printf("Enter lower limit (a): ");
        scanf("%lf", &a);
    
        printf("Enter upper limit (b): ");
        scanf("%lf", &b);
    
        printf("Enter number of segments (n): ");
        scanf("%d", &n);
    
        /* Step size */
        h = (b - a) / n;
    
        /* Apply Multi-Segment Trapezoidal Rule */
        /* First and last terms */
        sum = f(a) + f(b);
    
        /* Middle terms */
        for (i = 1; i <= n - 1; i++) {
            x = a + i * h;
            sum = sum + 2 * f(x);
        }
    
        /* Final result */
        result = (h / 2) * sum;
    
        printf("\nApproximate value of integral = %.6lf\n", result);
    
        return 0;
    }
    

    Sample Output

    For $\int_0^1 x^2, dx$ with n = 4:

    ix_if(x_i) = x_i^2
    00.000.0000
    10.250.0625
    20.500.2500
    30.750.5625
    41.001.0000

    $$h = \frac{1-0}{4} = 0.25$$

    $$I \approx \frac{0.25}{2}\left[0 + 1 + 2(0.0625 + 0.25 + 0.5625)\right]$$

    $$I \approx 0.125 \times [1 + 2(0.875)] = 0.125 \times 2.75 = \mathbf{0.34375}$$

    Exact value = 1/3 = 0.33333... (small error due to finite segments; error decreases as n increases)


    Key Points

    FeatureDetail
    Method typeNewton-Cotes closed formula
    Order of accuracyO(h^2) per segment
    Error decreasesAs n increases (h decreases)
    Easy to implementYes, simple loop structure
  4. 45 marksNumericalDerivative estimation using interpolation Answer

    Divided Difference Table and Derivatives

    Construct the divided difference table for the following data and find first and second order derivatives at $x=2$.

    $$\begin{array}{|c|c|c|c|c|c|}\hline x & 1 & 2 & 4 & 8 & 10 \ \hline y & 0 & 1 & 5 & 21 & 27 \ \hline \end{array}$$

    [5]

    $x$ 1 2 4 8 10 ------------------ $y$ 0 1 5 21 27 $$f[x0,x1]=\frac{1-0}{2-1}=1$$ $$f[x1,x2]=\frac{5-1}{4-2}=2$$ $$f[x2,x3]=\frac{21-5}{8-4}=4$$ $$f[x3,x4]=\frac{27-21}{10-8}=3$$ $$f[x0,x1,x2]=\frac{2-1}{4-1}=\frac{1}{3}$$ $$f[x1,x2,x3]=...

  5. 55 marksNumericalLeast squares method for function fittingAnswer

    What is least squares method of fitting a function? Fit the second order polynomial for the following data values.

    x1234567
    y2678101215

    [5]

    Least Squares Method and Second Order Polynomial Fitting

    Definition

    The least squares method finds the best-fit curve for a set of data points by minimizing the sum of squares of residuals (differences between observed values $y_i$ and fitted values $f(x_i)$):

    $$S = \sum_{i=1}^{n} [y_i - f(x_i)]^2 \to \text{minimum}$$

    Given Data

    $$x: 1, 2, 3, 4, 5, 6, 7$$ $$y: 2, 6, 7, 8, 10, 12, 15$$ $$n = 7$$

    Model and Normal Equations

    Fit $y = a_0 + a_1 x + a_2 x^2$. The normal equations are:

    $$\sum y = na_0 + a_1\sum x + a_2\sum x^2$$ $$\sum xy = a_0\sum x + a_1\sum x^2 + a_2\sum x^3$$ $$\sum x^2y = a_0\sum x^2 + a_1\sum x^3 + a_2\sum x^4$$

    Calculation Table

    $x$$y$$x^2$$x^3$$x^4$$xy$$x^2y$
    1211122
    2648161224
    37927812163
    48166425632128
    5102512562550250
    61236216129672432
    715493432401105735
    $\Sigma$6014078446762941634

    Also $\sum x = 28$.

    Substituting

    $$60 = 7a_0 + 28a_1 + 140a_2 \quad (1)$$ $$294 = 28a_0 + 140a_1 + 784a_2 \quad (2)$$ $$1634 = 140a_0 + 784a_1 + 4676a_2 \quad (3)$$

    Note: The coefficient of $a_0$ in equation (1) must be $\sum x = 28$, while in equation (3) the $a_0$ coefficient is $\sum x^2 = 140$; mixing the two is an easy slip to make.

    Solving

    Eliminate $a_0$. Multiply (1) by 4 and subtract from (2):

    $(2) - 4\times(1)$: $$294 - 240 = (28-28)a_0 + (140-112)a_1 + (784-560)a_2$$ $$54 = 28a_1 + 224a_2 \quad (4)$$

    Multiply (1) by 20 and subtract from (3):

    $(3) - 20\times(1)$: $$1634 - 1200 = (140-140)a_0 + (784-560)a_1 + (4676-2800)a_2$$ $$434 = 224a_1 + 1876a_2 \quad (5)$$

    Eliminate $a_1$. Multiply (4) by 8: $$432 = 224a_1 + 1792a_2 \quad (4')$$

    $(5) - (4')$: $$434 - 432 = (1876 - 1792)a_2$$ $$2 = 84a_2 \implies a_2 = 0.02381$$

    From (4): $$54 = 28a_1 + 224(0.02381) = 28a_1 + 5.333$$ $$28a_1 = 48.667 \implies a_1 = 1.7381$$

    From (1): $$60 = 7a_0 + 28(1.7381) + 140(0.02381)$$ $$60 = 7a_0 + 48.667 + 3.333$$ $$7a_0 = 8.0 \implies a_0 = 1.1429$$

    Result

    $$\boxed{y = 1.1429 + 1.7381x + 0.0238x^2}$$

    Verification (at $x=4$): $1.1429 + 6.9524 + 0.381 = 8.476 \approx 8$ ✓ (at $x=7$): $1.1429 + 12.167 + 1.167 = 14.48 \approx 15$ ✓

  6. 65 marksNumericalGauss-Seidel iteration methodAnswer

    Solve the following system of linear equations using Gauss-Seidal method.

    $$\begin{aligned} 10x + y + z &= 12 \ 2x + 10y + z &= 13 \ 2x + 2y + 10z &= 14 \end{aligned}$$

    [5]

    System of linear equations: $$10x + y + z = 12 \quad \cdots (1)$$ $$2x + 10y + z = 13 \quad \cdots (2)$$ $$2x + 2y + 10z = 14 \quad \cdots (3)$$ Initial approximation: $x^{(0)} = y^{(0)} = z^{(0)} = 0$ Row 1: $10 \geq 1+1$; Row 2:

  7. 75 marksNumericalHeun's method for ODE solvingAnswer

    Find the approximate value of y when x = 0.6 of $dy/dx = 1-2xy$, given that y = 0 when x = 0 with h=0.2 using Heun's method. [5]

    • ODE: $\frac{dy}{dx} = f(x,y) = 1 - 2xy$ - Initial condition: $y = 0$ at $x = 0$ - Step size: $h = 0.2$ - Target: $y$ at $x = 0.6$ (requires 3 steps) Heun's formulas: $$y^{n+1} = yn + h,f(xn, yn)$$ $$y{n+1} = yn + \frac{h}{2}\left[f(xn...
  8. 85 marksNumericalSimpson's 3/8 rule and composite Simpson'sAnswer

    Simpson's 3/8 Rule Integration Problem

    The simple Simpson's 3/8 rule fits a single cubic polynomial over 3 sub-intervals (4 points). Its limitations: - It applies only to exactly 3 sub-intervals. A dataset with many points cannot be handled directly. - Fitting one cubic over ...

  9. 95 marksNumericalGaussian elimination methodAnswer

    Solve the following system of linear equations using Gaussian elimination method.

    $$\begin{aligned} 2x + 2y + z &= 12 \ 3x + 2y + 2z &= 8 \ 5x + 10y - 8z &= 10 \end{aligned}$$

    [5]

    System of equations: - $2x + 2y + z = 12$ - $3x + 2y + 2z = 8$ - $5x + 10y - 8z = 10$ Augmented matrix: $$[Ab] = \begin{bmatrix} 2 & 2 & 1 & & 12 \ 3 & 2 & 2 & & 8 \ 5 & 10 & -8 & & 10 \end{bmatrix}$$ Eliminate x from R2:

  10. 105 marksEigenvalue and eigenvector definitionsAnswer

    Define eigen value and eigen vector. Explain how shooting method is used to solve boundary value problem. [5]

    --- Definition: Let $A$ be an $n \times n$ square matrix. A scalar $\lambda$ is called an eigenvalue of $A$ if there exists a non-zero vector $\mathbf{x}$ such that: $$A\mathbf{x} = \lambda \mathbf{x}$$ The non-zero vector $\mathbf{x}$ s...

  11. 115 marksNumericalLaplace equation and steady state problemsAnswer

    Consider a steel plate of size 24cm x 24cm. If two of the opposite sides are held at 100 degree Celsius and the other two opposite sides at 0 degree Celsius, find the steady state temperatures of interior points, assuming a grid size of 8cm x 8cm. [5]

    • Plate size: $24 \text{ cm} \times 24 \text{ cm}$ - Grid spacing: $h = 8 \text{ cm}$ - Boundary conditions: - Two opposite sides held at $100^\circ$C - Other two opposite sides held at $0^\circ$C - Interior points required (steady state...
  12. 125 marksNumericalHorner's method for polynomial evaluationAnswer

    Write an algorithm for Honer's method. Evaluate the polynomial $f(x) = x^4 + 3x^3 + 5x^2 + 7^x + 9$ at x = 2 by using Honer's method. [5]

    Polynomial: $f(x) = x^4 + 3x^3 + 5x^2 + 7x + 9$ (Note: the source text shows "$7^x$", but from the pattern of a standard 4th-degree polynomial this is clearly a typo for the linear term $7x$.) Coefficients (highest to lowest degree): Deg...