Important Questions

CSC212 · Exam intelligence

Numerical Method important questions

From 6 past TU papers: which questions keep coming back, how much they carry, and what is most likely to show up next. Every question links to a model answer.

Most likely in the next examStatistical

Ranked by how often a topic is asked, its marks weight, and whether it is due after skipping the 2081 paper. No guarantees; study the whole syllabus.

1asked 6xavg 5 marks · Laplacian equation and Poisson's equation
Answer

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) ...

2asked 4xavg 8 marks · due (skipped 2081) · Matrix factorization and Solving System of Linear Equations by using Dolittle and Cholesky's algorithm
Answer

Factorise the following matrix using Cholesky method. $$\begin{bmatrix} 2 & 1 & 1 \ 3 & 2 & 3 \ 1 & 4 & 9 \end{bmatrix}$$ [5]

$$A = \begin{bmatrix} 2 & 1 & 1 \ 3 & 2 & 3 \ 1 & 4 & 9 \end{bmatrix}$$ Cholesky's method requires the matrix to be symmetric (and positive definite), factorising it as: $$A = L L^T$$ where $L$ is lower triangular. The given matrix is ...

3asked 5xavg 6 marks · Newton's Interpolation using divided differences, forward differences and backward differences
Answer

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}$$

4asked 3xavg 10 marks · due (skipped 2081) · Secant method and Convergence
Answer

How secant methods differs from Newton Raphson method? Derive the formula for Secant Method. Solve the equation using Secant method. Assume error precision as 0.01. Discuss the drawbacks of the Newton Raphson method.cos⁡x+2sin⁡x−x2=0\cos x + 2\sin x - x^2 = 0cosx+2sinx−x2=0_[10]_

  • Equation: $f(x) = \cos x + 2\sin x - x^2 = 0$ - Error precision (tolerance): $E = 0.01$ - Initial guesses: not specified in question. I choose $x0 = 1$, $x1 = 2$ (bracketing the root, angles in radians). Feature Newton-Raphson Secant -...
5asked 3xavg 5 marks · due (skipped 2081) · Half-Interval method and Convergence
Answer

Define the terms approximate error and relative approximate error? Discuss the working of Half Interval method for finding the roots of non-linear equation. [5]

--- Approximate Error is the difference between the current approximation and the previous approximation of a root. It gives an estimate of how much the solution has changed between two successive iterations. $$Ea = x{new} - x{old}$$ Sin...

Most repeated questions

Topics asked at least twice, most-asked first.

asked 6xavg 5 marks · 2081, 2080, 2079, 2078, 2077...
Answer

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) ...

asked 5xavg 6 marks · 2081, 2080, 2078, 2077
Answer

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}$$

asked 4xavg 8 marks · 2080, 2078, 2077, 2075
Answer

Factorise the following matrix using Cholesky method. $$\begin{bmatrix} 2 & 1 & 1 \ 3 & 2 & 3 \ 1 & 4 & 9 \end{bmatrix}$$ [5]

$$A = \begin{bmatrix} 2 & 1 & 1 \ 3 & 2 & 3 \ 1 & 4 & 9 \end{bmatrix}$$ Cholesky's method requires the matrix to be symmetric (and positive definite), factorising it as: $$A = L L^T$$ where $L$ is lower triangular. The given matrix is ...

asked 4xavg 5 marks · 2081, 2080, 2079, 2077
Answer

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.

asked 3xavg 10 marks · 2080, 2079, 2075
Answer

How secant methods differs from Newton Raphson method? Derive the formula for Secant Method. Solve the equation using Secant method. Assume error precision as 0.01. Discuss the drawbacks of the Newton Raphson method.cos⁡x+2sin⁡x−x2=0\cos x + 2\sin x - x^2 = 0cosx+2sinx−x2=0_[10]_

  • Equation: $f(x) = \cos x + 2\sin x - x^2 = 0$ - Error precision (tolerance): $E = 0.01$ - Initial guesses: not specified in question. I choose $x0 = 1$, $x1 = 2$ (bracketing the root, angles in radians). Feature Newton-Raphson Secant -...
