2081

CSC212 · TU past paper

Numerical Method 2081 question paper

The complete TU 2081 exam paper for Numerical Method (CSC212), all 12 questions with solved model answers written to the mark scheme.

Tap a question to open its answer.

  1. 110 marksNumericalNewton's method and ConvergenceAnswer

    What are inherent errors? Derive the Newton Raphson method for solving non-linear equation and using this method solve the following equation up to 3 decimal places: $x^2 - 5x + 6 = 0$ [10]

    Inherent Errors and Newton-Raphson Method

    Part 1: Inherent Errors (2 marks)

    Inherent errors are errors that already exist in a problem before any numerical computation is carried out. They are caused by the data or by the mathematical model, not by the numerical technique used.

    Main sources:

    • Data errors: Values obtained from physical measurements or observation carry uncertainty.
    • Modelling / simplifying assumptions: Approximating a real system by a simplified mathematical model introduces error.
    • Errors in empirical constants: Constants determined experimentally are not exact.

    Such errors cannot be removed by using a better numerical method; they can only be controlled so that they are not amplified.


    Part 2: Derivation of Newton-Raphson Method (4 marks)

    Let $f(x)=0$ be the equation whose root is required, and let $x_n$ be an approximate root.

    Expand $f(x_n+h)$ by Taylor's series:

    $$f(x_n+h)=f(x_n)+h,f'(x_n)+\frac{h^2}{2!}f''(x_n)+\cdots$$

    Since $h$ is small, neglect second and higher order terms:

    $$f(x_n+h)\approx f(x_n)+h,f'(x_n)$$

    If $x_n+h$ is the exact root, then $f(x_n+h)=0$:

    $$0=f(x_n)+h,f'(x_n)\quad\Rightarrow\quad h=-\frac{f(x_n)}{f'(x_n)}$$

    Hence the improved approximation $x_{n+1}=x_n+h$ gives:

    $$\boxed{x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)},\qquad f'(x_n)\neq 0}$$


    Part 3: Solve $x^2-5x+6=0$ to 3 Decimal Places (4 marks)

    $$f(x)=x^2-5x+6,\qquad f'(x)=2x-5$$

    Iteration formula:

    $$x_{n+1}=x_n-\frac{x_n^2-5x_n+6}{2x_n-5}$$

    (Exact roots: $(x-2)(x-3)=0 \Rightarrow x=2,,3$.)

    Root near $x=3$, take $x_0=4$

    Iteration 1: $$f(4)=16-20+6=2,\quad f'(4)=3$$ $$x_1=4-\tfrac{2}{3}=3.3333$$

    Iteration 2: $$f(3.3333)=11.1109-16.6665+6=0.4444,\quad f'(3.3333)=1.6666$$ $$x_2=3.3333-\tfrac{0.4444}{1.6666}=3.0667$$

    Iteration 3: $$f(3.0667)=9.4046-15.3335+6=0.0711,\quad f'(3.0667)=1.1334$$ $$x_3=3.0667-\tfrac{0.0711}{1.1334}=3.0040$$

    Iteration 4: $$f(3.0040)=9.0240-15.0200+6=0.0040,\quad f'(3.0040)=1.0080$$ $$x_4=3.0040-\tfrac{0.0040}{1.0080}=3.0000$$

    $$\boxed{x=3.000}$$

    Root near $x=2$, take $x_0=1$

    Iteration 1: $$f(1)=1-5+6=2,\quad f'(1)=-3$$ $$x_1=1-\tfrac{2}{-3}=1.6667$$

    Iteration 2: $$f(1.6667)=2.7779-8.3335+6=0.4444,\quad f'(1.6667)=-1.6666$$ $$x_2=1.6667-\tfrac{0.4444}{-1.6666}=1.9334$$

    Iteration 3: $$f(1.9334)=3.7380-9.6670+6=0.0710,\quad f'(1.9334)=-1.1332$$ $$x_3=1.9334-\tfrac{0.0710}{-1.1332}=1.9961$$

    Iteration 4: $$f(1.9961)=3.9844-9.9805+6=0.0039,\quad f'(1.9961)=-1.0078$$ $$x_4=1.9961-\tfrac{0.0039}{-1.0078}=2.0000$$

    $$\boxed{x=2.000}$$

    Final Result

    The roots of $x^2-5x+6=0$ correct to 3 decimal places are:

    $$x=2.000 \quad\text{and}\quad x=3.000$$

  2. 210 marksNumericalJacobi Iteration MethodAnswer

    What are the limitations of direct methods for solving a system of linear equations? How does Gauss Seidel method differ from Jacobi iteration? Solve the following system of linear equations using Jacobi iteration method:

    $$ \begin{aligned} 2x - 7y - 10z &= -17 \ 5x + y + 3z &= 14 \ x + 10y + 9z &= 7 \end{aligned} $$

    [10]

    Limitations of Direct Methods, Gauss-Seidel vs Jacobi, and Jacobi Iteration


    Part 1: Limitations of Direct Methods

    Direct methods (Gauss Elimination, LU Decomposition, Cramer's Rule) obtain the solution in a finite number of steps, but have limitations:

    1. High computational cost: Gauss Elimination needs about $O(n^3)$ operations; expensive for large $n$.
    2. Round-off error accumulation: Fixed long sequences of operations let rounding errors propagate.
    3. Large memory needs: Full matrix storage is required.
    4. Poor for sparse systems: Fill-in destroys sparsity, wasting memory and time.
    5. Pivoting problems: Zero or small pivots cause failure or instability without pivoting.
    6. Hard to parallelize: Inherently sequential.

    Part 2: Gauss-Seidel vs Jacobi

    FeatureJacobiGauss-Seidel
    Values usedOnly previous iteration valuesMost recent updated values immediately
    StorageNeeds old and new arraysSingle array (in-place)
    ConvergenceSlowerFaster (≈ twice)
    ParallelismEasyHarder

    Formulas: $$x_i^{(k+1)} = \frac{1}{a_{ii}}\Big(b_i - \sum_{j\neq i} a_{ij}x_j^{(k)}\Big)\quad\text{(Jacobi)}$$ $$x_i^{(k+1)} = \frac{1}{a_{ii}}\Big(b_i - \sum_{j<i} a_{ij}x_j^{(k+1)} - \sum_{j>i} a_{ij}x_j^{(k)}\Big)\quad\text{(Gauss-Seidel)}$$


    Part 3: Jacobi Iteration Solution

    Given System

    $$2x - 7y - 10z = -17 \quad (1)$$ $$5x + y + 3z = 14 \quad (2)$$ $$x + 10y + 9z = 7 \quad (3)$$

    Step 1: Rearrange for Diagonal Dominance

    Swap to place dominant coefficients on the diagonal: $$5x + y + 3z = 14 \quad (1')$$ $$x + 10y + 9z = 7 \quad (2')$$ $$2x - 7y - 10z = -17 \quad (3')$$

    Check:

    • Row 1: $|5|=5 > 1+3=4$ ✓
    • Row 2: $|10|=10 = 1+9=10$ (borderline, acceptable)
    • Row 3: $|-10|=10 > 2+7=9$ ✓

    Step 2: Iteration Formulas

    $$x^{(k+1)} = \tfrac{1}{5}\big(14 - y^{(k)} - 3z^{(k)}\big)$$ $$y^{(k+1)} = \tfrac{1}{10}\big(7 - x^{(k)} - 9z^{(k)}\big)$$ $$z^{(k+1)} = \tfrac{1}{10}\big(17 + 2x^{(k)} - 7y^{(k)}\big)$$

    Step 3: Iterations (start $x^{(0)}=y^{(0)}=z^{(0)}=0$)

    Iteration 1: $$x^{(1)} = \tfrac{1}{5}(14) = 2.8$$ $$y^{(1)} = \tfrac{1}{10}(7) = 0.7$$ $$z^{(1)} = \tfrac{1}{10}(17) = 1.7$$

    Iteration 2: $$x^{(2)} = \tfrac{1}{5}(14 - 0.7 - 3(1.7)) = \tfrac{1}{5}(14 - 0.7 - 5.1) = \tfrac{8.2}{5} = 1.64$$ $$y^{(2)} = \tfrac{1}{10}(7 - 2.8 - 9(1.7)) = \tfrac{1}{10}(7 - 2.8 - 15.3) = \tfrac{-11.1}{10} = -1.11$$ $$z^{(2)} = \tfrac{1}{10}(17 + 2(2.8) - 7(0.7)) = \tfrac{1}{10}(17 + 5.6 - 4.9) = \tfrac{17.7}{10} = 1.77$$

    Iteration 3: $$x^{(3)} = \tfrac{1}{5}(14 - (-1.11) - 3(1.77)) = \tfrac{1}{5}(14 + 1.11 - 5.31) = \tfrac{9.8}{5} = 1.96$$ $$y^{(3)} = \tfrac{1}{10}(7 - 1.64 - 9(1.77)) = \tfrac{1}{10}(7 - 1.64 - 15.93) = \tfrac{-10.57}{10} = -1.057$$ $$z^{(3)} = \tfrac{1}{10}(17 + 2(1.64) - 7(-1.11)) = \tfrac{1}{10}(17 + 3.28 + 7.77) = \tfrac{28.05}{10} = 2.805$$

    Iteration 4: $$x^{(4)} = \tfrac{1}{5}(14 + 1.057 - 3(2.805)) = \tfrac{1}{5}(14 + 1.057 - 8.415) = \tfrac{6.642}{5} = 1.3284$$ $$y^{(4)} = \tfrac{1}{10}(7 - 1.96 - 9(2.805)) = \tfrac{1}{10}(7 - 1.96 - 25.245) = \tfrac{-20.205}{10} = -2.0205$$ $$z^{(4)} = \tfrac{1}{10}(17 + 2(1.96) - 7(-1.057)) = \tfrac{1}{10}(17 + 3.92 + 7.399) = \tfrac{28.319}{10} = 2.8319$$

    Iteration 5: $$x^{(5)} = \tfrac{1}{5}(14 + 2.0205 - 3(2.8319)) = \tfrac{1}{5}(14 + 2.0205 - 8.4957) = \tfrac{7.5248}{5} = 1.505$$ $$y^{(5)} = \tfrac{1}{10}(7 - 1.3284 - 9(2.8319)) = \tfrac{1}{10}(7 - 1.3284 - 25.4871) = \tfrac{-19.8155}{10} = -1.9816$$ $$z^{(5)} = \tfrac{1}{10}(17 + 2(1.3284) - 7(-2.0205)) = \tfrac{1}{10}(17 + 2.6568 + 14.1435) = \tfrac{33.8003}{10} = 3.380$$

    Observation on Convergence

    The iterates are oscillating and not settling quickly:

    kxyz
    12.800.701.70
    21.64-1.111.77
    31.96-1.0572.805
    41.328-2.0212.832
    51.505-1.9823.380

    The values are drifting rather than converging tightly. This is because Row 2 is only borderline dominant ($|10| = |1| + |9|$), so strict diagonal dominance is not satisfied, and Jacobi converges very slowly (borderline behavior).

    Exact Solution (for reference)

    Solving the system directly gives: $$x = 1,\quad y = -2,\quad z = 3$$

    The Jacobi iterates ($x\to$ near 1.5, $y\to$ near $-2$, $z\to$ near 3) are drifting toward the neighborhood of this solution but require many more iterations owing to the borderline dominance.

    Final result (converged / exact): $x = 1,\ y = -2,\ z = 3$.

  3. 310 marksLagrange's InterpolationAnswer

    Write an algorithm and program to implement Lagrange interpolation method.[10]

    Lagrange interpolation is a method of constructing a polynomial that passes through a given set of data points. Given n+1 data points (x₀, y₀), (x₁, y₁), ..., (xₙ, yₙ), the Lagrange interpolating polynomial is: $$Pn(x) = \sum{i=0}^{n} Li...

  4. 45 marksNumericalNewton's Interpolation using divided diffeAnswer

    Consider the following data points. Estimate $f(0.6)$ using Newton's interpolation formula.

    $$\begin{array}{c|ccccc} x & 0.1 & 0.2 & 0.3 & 0.4 & 0.5 \ \hline f(x) & 2.68 & 3.04 & 3.38 & 3.69 & 3.97 \end{array}$$

    [5]

    Newton's Backward Difference Interpolation to Estimate f(0.6)

    STEP 1 - EXTRACT: Given Data

    x0.10.20.30.40.5
    f(x)2.683.043.383.693.97
    • Step size $h = 0.1$ (equally spaced)
    • Target: $f(0.6)$

    Since $x = 0.6$ lies beyond the last point $x = 0.5$, use Newton's Backward Difference Formula with base $x_n = 0.5$.


    STEP 2 - SOLVE

    Backward Difference Table

    xf(x)∇f∇²f∇³f∇⁴f
    0.12.68
    0.23.040.36
    0.33.380.34-0.02
    0.43.690.31-0.03-0.01
    0.53.970.28-0.030.000.01

    Verification of differences:

    • $\nabla f$: $0.36,\ 0.34,\ 0.31,\ 0.28$
    • $\nabla^2 f$: $-0.02,\ -0.03,\ -0.03$
    • $\nabla^3 f$: $-0.01,\ 0.00$
    • $\nabla^4 f$: $0.01$

    Compute s

    $$s = \frac{x - x_n}{h} = \frac{0.6 - 0.5}{0.1} = 1$$

    Apply the Formula

    $$P_n(x) = f(x_n) + s,\nabla f + \frac{s(s+1)}{2!}\nabla^2 f + \frac{s(s+1)(s+2)}{3!}\nabla^3 f + \frac{s(s+1)(s+2)(s+3)}{4!}\nabla^4 f$$

    With $s = 1$ (using the last row):

    Term 1: $f(x_n) = 3.97$

    Term 2: $1 \times 0.28 = 0.28$

    Term 3: $\dfrac{1 \cdot 2}{2}\times(-0.03) = 1 \times (-0.03) = -0.03$

    Term 4: $\dfrac{1 \cdot 2 \cdot 3}{6}\times 0.00 = 0.00$

    Term 5: $\dfrac{1 \cdot 2 \cdot 3 \cdot 4}{24}\times 0.01 = 1 \times 0.01 = 0.01$

    Sum

    $$f(0.6) \approx 3.97 + 0.28 - 0.03 + 0.00 + 0.01$$

    $$\boxed{f(0.6) \approx 4.23}$$

  5. 55 marksNumericalNon-linear Regression by fitting ExponentiAnswer

    What is regression analysis? Fit a second order polynomial for the following data values.

    $$\begin{array}{c|ccccc} x & 2 & 4 & 6 & 8 & 10 \ \hline y & 1.4 & 2.0 & 2.4 & 2.6 & 2.8 \end{array}$$

    [5]

    Regression Analysis and Second Order Polynomial Fitting

    What is Regression Analysis?

    Regression analysis is a statistical technique used to determine the best-fit mathematical relationship between a dependent variable and one or more independent variables. Unlike interpolation (which forces the curve through every data point), regression minimizes the total squared error between the observed data and the fitted curve (least squares principle). It is widely used for prediction and trend estimation.


    Given Data

    $$ \begin{array}{c|ccccc} x & 2 & 4 & 6 & 8 & 10\ \hline y & 1.4 & 2.0 & 2.4 & 2.6 & 2.8 \end{array} $$

    $n = 5$. Fit $y = a_0 + a_1 x + a_2 x^2$.


    Step 1: Summation Table

    $x$$y$$x^2$$x^3$$x^4$$xy$$x^2y$
    21.448162.85.6
    42.016642568.032.0
    62.436216129614.486.4
    82.664512409620.8166.4
    102.810010001000028.0280.0
    $\sum$11.222018001566474.0570.4

    $\sum x = 30$, $\sum y = 11.2$, $\sum x^2 = 220$, $\sum x^3 = 1800$, $\sum x^4 = 15664$, $\sum xy = 74.0$, $\sum x^2y = 570.4$

    (Check $\sum x^4$: $16+256+1296+4096+10000 = 15664$ ✓)


    Step 2: Normal Equations

    $$5a_0 + 30a_1 + 220a_2 = 11.2 \quad (1)$$ $$30a_0 + 220a_1 + 1800a_2 = 74.0 \quad (2)$$ $$220a_0 + 1800a_1 + 15664a_2 = 570.4 \quad (3)$$


    Step 3: Solve

    $(2) - 6\times(1)$: $$40a_1 + 480a_2 = 6.8 \quad (4)$$

    $(3) - 44\times(1)$: $$480a_1 + 5984a_2 = 77.6 \quad (5)$$

    $(5) - 12\times(4)$: $12\times(4)$ gives $480a_1 + 5760a_2 = 81.6$. $$(5984 - 5760)a_2 = 77.6 - 81.6$$ $$224a_2 = -4.0 \implies a_2 = -0.017857$$

    From (4): $$40a_1 = 6.8 - 480(-0.017857) = 6.8 + 8.5714 = 15.3714$$ $$a_1 = 0.38429$$

    From (1): $$5a_0 = 11.2 - 30(0.38429) - 220(-0.017857)$$ $$= 11.2 - 11.5286 + 3.9286 = 3.6000$$ $$a_0 = 0.7200$$

    (Using the more precise $a_1=0.384286$ and $a_2=-0.0178571$ gives $a_0 = 0.72$; rounding earlier would give $0.7188$.)


    Result

    $$\boxed{y = 0.72 + 0.3843,x - 0.01786,x^2}$$

    Rounding during the intermediate steps would give $a_0 \approx 0.7188$, $a_1 \approx 0.3848$ and $a_2 \approx -0.0179$; the more accurate value is $a_0 \approx 0.72$, and the fit is essentially the same.

  6. 65 marksNumericalDifferentiating Tabulated Functions by usiAnswer

    What is numerical differentiation? The table below gives the values of distance travelled by a vehicle at various time intervals. Estimate the velocity and acceleration at $x=4$.

    Time $(x)$124810
    Distance $(y)$0152127

    [5]

    Numerical Differentiation

    Definition

    Numerical differentiation is the process of estimating the derivative (rate of change) of a function from a set of tabulated/discrete data values, instead of differentiating a closed-form expression analytically. It is used when the function is either unknown (only data points are given) or too complex to differentiate directly. The derivatives are obtained by differentiating an interpolating polynomial (Newton forward/backward for equal spacing, Newton's divided differences for unequal spacing).

    Here velocity $= \dfrac{dy}{dx}$ and acceleration $= \dfrac{d^2y}{dx^2}$.


    Given Data

    Time $x$124810
    Distance $y$0152127

    The nodes are unequally spaced, so I use Newton's Divided Difference interpolation.


    Step 1: Divided Difference Table

    First DD: $$f[x_0,x_1]=\tfrac{1-0}{2-1}=1,\quad f[x_1,x_2]=\tfrac{5-1}{4-2}=2$$ $$f[x_2,x_3]=\tfrac{21-5}{8-4}=4,\quad f[x_3,x_4]=\tfrac{27-21}{10-8}=3$$

    Second DD: $$f[x_0,x_1,x_2]=\tfrac{2-1}{4-1}=\tfrac13,\quad f[x_1,x_2,x_3]=\tfrac{4-2}{8-2}=\tfrac13,\quad f[x_2,x_3,x_4]=\tfrac{3-4}{10-4}=-\tfrac16$$

    Third DD: $$f[x_0,x_1,x_2,x_3]=\tfrac{\tfrac13-\tfrac13}{8-1}=0,\quad f[x_1,x_2,x_3,x_4]=\tfrac{-\tfrac16-\tfrac13}{10-2}=\tfrac{-\tfrac12}{8}=-\tfrac1{16}$$

    Fourth DD: $$f[x_0,\dots,x_4]=\tfrac{-\tfrac1{16}-0}{10-1}=-\tfrac1{144}$$


    Step 2: Newton's Divided Difference Polynomial

    $$P(x)=(x-1)+\tfrac13(x-1)(x-2)+0-\tfrac1{144}(x-1)(x-2)(x-4)(x-8)$$


    Step 3: Velocity = $P'(4)$

    Term 1: $\dfrac{d}{dx}(x-1)=1$

    Term 2: $\dfrac13\big[(x-2)+(x-1)\big]=\dfrac13(2x-3)$; at $x=4$: $\dfrac13(5)=\dfrac53$

    Term 3: coefficient $0\Rightarrow 0$

    Term 4: Let $g(x)=(x-1)(x-2)(x-4)(x-8)$. $$g'(x)=(x-2)(x-4)(x-8)+(x-1)(x-4)(x-8)+(x-1)(x-2)(x-8)+(x-1)(x-2)(x-4)$$ At $x=4$, only the term without $(x-4)$ survives: $$g'(4)=(3)(2)(-4)=-24$$ Contribution $=-\dfrac1{144}(-24)=\dfrac{1}{6}$

    Velocity: $$P'(4)=1+\tfrac53+0+\tfrac16=\frac{6+10+1}{6}=\frac{17}{6}\approx 2.833$$

    $$\boxed{\text{Velocity}\approx 2.83\ \text{units/time}}$$


    Step 4: Acceleration = $P''(4)$

    Term 1: second derivative $=0$

    Term 2: $\dfrac13(2x-3)\Rightarrow \dfrac13(2)=\dfrac23$

    Term 3: $0$

    Term 4: Need $g''(4)$ where $g(x)=(x-1)(x-2)(x-4)(x-8)$.

    Differentiate $g'(x)$ (sum of four triple products). $g''(x)$ is the sum of all products of two factors, each taken from three of the roots. A cleaner way: expand near the surviving structure. Since terms with $(x-4)$ vanish in first derivative, for $g''$ we differentiate:

    $$g'(x)=\underbrace{(x-2)(x-4)(x-8)}{A}+\underbrace{(x-1)(x-4)(x-8)}{B}+\underbrace{(x-1)(x-2)(x-8)}{C}+\underbrace{(x-1)(x-2)(x-4)}{D}$$

    At $x=4$:

    • $A'=(x-4)(x-8)+(x-2)(x-8)+(x-2)(x-4)$; at 4: $0+(2)(-4)+0=-8$
    • $B'=(x-4)(x-8)+(x-1)(x-8)+(x-1)(x-4)$; at 4: $0+(3)(-4)+0=-12$
    • $C'=(x-2)(x-8)+(x-1)(x-8)+(x-1)(x-2)$; at 4: $(2)(-4)+(3)(-4)+(3)(2)=-8-12+6=-14$
    • $D'=(x-2)(x-4)+(x-1)(x-4)+(x-1)(x-2)$; at 4: $0+0+(3)(2)=6$

    $$g''(4)=-8-12-14+6=-28$$

    Contribution $=-\dfrac1{144}(-28)=\dfrac{28}{144}=\dfrac{7}{36}$

    Acceleration: $$P''(4)=0+\tfrac23+0+\tfrac{7}{36}=\frac{24+7}{36}=\frac{31}{36}\approx 0.861$$

    $$\boxed{\text{Acceleration}\approx 0.86\ \text{units/time}^2}$$


    Final Results

    • Velocity at $x=4$: $\dfrac{17}{6}\approx 2.83$
    • Acceleration at $x=4$: $\dfrac{31}{36}\approx 0.86$
  7. 75 marksNumericalSimpson's 3/8 ruleAnswer

    What is an application of numerical integration? Find the value of the integral using Simpson's 3/8 rule with n=6. $$\int_{1}^{2} \frac{e^x}{x} dx$$ [5]

    Application of Numerical Integration and Simpson's 3/8 Rule

    Application of Numerical Integration

    Numerical integration computes the approximate value of a definite integral from numerical/tabular values of the integrand. Key application:

    • Evaluating definite integrals when no closed-form (analytical) antiderivative exists (such as $\int e^{x}/x,dx$).
    • Computing area/volume from experimental or tabular data where only discrete points are known.
    • Used in engineering and physics for work, probability, signal processing, etc.

    Given Data

    $$\int_1^2 \frac{e^x}{x},dx, \qquad a=1,\ b=2,\ n=6$$

    Since $n=6$ is a multiple of 3, Simpson's 3/8 rule applies.


    Step 1: Step size

    $$h = \frac{b-a}{n} = \frac{2-1}{6} = \frac{1}{6} = 0.16667$$

    Step 2: Nodes and function values $f(x)=\dfrac{e^x}{x}$

    $i$$x_i$$e^{x_i}$$f(x_i)=e^{x_i}/x_i$
    01.000002.718282.71828
    11.166673.211092.75236
    21.333333.793672.84525
    31.500004.481692.98779
    41.666675.294493.17670
    51.833336.255143.41190
    62.000007.389063.69453

    Step 3: Simpson's 3/8 composite rule

    $$I \approx \frac{3h}{8}\Big[f_0 + 3(f_1+f_2+f_4+f_5) + 2f_3 + f_6\Big]$$

    Grouping:

    • $f_0 + f_6 = 2.71828 + 3.69453 = 6.41281$
    • $3(f_1+f_2+f_4+f_5) = 3(2.75236+2.84525+3.17670+3.41190) = 3(12.18621)=36.55863$
    • $2f_3 = 2(2.98779) = 5.97558$

    Sum $= 6.41281 + 36.55863 + 5.97558 = 48.94702$

    Step 4: Coefficient and result

    $$\frac{3h}{8} = \frac{3\times 0.16667}{8} = \frac{0.50001}{8} = 0.0625$$

    $$I \approx 0.0625 \times 48.94702 = 3.05919$$

    $$\boxed{I \approx 3.0592}$$

    The exact value is $\approx 3.0591$, so the approximation is accurate to 4 significant figures.

  8. 85 marksNumericalGauss-Jordan methodAnswer

    Solve the following system of linear equations using Gauss-Jordan elimination method:

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

    [5]

    Gauss-Jordan Elimination Method

    Given Data

    System of equations: $$x + 2y - 3z = 4 \quad \cdots (1)$$ $$2x + 4y - 6z = 8 \quad \cdots (2)$$ $$x - 2y + 5z = 4 \quad \cdots (3)$$

    Step 1: Augmented Matrix

    $$[A|b] = \begin{bmatrix} 1 & 2 & -3 & | & 4 \ 2 & 4 & -6 & | & 8 \ 1 & -2 & 5 & | & 4 \end{bmatrix}$$

    Step 2: Eliminate column 1 below pivot

    $R_2 \to R_2 - 2R_1$: $[0,\ 0,\ 0,\ |\ 0]$

    $R_3 \to R_3 - R_1$: $[0,\ -4,\ 8,\ |\ 0]$

    $$\begin{bmatrix} 1 & 2 & -3 & | & 4 \ 0 & 0 & 0 & | & 0 \ 0 & -4 & 8 & | & 0 \end{bmatrix}$$

    Step 3: Swap $R_2 \leftrightarrow R_3$

    $$\begin{bmatrix} 1 & 2 & -3 & | & 4 \ 0 & -4 & 8 & | & 0 \ 0 & 0 & 0 & | & 0 \end{bmatrix}$$

    Step 4: Normalize Row 2 ($R_2 \to R_2 / (-4)$)

    $$\begin{bmatrix} 1 & 2 & -3 & | & 4 \ 0 & 1 & -2 & | & 0 \ 0 & 0 & 0 & | & 0 \end{bmatrix}$$

    Step 5: Eliminate column 2 above pivot ($R_1 \to R_1 - 2R_2$)

    $R_1: [1,\ 0,\ 1,\ |\ 4]$

    $$\begin{bmatrix} 1 & 0 & 1 & | & 4 \ 0 & 1 & -2 & | & 0 \ 0 & 0 & 0 & | & 0 \end{bmatrix}$$

    Step 6: Interpretation

    Row 3 gives $0 = 0$, which is consistent. Rank of coefficient matrix $= 2 <$ number of unknowns $= 3$, so there are infinitely many solutions.

    Let $z = t$ (free parameter, $t \in \mathbb{R}$).

    From Row 2: $y - 2t = 0 \implies y = 2t$

    From Row 1: $x + t = 4 \implies x = 4 - t$

    Verification with equation (3): $x - 2y + 5z = (4-t) - 2(2t) + 5t = 4 - t - 4t + 5t = 4$ ✓

    Final Answer

    $$x = 4 - t, \quad y = 2t, \quad z = t, \quad t \in \mathbb{R}$$

    The system has infinitely many solutions since equation (2) $= 2 \times$ equation (1), reducing to two independent equations in three unknowns.

  9. 95 marksNumericalCubic spline interpolationAnswer

    Given the data points below, find cubic spline which belongs to $1 \leq x \leq 3$ and estimate $f(2)$ using cubic splines.

    $$\begin{array}{c|ccc} x & 1.0 & 3.0 & 4.0 \ \hline f(x) & 1.5 & 4.5 & 9.0 \end{array}$$

    [5]

    Cubic Spline Interpolation on [1, 3], Estimate f(2)

    STEP 1 - Given Data

    i$x_i$$f_i$
    01.01.5
    13.04.5
    24.09.0

    Number of intervals $n = 2$. We use natural cubic spline (standard assumption when no end conditions given).


    STEP 2 - Solve

    Interval widths

    $$h_0 = x_1 - x_0 = 2, \qquad h_1 = x_2 - x_1 = 1$$

    Moment (second-derivative) equations

    Natural boundary conditions: $M_0 = 0,\ M_2 = 0$.

    Interior equation at $i=1$:

    $$h_0 M_0 + 2(h_0+h_1)M_1 + h_1 M_2 = 6\left[\frac{f_2-f_1}{h_1} - \frac{f_1-f_0}{h_0}\right]$$

    RHS:

    $$\frac{f_2-f_1}{h_1} = \frac{9.0-4.5}{1} = 4.5, \qquad \frac{f_1-f_0}{h_0} = \frac{4.5-1.5}{2} = 1.5$$

    $$\text{RHS} = 6(4.5-1.5) = 18$$

    Substituting $M_0 = M_2 = 0$:

    $$2(2+1)M_1 = 18 \Rightarrow 6M_1 = 18 \Rightarrow M_1 = 3$$

    So $M_0 = 0,\ M_1 = 3,\ M_2 = 0$.

    Spline on [1, 3]

    $$S_0(x) = \frac{M_0}{6h_0}(x_1-x)^3 + \frac{M_1}{6h_0}(x-x_0)^3 + \left(\frac{f_0}{h_0}-\frac{M_0 h_0}{6}\right)(x_1-x) + \left(\frac{f_1}{h_0}-\frac{M_1 h_0}{6}\right)(x-x_0)$$

    With $x_0=1,\ x_1=3,\ h_0=2$:

    $$S_0(x) = \frac{3}{12}(x-1)^3 + \left(\frac{1.5}{2}\right)(3-x) + \left(\frac{4.5}{2}-\frac{3\cdot 2}{6}\right)(x-1)$$

    $$S_0(x) = 0.25(x-1)^3 + 0.75(3-x) + (2.25-1)(x-1)$$

    Simplify linear terms:

    $$0.75(3-x) + 1.25(x-1) = 2.25 - 0.75x + 1.25x - 1.25 = 1 + 0.5x$$

    $$\boxed{S_0(x) = 0.25(x-1)^3 + 0.5x + 1.0}$$

    Estimate f(2)

    Since $1 \le 2 \le 3$, use $S_0$:

    $$f(2) = 0.25(2-1)^3 + 0.5(2) + 1.0 = 0.25(1) + 1.0 + 1.0 = 2.25$$

    $$\boxed{f(2) = 2.25}$$


    Summary

    QuantityValue
    $M_0, M_1, M_2$$0,\ 3,\ 0$
    $S_0(x)$ on $[1,3]$$0.25(x-1)^3 + 0.5x + 1.0$
    $f(2)$$\mathbf{2.25}$
  10. 105 marksReview of differential equationsAnswer

    What is differential equation? Differentiate between ODE and PDE with example. [5]

    Differential Equation, ODE and PDE

    Differential Equation

    An equation which uses differential calculus to express relationship between variables is known as a differential equation.

    In other words, a differential equation is an equation that contains one or more derivatives of a dependent variable with respect to one or more independent variables.


    Types of Differential Equations

    Differential equations are of two types:

    1. Ordinary Differential Equation (ODE)

    A differential equation with a single independent variable (i.e., the quantity with respect to which the dependent variable is differentiated) is called an Ordinary Differential Equation (ODE).

    Example:

    $$\frac{dy}{dx} + 2y = x$$

    Here, y is the dependent variable and x is the only independent variable. Since there is only one independent variable, this is an ODE.

    Another example:

    $$\frac{d^2y}{dx^2} + 3\frac{dy}{dx} + y = 0$$


    2. Partial Differential Equation (PDE)

    A differential equation with more than one independent variable is called a Partial Differential Equation (PDE).

    Example:

    $$\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 0$$

    Here, u is the dependent variable and x, y are two independent variables. Since there are more than one independent variable, this is a PDE.


    Comparison Table: ODE vs PDE

    FeatureODEPDE
    Independent VariablesSingle independent variableMore than one independent variable
    Derivative TypeOrdinary derivativesPartial derivatives
    ComplexityRelatively simplerMore complex
    Notation$\frac{dy}{dx}$, $\frac{d^2y}{dx^2}$$\frac{\partial u}{\partial x}$, $\frac{\partial^2 u}{\partial x^2}$
    Example$\frac{dy}{dx} + 2y = x$$\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 0$

    Note: The relationship between dependent and independent variables that satisfies a differential equation is called the solution of the differential equation.

  11. 115 marksNumericalRunge-Kutta methodsAnswer

    Solve $\frac{dy}{dx} = \frac{x}{y}$, $y(0) = 1$, at $x = 0.4$ using Runge-Kutta's 4th order method. [5]

    Runge-Kutta 4th Order Method

    Given Data

    $$\frac{dy}{dx} = f(x,y) = \frac{x}{y}, \quad y_0 = 1 \text{ at } x_0 = 0, \quad \text{find } y(0.4)$$

    Step size: $h = 0.4$ (single step).

    RK4 Formulas

    $$k_1 = h f(x_0, y_0)$$ $$k_2 = h f\left(x_0+\tfrac{h}{2}, y_0+\tfrac{k_1}{2}\right)$$ $$k_3 = h f\left(x_0+\tfrac{h}{2}, y_0+\tfrac{k_2}{2}\right)$$ $$k_4 = h f\left(x_0+h, y_0+k_3\right)$$ $$y_1 = y_0 + \tfrac{1}{6}(k_1 + 2k_2 + 2k_3 + k_4)$$

    Calculation

    $k_1$: $$k_1 = 0.4 \cdot f(0, 1) = 0.4 \cdot \frac{0}{1} = 0$$

    $k_2$: $$k_2 = 0.4 \cdot f(0.2, \ 1+0) = 0.4 \cdot \frac{0.2}{1} = 0.08$$

    $k_3$: $$k_3 = 0.4 \cdot f(0.2, \ 1+0.04) = 0.4 \cdot \frac{0.2}{1.04} = 0.4 \cdot 0.192308 = 0.076923$$

    $k_4$: $$k_4 = 0.4 \cdot f(0.4, \ 1+0.076923) = 0.4 \cdot \frac{0.4}{1.076923} = 0.4 \cdot 0.371429 = 0.148571$$

    Final Result

    $$y_1 = 1 + \frac{1}{6}\big(0 + 2(0.08) + 2(0.076923) + 0.148571\big)$$

    $$= 1 + \frac{1}{6}\big(0 + 0.16 + 0.153846 + 0.148571\big)$$

    $$= 1 + \frac{1}{6}(0.462418) = 1 + 0.077070$$

    $$\boxed{y(0.4) \approx 1.0771}$$

    Verification (Exact Solution)

    Separating variables: $y,dy = x,dx \Rightarrow \tfrac{y^2}{2} = \tfrac{x^2}{2} + C$. With $y(0)=1$, $C = \tfrac12$, so $y = \sqrt{1+x^2}$.

    At $x=0.4$: $y = \sqrt{1.16} = 1.07703$.

    The RK4 result $1.0771$ matches the exact value very closely.

  12. 125 marksNumericalLaplacian equation and Poisson's equationAnswer

    Solve the Poisson equation with boundary conditions:

    $$\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = -64xy, \quad 0 \leq x \leq 1, ; 0 \leq y \leq 1$$

    $$u(0,y) = 0, ; u(x,0) = 0, ; u(1,y) = 150, ; u(x,1) = 150, ; h = \frac{1}{3}$$

    [5]

    PDE: $$\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = -64xy, \quad 0 \le x \le 1,\ 0 \le y \le 1$$ So $f(x,y) = -64xy$. Boundary Conditions: - $u(0,y) = 0$ (left) - $u(x,0) = 0$ (bottom) - $u(1,y) = 150$ (right) ...