asked 3xavg 5 marks · 2080, 2079, 2078
Answer

Define the terms approximate error and relative approximate error? Discuss the working of Half Interval method for finding the roots of non-linear equation. [5]

--- Approximate Error is the difference between the current approximation and the previous approximation of a root. It gives an estimate of how much the solution has changed between two successive iterations. $$Ea = x{new} - x{old}$$ Sin...

asked 3xavg 5 marks · 2080, 2079, 2078
Answer

Write down the program for solving ordinary differential equation using Heun's method. [5]

Heun's method is a predictor-corrector method (also called the improved Euler's method) for solving ODEs of the form: $$\frac{dy}{dx} = f(x, y), \quad y(x0) = y0$$ The core formula is: $$y{n+1} = yn + \frac{h}{2}(m1 + m2)$$ Where: - $m1 ...

asked 3xavg 8 marks · 2081, 2077, 2075
Answer

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$$

asked 3xavg 7 marks · 2081, 2080, 2078
Answer

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.

asked 3xavg 7 marks · 2081, 2079, 2078
Answer

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}$
asked 3xavg 5 marks · 2081, 2079, 2075
Answer

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.

asked 2xavg 10 marks · 2079, 2077
Answer

What is pivoting? Why is it necessary? Write an algorithm and program to solve the set of n linear equations using Gaussian elimination method.[10]

Pivoting is the process of rearranging (swapping) rows (or columns) of an augmented matrix during Gaussian elimination so that the element used as the divisor (pivot element) in each forward elimination step is the largest possible value...

asked 2xavg 5 marks · 2079, 2078
Answer

What is fixed point iteration method? How can it converge to the root of a non-linear equation? Also explain the diverging cases with suitable examples. [5]

In the Fixed Point Iteration Method, we rearrange the non-linear equation f(x) = 0 such that x is isolated on the left-hand side of the equation. The rearranged form is expressed as: $$x = g(x) \quad \cdots (1)$$ Since f(x) = 0 and x = g...

asked 2xavg 5 marks · 2079, 2075
Answer

Solve the following set of equations using Gauss Siedal method.

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

[5]

Gauss-Seidel Method

STEP 1 - EXTRACT: Given Data

The system of equations: $$x + 2y + 3z = 4 \quad \text{...(1)}$$ $$6x + 4y + 5z = 16 \quad \text{...(2)}$$ $$5x + 2y + 3z = 12 \quad \text{...(3)}$$

Initial guess (standard assumption): $x^{(0)} = y^{(0)} = z^{(0)} = 0$.

STEP 2 - SOLVE

Analysis of Diagonal Dominance

For Gauss-Seidel to converge reliably, we should try to arrange the largest coefficients on the diagonal. Let me examine:

  • Coefficient of $x$: largest in (2) and (3), both equal to 6 and 5.
  • Coefficient of $y$: largest is 4 (in eq 2).
  • Coefficient of $z$: largest is 5 (in eq 2).

The largest coefficients cluster in equation (2), so a clean diagonally dominant arrangement is not possible. This is a poorly conditioned system for Gauss-Seidel. However, following the standard exam approach (partial pivoting), we rearrange to place the largest coefficient in each row on the diagonal.

Rearranged system:

$$6x + 4y + 5z = 16 \Rightarrow x = \frac{16 - 4y - 5z}{6}$$ $$5x + 2y + 3z = 12 \Rightarrow y = \frac{12 - 5x - 3z}{2}$$ $$x + 2y + 3z = 4 \Rightarrow z = \frac{4 - x - 2y}{3}$$

Iteration 1 (from $x=y=z=0$)

$$x = \frac{16 - 0 - 0}{6} = 2.6667$$ $$y = \frac{12 - 5(2.6667) - 0}{2} = \frac{12 - 13.3333}{2} = -0.6667$$ $$z = \frac{4 - 2.6667 - 2(-0.6667)}{3} = \frac{4 - 2.6667 + 1.3333}{3} = \frac{2.6667}{3} = 0.8889$$

Iteration 2

$$x = \frac{16 - 4(-0.6667) - 5(0.8889)}{6} = \frac{16 + 2.6667 - 4.4444}{6} = \frac{14.2222}{6} = 2.3704$$ $$y = \frac{12 - 5(2.3704) - 3(0.8889)}{2} = \frac{12 - 11.8519 - 2.6667}{2} = \frac{-2.5185}{2} = -1.2593$$ $$z = \frac{4 - 2.3704 - 2(-1.2593)}{3} = \frac{4 - 2.3704 + 2.5185}{3} = \frac{4.1481}{3} = 1.3827$$

Iteration 3

$$x = \frac{16 - 4(-1.2593) - 5(1.3827)}{6} = \frac{16 + 5.0370 - 6.9136}{6} = \frac{14.1235}{6} = 2.3539$$ $$y = \frac{12 - 5(2.3539) - 3(1.3827)}{2} = \frac{12 - 11.7696 - 4.1481}{2} = \frac{-3.9177}{2} = -1.9588$$ $$z = \frac{4 - 2.3539 - 2(-1.9588)}{3} = \frac{4 - 2.3539 + 3.9177}{3} = \frac{5.5638}{3} = 1.8546$$

Iteration 4 (check on convergence)

$$x = \frac{16 - 4(-1.9588) - 5(1.8546)}{6} = \frac{16 + 7.8353 - 9.2730}{6} = \frac{14.5623}{6} = 2.4270$$ $$y = \frac{12 - 5(2.4270) - 3(1.8546)}{2} = \frac{12 - 12.1352 - 5.5638}{2} = \frac{-5.6990}{2} = -2.8495$$ $$z = \frac{4 - 2.4270 - 2(-2.8495)}{3} = \frac{4 - 2.4270 + 5.6990}{3} = \frac{7.2720}{3} = 2.4240$$

Summary Table

Iteration$x$$y$$z$
0000
12.6667-0.66670.8889
22.3704-1.25931.3827
32.3539-1.95881.8546
42.4270-2.84952.4240

Important Observation on Convergence

The iterates are diverging, not converging. The values of $y$ move $-0.67 \to -1.26 \to -1.96 \to -2.85$ and $z$ moves $0.89 \to 1.38 \to 1.85 \to 2.42$; the gaps are growing, not shrinking. This confirms the earlier note that the system is not diagonally dominant and no rearrangement makes it so, so Gauss-Seidel does not converge here.

Exact solution (by direct elimination, subtracting (1) from (3): $4x = 8 \Rightarrow x = 2$; then $2y + 3z = 2$ and $4y + 5z = 4$, giving $y = -1,\ z = ...$). Solving:

  • From $4x=8$: $x = 2$.
  • $2y + 3z = 4 - 2 = 2$.
  • $4y + 5z = 16 - 12 = 4$.
  • Multiply first by 2: $4y + 6z = 4$; subtract: $z = 0$, then $2y = 2 \Rightarrow y = 1$.

So the true solution is $x = 2,\ y = 1,\ z = 0$. The Gauss-Seidel iterates ($x\approx 2.4,\ y\approx -2.8,\ z\approx 2.4$) are moving away from this, confirming divergence.

Final Result

The iterations up to iteration 3 and 4 are as tabulated. The method does not converge here: the iterates move away from the exact solution $x=2,\ y=1,\ z=0$, so any claim that it settles near $x=2,\ y=-2,\ z=2$ would be wrong.

asked 2xavg 8 marks · 2078, 2077
Answer

How can Horner’s rule be used to evaluate the f(x) and f(x) of a polynomial at a given point? Explain. Write an algorithm and program to calculate a real root of a polynomial using Horner’s rule.[10]

Horner's rule is an efficient scheme for evaluating a polynomial and its derivative at a point by rewriting the polynomial in nested form. It is closely related to synthetic division and the Remainder Theorem. For a polynomial of degree ...

Study every one of these with model answers, flashcards, and MCQs.

Open CSC212 study modes