Skip to main content

Chapter 4

Numerical Method

TU BCA past exam questions

Past questions and answers

59 questions set from this chapter, 2 of them more than once; 5 are most repeated (set, or a close variant set, in 3 or more exams). Most repeated first.

  • Most repeated · 4 of 8 exams
  • Asked 3 times
  • 2020 · 5 marks
  • 2021 · 5 marks
  • 2025 · 5 marks

Solve the Poisson equation ∇2f=2x2y2\nabla^2 f = 2x^2 y^2 over the square domain 0≤x≤30 \leq x \leq 3 and 0≤y≤30 \leq y \leq 3 with f=0f = 0 on the boundary and h=1h = 1.

Similar questions: Solve the Poisson equation $\Delta^2 f = (2022)

Answer

With h=1h = 1 the interior grid points are (1,1),(2,1),(1,2),(2,2)(1,1), (2,1), (1,2), (2,2). Let f11=a, f21=b, f12=c, f22=df_{11} = a,\ f_{21} = b,\ f_{12} = c,\ f_{22} = d. All boundary values are 00.

The five-point formula is

fi+1,j+fi−1,j+fi,j+1+fi,j−1−4fi,j=h2g(xi,yj),g=2x2y2f_{i+1,j} + f_{i-1,j} + f_{i,j+1} + f_{i,j-1} - 4f_{i,j} = h^2 g(x_i, y_j), \qquad g = 2x^2y^2

Right-hand sides: g(1,1)=2, g(2,1)=8, g(1,2)=8, g(2,2)=32g(1,1) = 2,\ g(2,1) = 8,\ g(1,2) = 8,\ g(2,2) = 32.

(1,1):−4a+b+c=2(2,1):a−4b+d=8(1,2):a−4c+d=8(2,2):b+c−4d=32\begin{aligned} (1,1):&\quad -4a + b + c = 2\\ (2,1):&\quad a - 4b + d = 8\\ (1,2):&\quad a - 4c + d = 8\\ (2,2):&\quad b + c - 4d = 32 \end{aligned}

Equations 2 and 3 give b=cb = c. Then −4a+2b=2,a−4b+d=8,2b−4d=32-4a + 2b = 2,\qquad a - 4b + d = 8,\qquad 2b - 4d = 32

From the first, a=(2b−2)/4=(b−1)/2a = (2b-2)/4 = (b-1)/2. In the second, (b−1)/2−4b+d=8⇒−3.5b+d=8.5(b-1)/2 - 4b + d = 8 \Rightarrow -3.5b + d = 8.5. From the third, d=(b−16)/2d = (b-16)/2, so −3.5b+0.5b−8=8.5⇒−3b=16.5⇒b=−5.5-3.5b + 0.5b - 8 = 8.5 \Rightarrow -3b = 16.5 \Rightarrow b = -5.5.

Hence b=c=−5.5,d=−5.5−162=−10.75,a=−5.5−12=−3.25b = c = -5.5,\quad d = \frac{-5.5 - 16}{2} = -10.75,\quad a = \frac{-5.5-1}{2} = -3.25

f(1,1)=−3.25,f(2,1)=f(1,2)=−5.5,f(2,2)=−10.75f(1,1) = -3.25,\quad f(2,1) = f(1,2) = -5.5,\quad f(2,2) = -10.75

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Most repeated · 4 of 8 exams
  • 2022 · 5 marks

Solve the Poisson equation Δ2f=2x2y2\Delta^2 f = 2x^2 y^2 over the square domain 0≤x≤3and0≤y≤30 \leq x \leq 3 \quad \text{and} \quad 0 \leq y \leq 3 with f=0on the boundary andh=1.f = 0 \quad \text{on the boundary and} \quad h = 1.

Similar questions: Solve the Poisson equation $\nabla^2 f = (2025)

Answer

With h=1h = 1 the interior grid points are (1,1),(2,1),(1,2),(2,2)(1,1), (2,1), (1,2), (2,2). Let f11=a, f21=b, f12=c, f22=df_{11} = a,\ f_{21} = b,\ f_{12} = c,\ f_{22} = d. All boundary values are 00.

The five-point formula is

fi+1,j+fi−1,j+fi,j+1+fi,j−1−4fi,j=h2g(xi,yj),g=2x2y2f_{i+1,j} + f_{i-1,j} + f_{i,j+1} + f_{i,j-1} - 4f_{i,j} = h^2 g(x_i, y_j), \qquad g = 2x^2y^2

Right-hand sides: g(1,1)=2, g(2,1)=8, g(1,2)=8, g(2,2)=32g(1,1) = 2,\ g(2,1) = 8,\ g(1,2) = 8,\ g(2,2) = 32.

(1,1):−4a+b+c=2(2,1):a−4b+d=8(1,2):a−4c+d=8(2,2):b+c−4d=32\begin{aligned} (1,1):&\quad -4a + b + c = 2\\ (2,1):&\quad a - 4b + d = 8\\ (1,2):&\quad a - 4c + d = 8\\ (2,2):&\quad b + c - 4d = 32 \end{aligned}

Equations 2 and 3 give b=cb = c. Then −4a+2b=2,a−4b+d=8,2b−4d=32-4a + 2b = 2,\qquad a - 4b + d = 8,\qquad 2b - 4d = 32

From the first, a=(2b−2)/4=(b−1)/2a = (2b-2)/4 = (b-1)/2. In the second, (b−1)/2−4b+d=8⇒−3.5b+d=8.5(b-1)/2 - 4b + d = 8 \Rightarrow -3.5b + d = 8.5. From the third, d=(b−16)/2d = (b-16)/2, so −3.5b+0.5b−8=8.5⇒−3b=16.5⇒b=−5.5-3.5b + 0.5b - 8 = 8.5 \Rightarrow -3b = 16.5 \Rightarrow b = -5.5.

Hence b=c=−5.5,d=−5.5−162=−10.75,a=−5.5−12=−3.25b = c = -5.5,\quad d = \frac{-5.5 - 16}{2} = -10.75,\quad a = \frac{-5.5-1}{2} = -3.25

f(1,1)=−3.25,f(2,1)=f(1,2)=−5.5,f(2,2)=−10.75f(1,1) = -3.25,\quad f(2,1) = f(1,2) = -5.5,\quad f(2,2) = -10.75

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Most repeated · 3 of 8 exams
  • 2020 · 5 marks

Solve the following set of equations using Gauss-Jordan Method.
3x−5y+2z=153x-5y+2z=15
4xy+z=24xy+z=2
x−3y+7z=22x-3y+7z=22

Similar questions: Solve the following set of linear equations (2026) · Solve the following equations by using Gauss-Jordan (2024)

Answer

The second equation is read as 4x−y+z=24x - y + z = 2.

Augmented matrix:

[3−52154−1121−3722]\left[\begin{array}{ccc|c} 3 & -5 & 2 & 15 \\ 4 & -1 & 1 & 2 \\ 1 & -3 & 7 & 22 \end{array}\right]

Swap R1↔R3R_1 \leftrightarrow R_3 to get a pivot of 1:

[1−37224−1123−5215]\left[\begin{array}{ccc|c} 1 & -3 & 7 & 22 \\ 4 & -1 & 1 & 2 \\ 3 & -5 & 2 & 15 \end{array}\right]

R2→R2−4R1, R3→R3−3R1R_2 \to R_2 - 4R_1,\ R_3 \to R_3 - 3R_1:

[1−3722011−27−8604−19−51]\left[\begin{array}{ccc|c} 1 & -3 & 7 & 22 \\ 0 & 11 & -27 & -86 \\ 0 & 4 & -19 & -51 \end{array}\right]

R2→R2/11R_2 \to R_2/11:

[1−372201−27/11−86/1104−19−51]\left[\begin{array}{ccc|c} 1 & -3 & 7 & 22 \\ 0 & 1 & -27/11 & -86/11 \\ 0 & 4 & -19 & -51 \end{array}\right]

R1→R1+3R2, R3→R3−4R2R_1 \to R_1 + 3R_2,\ R_3 \to R_3 - 4R_2:

[10−4/11−16/1101−27/11−86/1100−101/11−217/11]\left[\begin{array}{ccc|c} 1 & 0 & -4/11 & -16/11 \\ 0 & 1 & -27/11 & -86/11 \\ 0 & 0 & -101/11 & -217/11 \end{array}\right]

R3→−11101R3R_3 \to -\tfrac{11}{101}R_3 gives z=217/101z = 217/101. Then R1→R1+411R3, R2→R2+2711R3R_1 \to R_1 + \tfrac{4}{11}R_3,\ R_2 \to R_2 + \tfrac{27}{11}R_3:

[100−68/101010−257/101001217/101]\left[\begin{array}{ccc|c} 1 & 0 & 0 & -68/101 \\ 0 & 1 & 0 & -257/101 \\ 0 & 0 & 1 & 217/101 \end{array}\right]

x=−68101≈−0.6733,y=−257101≈−2.5446,z=217101≈2.1485x = -\frac{68}{101} \approx -0.6733,\quad y = -\frac{257}{101} \approx -2.5446,\quad z = \frac{217}{101} \approx 2.1485

Check in the first equation: 3(−0.6733)−5(−2.5446)+2(2.1485)=−2.020+12.723+4.297=15.03(-0.6733) - 5(-2.5446) + 2(2.1485) = -2.020 + 12.723 + 4.297 = 15.0.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Most repeated · 3 of 8 exams
  • 2024 · 5 marks

Solve the following equations by using Gauss-Jordan method.
2x+3y+4z=5   3x+4y+5z=6  4x+5y+6z=7

Similar questions: Solve the following set of equations using (2020) · Solve the following set of linear equations (2026)

Answer

[234534564567]\left[\begin{array}{ccc|c} 2 & 3 & 4 & 5 \\ 3 & 4 & 5 & 6 \\ 4 & 5 & 6 & 7 \end{array}\right]

R1→R1/2R_1 \to R_1/2:

[11.522.534564567]\left[\begin{array}{ccc|c} 1 & 1.5 & 2 & 2.5 \\ 3 & 4 & 5 & 6 \\ 4 & 5 & 6 & 7 \end{array}\right]

R2→R2−3R1, R3→R3−4R1R_2 \to R_2 - 3R_1,\ R_3 \to R_3 - 4R_1:

[11.522.50−0.5−1−1.50−1−2−3]\left[\begin{array}{ccc|c} 1 & 1.5 & 2 & 2.5 \\ 0 & -0.5 & -1 & -1.5 \\ 0 & -1 & -2 & -3 \end{array}\right]

R2→−2R2R_2 \to -2R_2:

[11.522.501230−1−2−3]\left[\begin{array}{ccc|c} 1 & 1.5 & 2 & 2.5 \\ 0 & 1 & 2 & 3 \\ 0 & -1 & -2 & -3 \end{array}\right]

R1→R1−1.5R2, R3→R3+R2R_1 \to R_1 - 1.5R_2,\ R_3 \to R_3 + R_2:

[10−1−201230000]\left[\begin{array}{ccc|c} 1 & 0 & -1 & -2 \\ 0 & 1 & 2 & 3 \\ 0 & 0 & 0 & 0 \end{array}\right]

The rank of AA and of the augmented matrix are both 2<32 < 3, so the system is consistent but has infinitely many solutions. Taking z=tz = t:

x=t−2,y=3−2t,z=tx = t - 2,\qquad y = 3 - 2t,\qquad z = t

Check in the first equation: 2(t−2)+3(3−2t)+4t=2t−4+9−6t+4t=52(t-2) + 3(3-2t) + 4t = 2t - 4 + 9 - 6t + 4t = 5. ✓ (For example t=0t = 0 gives (−2,3,0)(-2, 3, 0) and t=1t = 1 gives (−1,1,1)(-1, 1, 1).)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Most repeated · 3 of 8 exams
  • 2026 · 5 marks

Solve the following set of linear equations using Gauss Jordan method:
x + y + z = 6
2x + 3y + z = 10
x + 2y + 3z = 13

Similar questions: Solve the following set of equations using (2020) · Solve the following equations by using Gauss-Jordan (2024)

Answer

Augmented matrix:

[11162311012313]\left[\begin{array}{ccc|c}1&1&1&6\\2&3&1&10\\1&2&3&13\end{array}\right]

R2→R2−2R1R_2\to R_2-2R_1, R3→R3−R1R_3\to R_3-R_1:

[111601−1−20127]\left[\begin{array}{ccc|c}1&1&1&6\\0&1&-1&-2\\0&1&2&7\end{array}\right]

Eliminate yy above and below the second pivot: R1→R1−R2R_1\to R_1-R_2, R3→R3−R2R_3\to R_3-R_2:

[102801−1−20039]\left[\begin{array}{ccc|c}1&0&2&8\\0&1&-1&-2\\0&0&3&9\end{array}\right]

R3→R3/3R_3\to R_3/3 gives z=3z=3. Then R1→R1−2R3R_1\to R_1-2R_3, R2→R2+R3R_2\to R_2+R_3:

[100201010013]\left[\begin{array}{ccc|c}1&0&0&2\\0&1&0&1\\0&0&1&3\end{array}\right]

Solution: x=2,  y=1,  z=3x=2,\;y=1,\;z=3. Check: 2+1+3=62+1+3=6, 4+3+3=104+3+3=10, 2+2+9=132+2+9=13.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Asked 2 times
  • 2021 · 10 marks
  • 2023 · 10 marks

Write an algorithm and program to compute root of nonlinear equation using bisection method.

Answer

Bisection method. If ff is continuous on [a,b][a, b] and f(a)f(b)<0f(a)f(b) < 0, a root lies in (a,b)(a, b). Repeatedly halve the interval and keep the half where the sign change persists.

Algorithm

  1. Define f(x)f(x). Read aa, bb, tolerance ε\varepsilon and maximum iterations NN.
  2. If f(a)⋅f(b)>0f(a)\cdot f(b) > 0, print "invalid interval" and stop.
  3. Repeat for i=1i = 1 to NN:
    1. c=(a+b)/2c = (a + b)/2.
    2. If f(c)=0f(c) = 0 or (b−a)/2<ε(b - a)/2 < \varepsilon, print cc as the root and stop.
    3. If f(a)⋅f(c)<0f(a)\cdot f(c) < 0 set b=cb = c, else set a=ca = c.
  4. Print cc as the approximate root.

Program (C)

#include <stdio.h>
#include <math.h>

double f(double x) {
    return x * x * x - 4 * x + 1;      /* change as required */
}

int main() {
    double a, b, c, eps;
    int i, maxit;

    printf("Enter a, b, tolerance and max iterations: ");
    scanf("%lf %lf %lf %d", &a, &b, &eps, &maxit);

    if (f(a) * f(b) > 0) {
        printf("Root is not bracketed in [a, b]\n");
        return 1;
    }

    for (i = 1; i <= maxit; i++) {
        c = (a + b) / 2;
        printf("Iter %d: c = %.6f, f(c) = %.6f\n", i, c, f(c));
        if (f(c) == 0 || (b - a) / 2 < eps)
            break;
        if (f(a) * f(c) < 0)
            b = c;
        else
            a = c;
    }
    printf("Approximate root = %.6f\n", c);
    return 0;
}

The number of iterations needed for error below ε\varepsilon is n≥log⁡2 ⁣((b−a)/ε)n \ge \log_2\!\big((b-a)/\varepsilon\big).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2020 · 5 marks

Why is the study of errors important to a computational scientist? Differentiate between inherent and numerical errors.

Answer

Why errors matter. Almost every numerical computation gives an approximate answer. A computational scientist must know where the error comes from, how large it is and how it grows, because:

  • the reliability of a result depends on its error bound; a result without an error estimate is of little use;
  • errors can accumulate over thousands of operations and make a stable-looking program give nonsense;
  • it guides the choice of algorithm, step size, number of iterations and precision needed;
  • it tells us when to stop an iterative method (tolerance) and how to avoid ill-conditioned or unstable formulations.

Inherent errors are errors already present in the input data before the computation begins. They arise from measurement limits, imperfect instruments, or from the mathematical model/data being approximated (for example taking π=3.14\pi = 3.14 or a measured length of 5.65.6 cm). Their size is fixed by the data and cannot be reduced by a better algorithm, only by better data.

Numerical errors are introduced by the computation itself. They consist of:

  • Round-off error: caused by representing numbers with a finite number of digits, e.g. 1/3=0.33331/3 = 0.3333.
  • Truncation error: caused by replacing an infinite process by a finite one, e.g. cutting a Taylor series after a few terms or replacing a derivative by a finite difference.
Inherent errorNumerical error
Present in the data before the calculationArises during the calculation
Due to measurement / modellingDue to round-off and truncation
Cannot be reduced by the methodCan be reduced by a better method or higher precision

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2020 · 5 marks

Find the root of equation x2+4x−10=0x^2 + 4x - 10 = 0 using bisection method where root lies between 5 and 6.

Answer

Let f(x)=x2+4x−10f(x) = x^2 + 4x - 10.

At the given end points f(5)=35>0f(5) = 35 > 0 and f(6)=62>0f(6) = 62 > 0. There is no sign change, so no root lies in [5,6][5, 6] (the actual roots are −2±14≈1.7417, −5.7417-2 \pm \sqrt{14} \approx 1.7417,\ -5.7417). The bisection method needs a sign change, so the interval is corrected to [1,2][1, 2], where f(1)=−5<0f(1) = -5 < 0 and f(2)=2>0f(2) = 2 > 0.

Midpoint c=(a+b)/2c = (a+b)/2; keep the half in which the sign changes.

nabcf(c)
1121.5-1.7500
21.521.750.0625
31.51.751.625-0.8594
41.6251.751.6875-0.4023
51.68751.751.71875-0.1709
61.718751.751.734375-0.0544
71.7343751.751.74218750.0040
81.7343751.74218751.73828-0.0253

The root is approximately x≈1.74x \approx 1.74 (exact value −2+14=1.7417-2+\sqrt{14} = 1.7417).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2020 · 5 marks

Find the square root of 3,5 using second order Lagrange interpolation polynomial using the following data table. x12345f(x)11.41421.732122.2361\begin{array}{c|cccc} x & 1 & 2 & 3 & 4 & 5 \\ \hline f(x) & 1 & 1.4142 & 1.7321 & 2 & 2.2361 \\ \end{array}

Answer

The table is f(x)=xf(x) = \sqrt{x}, so we want 3.5\sqrt{3.5}. For second order (three points) Lagrange interpolation choose the points nearest to x=3.5x = 3.5: x0=2, x1=3, x2=4x_0 = 2,\ x_1 = 3,\ x_2 = 4 with f0=1.4142, f1=1.7321, f2=2f_0 = 1.4142,\ f_1 = 1.7321,\ f_2 = 2.

P2(x)=(x−x1)(x−x2)(x0−x1)(x0−x2)f0+(x−x0)(x−x2)(x1−x0)(x1−x2)f1+(x−x0)(x−x1)(x2−x0)(x2−x1)f2P_2(x) = \frac{(x-x_1)(x-x_2)}{(x_0-x_1)(x_0-x_2)}f_0 + \frac{(x-x_0)(x-x_2)}{(x_1-x_0)(x_1-x_2)}f_1 + \frac{(x-x_0)(x-x_1)}{(x_2-x_0)(x_2-x_1)}f_2

At x=3.5x = 3.5:

L0=(0.5)(−0.5)(−1)(−2)=−0.125,L1=(1.5)(−0.5)(1)(−1)=0.75,L2=(1.5)(0.5)(2)(1)=0.375L_0 = \frac{(0.5)(-0.5)}{(-1)(-2)} = -0.125,\quad L_1 = \frac{(1.5)(-0.5)}{(1)(-1)} = 0.75,\quad L_2 = \frac{(1.5)(0.5)}{(2)(1)} = 0.375

(check: L0+L1+L2=1L_0+L_1+L_2 = 1)

P2(3.5)=−0.125(1.4142)+0.75(1.7321)+0.375(2)=−0.17678+1.29908+0.75=1.8723P_2(3.5) = -0.125(1.4142) + 0.75(1.7321) + 0.375(2) = -0.17678 + 1.29908 + 0.75 = 1.8723

So 3.5≈1.8723\sqrt{3.5} \approx 1.8723 (true value 1.87081.8708).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2020 · 5 marks

Write a program to calculate the integral using Trapezoidal Rule.

Answer

Trapezoidal rule: divide [a,b][a, b] into nn equal parts of width h=(b−a)/nh = (b-a)/n:

∫abf(x) dx≈h2[f(x0)+2∑i=1n−1f(xi)+f(xn)]\int_a^b f(x)\,dx \approx \frac{h}{2}\left[f(x_0) + 2\sum_{i=1}^{n-1} f(x_i) + f(x_n)\right]

Program (C) for ∫abf(x) dx\int_a^b f(x)\,dx with f(x)=x2+1f(x) = x^2 + 1 as an example function:

#include <stdio.h>
#include <math.h>

double f(double x) {
    return x * x + 1;          /* change to the required function */
}

int main() {
    double a, b, h, sum, result;
    int n, i;

    printf("Enter lower limit a, upper limit b: ");
    scanf("%lf %lf", &a, &b);
    printf("Enter number of sub-intervals n: ");
    scanf("%d", &n);

    h = (b - a) / n;
    sum = f(a) + f(b);
    for (i = 1; i < n; i++)
        sum += 2 * f(a + i * h);

    result = (h / 2) * sum;
    printf("Integral = %.6f\n", result);
    return 0;
}

For a=0, b=1, n=10a=0,\ b=1,\ n=10 the program prints 1.3350001.335000 (exact 4/34/3).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2020 · 5 marks

Use classical Runge-Kutta method to estimate y(0.2)y(0.2) when y′(x)=x2+y2y'(x) = x^2 + y^2 with y(0)=0y(0) = 0 and h=0.2h = 0.2.

Answer

Here f(x,y)=x2+y2f(x, y) = x^2 + y^2, x0=0x_0 = 0, y0=0y_0 = 0, h=0.2h = 0.2.

k1=f(x0,y0)=0k_1 = f(x_0, y_0) = 0 k2=f ⁣(x0+h2, y0+h2k1)=f(0.1,0)=0.01k_2 = f\!\left(x_0 + \tfrac h2,\ y_0 + \tfrac h2 k_1\right) = f(0.1, 0) = 0.01 k3=f ⁣(x0+h2, y0+h2k2)=f(0.1,0.001)=0.01+0.000001=0.010001k_3 = f\!\left(x_0 + \tfrac h2,\ y_0 + \tfrac h2 k_2\right) = f(0.1, 0.001) = 0.01 + 0.000001 = 0.010001 k4=f(x0+h, y0+hk3)=f(0.2,0.0020002)=0.04+0.000004=0.040004k_4 = f(x_0 + h,\ y_0 + h k_3) = f(0.2, 0.0020002) = 0.04 + 0.000004 = 0.040004

y(0.2)=y0+h6(k1+2k2+2k3+k4)=0.26(0+0.02+0.020002+0.040004)y(0.2) = y_0 + \frac h6\left(k_1 + 2k_2 + 2k_3 + k_4\right) = \frac{0.2}{6}\left(0 + 0.02 + 0.020002 + 0.040004\right)

y(0.2)=0.26(0.080006)≈0.002667y(0.2) = \frac{0.2}{6}(0.080006) \approx 0.002667

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2020 · 10 marks

a) Factorize the matrix 123232232282\begin{array}{|c c c|} 1 & 2 & 3 \\ 2 & 3 & 22 \\ 3 & 22 & 82 \\ \end{array} Using Cholesky's method.
b) Locate the root of equation x2+x−2x^2 + x - 2 using the fixed point method.

Answer

(a) Cholesky's method factorizes a symmetric positive definite matrix as A=LLTA = LL^T. First check the pivots.

A=[123232232282]A = \begin{bmatrix} 1 & 2 & 3 \\ 2 & 3 & 22 \\ 3 & 22 & 82 \end{bmatrix}

l11=1=1,l21=2/1=2,l31=3/1=3l_{11} = \sqrt{1} = 1,\quad l_{21} = 2/1 = 2,\quad l_{31} = 3/1 = 3

l222=a22−l212=3−4=−1<0l_{22}^2 = a_{22} - l_{21}^2 = 3 - 4 = -1 < 0

The second leading minor is 1⋅3−2⋅2=−1<01\cdot 3 - 2\cdot 2 = -1 < 0, so AA is not positive definite and a real Cholesky factor LLTLL^T does not exist. It can be completed only with complex entries, l22=il_{22} = i:

l32=22−3⋅2i=−16i,l332=82−9−(−16i)2=73+256=329, l33=329≈18.14l_{32} = \frac{22 - 3\cdot 2}{i} = -16i,\quad l_{33}^2 = 82 - 9 - (-16i)^2 = 73 + 256 = 329,\ l_{33} = \sqrt{329} \approx 18.14

(Sign of l32l_{32}: l32 l22=16⇒l32=16/i=−16il_{32}\,l_{22} = 16 \Rightarrow l_{32} = 16/i = -16i.)

Equivalently, in real arithmetic, A=LDLTA = LDL^T with L=[1002103−161],D=diag(1, −1, 329)L = \begin{bmatrix}1&0&0\\2&1&0\\3&-16&1\end{bmatrix},\quad D = \mathrm{diag}(1,\,-1,\,329) The negative entry in DD confirms AA is indefinite.

(b) x2+x−2=0x^2 + x - 2 = 0 (roots 11 and −2-2). Rewrite in the form x=g(x)x = g(x):

x=g(x)=2−xx = g(x) = \sqrt{2 - x}

Convergence needs ∣g′(x)∣<1|g'(x)| < 1 near the root: g′(x)=−122−xg'(x) = -\dfrac{1}{2\sqrt{2-x}}, and ∣g′(1)∣=0.5<1|g'(1)| = 0.5 < 1, so the iteration converges to x=1x = 1. (The form x=2−x2x = 2 - x^2 has ∣g′(1)∣=2|g'(1)| = 2 and diverges.)

Take x0=0.5x_0 = 0.5 and iterate xn+1=2−xnx_{n+1} = \sqrt{2 - x_n}:

nxnx_n
11.22474
20.88049
31.05807
40.97053
51.01463
60.99266
71.00366
80.99817
91.00092
100.99954

The values oscillate about and approach x≈1.00x \approx 1.00, so the root is x=1x = 1.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2020 · 10 marks

Given the data points:
ii012
xix_i234
fif_i4916
Estimate the function value ff at x=2.5x = 2.5 using cubic splines.

Answer

Data: (x0,f0)=(2,4), (x1,f1)=(3,9), (x2,f2)=(4,16)(x_0, f_0) = (2, 4),\ (x_1, f_1) = (3, 9),\ (x_2, f_2) = (4, 16), with h=1h = 1. Use the natural cubic spline (M0=M2=0M_0 = M_2 = 0), where Mi=S′′(xi)M_i = S''(x_i).

For the interior node:

hM0+2(h+h)M1+hM2=6[f2−f1h−f1−f0h]h M_0 + 2(h + h)M_1 + h M_2 = 6\left[\frac{f_2 - f_1}{h} - \frac{f_1 - f_0}{h}\right]

4M1=6 [ 7−5 ]=12⇒M1=34M_1 = 6\,[\,7 - 5\,] = 12 \Rightarrow M_1 = 3

On [x0,x1]=[2,3][x_0, x_1] = [2, 3]:

S(x)=M0(x1−x)3+M1(x−x0)36h+(f0h−M0h6)(x1−x)+(f1h−M1h6)(x−x0)S(x) = \frac{M_0 (x_1 - x)^3 + M_1 (x - x_0)^3}{6h} + \left(\frac{f_0}{h} - \frac{M_0 h}{6}\right)(x_1 - x) + \left(\frac{f_1}{h} - \frac{M_1 h}{6}\right)(x - x_0)

S(x)=3(x−2)36+4(3−x)+8.5 (x−2)S(x) = \frac{3(x-2)^3}{6} + 4(3 - x) + 8.5\,(x - 2)

At x=2.5x = 2.5:

S(2.5)=3(0.5)36+4(0.5)+8.5(0.5)=0.0625+2+4.25=6.3125S(2.5) = \frac{3(0.5)^3}{6} + 4(0.5) + 8.5(0.5) = 0.0625 + 2 + 4.25 = 6.3125

So f(2.5)≈6.3125f(2.5) \approx 6.3125 (the true value of x2x^2 is 6.256.25).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2021 · 5 marks

Compute the root of equation x2−5x+6=0x^2 - 5x + 6 = 0 in the vicinity of x=5x = 5 using Newton-Raphson method.

Answer

f(x)=x2−5x+6,f′(x)=2x−5f(x) = x^2 - 5x + 6,\quad f'(x) = 2x - 5. Newton-Raphson formula:

xn+1=xn−f(xn)f′(xn)x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}

Start with x0=5x_0 = 5: f(5)=6, f′(5)=5f(5) = 6,\ f'(5) = 5.

nxnx_nf(xn)f(x_n)f′(xn)f'(x_n)xn+1x_{n+1}
05653.8
13.81.442.63.2462
23.24620.30981.49233.0406
33.04060.04461.08123.0015
43.00150.00151.00303.0000

The iteration converges to the root x=3x = 3 (the other root of (x−2)(x−3)=0(x-2)(x-3) = 0 is 22).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2021 · 5 marks

Write an algorithm to compute integration using Simpson's 1/3 rule. Evaluate integration of ∫03(3x2+2x−5) dx\int_0^3 (3x^2 + 2x - 5) \, dx using Simpson's 1/3 rule.

Answer

Algorithm (Simpson's 1/3 rule)

  1. Read aa, bb and an even number of sub-intervals nn.
  2. Compute h=(b−a)/nh = (b - a)/n.
  3. Set sum=f(a)+f(b)sum = f(a) + f(b).
  4. For i=1,2,…,n−1i = 1, 2, \dots, n-1: compute x=a+ihx = a + ih; if ii is odd add 4f(x)4f(x) to sumsum, otherwise add 2f(x)2f(x).
  5. Result I=h3 sumI = \dfrac{h}{3}\,sum.
  6. Print II and stop.

∫abf(x) dx≈h3[f0+4(f1+f3+… )+2(f2+f4+… )+fn]\int_a^b f(x)\,dx \approx \frac h3\left[f_0 + 4(f_1 + f_3 + \dots) + 2(f_2 + f_4 + \dots) + f_n\right]

Evaluation: f(x)=3x2+2x−5f(x) = 3x^2 + 2x - 5, a=0a = 0, b=3b = 3, take n=4n = 4, h=0.75h = 0.75.

x00.751.52.253
f(x)-5-1.81254.7514.687528
weight14241

I=0.753[−5+28+4(−1.8125+14.6875)+2(4.75)]=0.25 [23+51.5+9.5]=0.25×84=21I = \frac{0.75}{3}\left[-5 + 28 + 4(-1.8125 + 14.6875) + 2(4.75)\right] = 0.25\,[23 + 51.5 + 9.5] = 0.25 \times 84 = 21

Exact value: [x3+x2−5x]03=27+9−15=21[x^3 + x^2 - 5x]_0^3 = 27 + 9 - 15 = 21. Simpson's rule is exact for polynomials up to degree 3, so the result is exact.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2021 · 5 marks

What is meant by ill-conditioned system? Find the Cholesky decomposition of the following matrix: [411152123]\begin{bmatrix} 4 & 1 & 1 \\ 1 & 5 & 2 \\ 1 & 2 & 3 \end{bmatrix}

Answer

Ill-conditioned system. A linear system Ax=bAx = b is ill-conditioned if a very small change (or rounding error) in the coefficients or the right-hand side produces a large change in the solution. The coefficient matrix is then nearly singular: its determinant is close to zero relative to its entries and its condition number κ(A)=∥A∥ ∥A−1∥\kappa(A) = \|A\|\,\|A^{-1}\| is very large. Such systems give unreliable answers even with a stable algorithm.

Cholesky decomposition A=LLTA = LL^T (valid since AA is symmetric positive definite: leading minors 4, 19, 21>04,\ 19,\ 21 > 0):

l11=4=2,l21=12=0.5,l31=12=0.5l_{11} = \sqrt{4} = 2,\quad l_{21} = \frac{1}{2} = 0.5,\quad l_{31} = \frac12 = 0.5

l22=5−0.52=4.75=2.1794l_{22} = \sqrt{5 - 0.5^2} = \sqrt{4.75} = 2.1794

l32=2−(0.5)(0.5)2.1794=1.752.1794=0.8030l_{32} = \frac{2 - (0.5)(0.5)}{2.1794} = \frac{1.75}{2.1794} = 0.8030

l33=3−0.52−0.80302=3−0.25−0.6448=2.1052=1.4510l_{33} = \sqrt{3 - 0.5^2 - 0.8030^2} = \sqrt{3 - 0.25 - 0.6448} = \sqrt{2.1052} = 1.4510

L=[2000.52.179400.50.80301.4510],A=LLTL = \begin{bmatrix} 2 & 0 & 0 \\ 0.5 & 2.1794 & 0 \\ 0.5 & 0.8030 & 1.4510 \end{bmatrix},\qquad A = LL^T

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2021 · 5 marks

Use the classical RK method to estimate y(0.4)y(0.4) of the equation dydx=x2+y2\frac{dy}{dx} = x^2 + y^2 with y(0)=0y(0) = 0, assume h=0.2h = 0.2.

Answer

f(x,y)=x2+y2f(x, y) = x^2 + y^2, y(0)=0y(0) = 0, h=0.2h = 0.2. Two steps are needed.

Step 1 (x0=0, y0=0x_0 = 0,\ y_0 = 0):

k1=f(0,0)=0k_1 = f(0, 0) = 0

k2=f(0.1, 0)=0.01k_2 = f(0.1,\ 0) = 0.01

k3=f(0.1, 0.001)=0.010001k_3 = f(0.1,\ 0.001) = 0.010001

k4=f(0.2, 0.0020002)=0.040004k_4 = f(0.2,\ 0.0020002) = 0.040004

y1=y(0.2)=0+0.26 (0+0.02+0.020002+0.040004)=0.002667y_1 = y(0.2) = 0 + \frac{0.2}{6}\,(0 + 0.02 + 0.020002 + 0.040004) = 0.002667

Step 2 (x1=0.2, y1=0.002667x_1 = 0.2,\ y_1 = 0.002667):

k1=f(0.2, 0.002667)=0.04+0.0000071=0.040007k_1 = f(0.2,\ 0.002667) = 0.04 + 0.0000071 = 0.040007

k2=f(0.3, 0.002667+0.1(0.040007))=f(0.3, 0.006668)=0.09+0.0000445=0.090044k_2 = f(0.3,\ 0.002667 + 0.1(0.040007)) = f(0.3,\ 0.006668) = 0.09 + 0.0000445 = 0.090044

k3=f(0.3, 0.002667+0.1(0.090044))=f(0.3, 0.011671)=0.09+0.000136=0.090136k_3 = f(0.3,\ 0.002667 + 0.1(0.090044)) = f(0.3,\ 0.011671) = 0.09 + 0.000136 = 0.090136

k4=f(0.4, 0.002667+0.2(0.090136))=f(0.4, 0.020694)=0.16+0.000428=0.160428k_4 = f(0.4,\ 0.002667 + 0.2(0.090136)) = f(0.4,\ 0.020694) = 0.16 + 0.000428 = 0.160428

y2=y(0.4)=0.002667+0.26 (0.040007+0.180088+0.180272+0.160428)=0.002667+0.26(0.560795)y_2 = y(0.4) = 0.002667 + \frac{0.2}{6}\,(0.040007 + 0.180088 + 0.180272 + 0.160428) = 0.002667 + \frac{0.2}{6}(0.560795)

y(0.4)≈0.02136y(0.4) \approx 0.02136

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2021 · 5 marks

Write a short note on (Any Two):
a) Types of Errors
b) Convergent Methods
c) PDE

Answer

(a) Types of Errors

Errors in numerical computation are of the following kinds.

  • Inherent (data) errors: present in the input data because of measurement or modelling limits.
  • Round-off errors: arise because computers store numbers with a finite number of digits, e.g. π≈3.1416\pi \approx 3.1416.
  • Truncation errors: arise when an infinite process is replaced by a finite one, e.g. stopping a Taylor series after nn terms.
  • Blunders/gross errors: human mistakes such as wrong data entry or wrong formula.

They are measured as absolute error Ea=∣xtrue−xapprox∣E_a = |x_{true} - x_{approx}|, relative error Er=Ea/∣xtrue∣E_r = E_a/|x_{true}| and percentage error Er×100%E_r \times 100\%.

(b) Convergent Methods

An iterative method xn+1=g(xn)x_{n+1} = g(x_n) is convergent if the sequence x0,x1,x2,…x_0, x_1, x_2, \dots approaches the true root α\alpha as n→∞n \to \infty, i.e. ∣xn−α∣→0|x_n - \alpha| \to 0. For fixed-point iteration, convergence is guaranteed if ∣g′(x)∣<1|g'(x)| < 1 near the root. The speed is described by the order of convergence pp: ∣en+1∣≈C∣en∣p|e_{n+1}| \approx C|e_n|^p. Bisection converges linearly (p=1p = 1) but always, Secant has p≈1.618p \approx 1.618 and Newton-Raphson has p=2p = 2 (quadratic). Methods that do not satisfy these conditions diverge or oscillate.

(c) PDE

A partial differential equation contains the partial derivatives of an unknown function of two or more independent variables. The common second order linear types are:

  • Elliptic (Laplace ∇2u=0\nabla^2 u = 0, Poisson ∇2u=g(x,y)\nabla^2 u = g(x, y)),
  • Parabolic (heat equation ut=c uxxu_t = c\,u_{xx}),
  • Hyperbolic (wave equation utt=c2uxxu_{tt} = c^2 u_{xx}).

Numerically they are solved by replacing derivatives by finite differences on a grid, e.g. uxx≈ui+1,j−2ui,j+ui−1,jh2u_{xx} \approx \dfrac{u_{i+1,j} - 2u_{i,j} + u_{i-1,j}}{h^2}, and solving the resulting algebraic equations.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2021 · 10 marks

a) Solve the following system of equations using Gauss-Seidel method:
2x - 7y - 10z = -17
5x + y + 3z = 14
x + 10y + 9z = 7
b) Write an expansion of Taylor’s Theorem. Solve the equation: y′(x)=x2+y2,y(0)=1y'(x) = x^2 + y^2, \quad y(0) = 1 for x=0.5x = 0.5 using Taylor method.

Answer

(a) Gauss-Seidel method

The system is not diagonally dominant in the given order, so rearrange the equations (second equation first for xx, third for yy, first for zz):

x=14−y−3z5,y=7−x−9z10,z=17+2x−7y10x = \frac{14 - y - 3z}{5},\qquad y = \frac{7 - x - 9z}{10},\qquad z = \frac{17 + 2x - 7y}{10}

Start with (x,y,z)=(0,0,0)(x, y, z) = (0, 0, 0) and always use the latest values.

Iterxyz
12.80000.42001.9660
21.5364-1.22302.8634
31.3266-2.00973.3721
41.1787-2.45283.6527
51.0989-2.69733.8079
61.0547-2.83263.8938
81.0167-2.94883.9675
121.0016-2.99523.9970

The iterates converge (slowly, because the dominance is weak) to the exact solution

x=1,y=−3,z=4x = 1,\quad y = -3,\quad z = 4

Check: 2(1)−7(−3)−10(4)=−172(1) - 7(-3) - 10(4) = -17, 5+(−3)+12=145 + (-3) + 12 = 14, 1−30+36=71 - 30 + 36 = 7.

(b) Taylor's theorem

y(x)=y(x0)+(x−x0)y′(x0)+(x−x0)22!y′′(x0)+(x−x0)33!y′′′(x0)+⋯+(x−x0)nn!y(n)(x0)+Rny(x) = y(x_0) + (x - x_0)y'(x_0) + \frac{(x - x_0)^2}{2!}y''(x_0) + \frac{(x-x_0)^3}{3!}y'''(x_0) + \dots + \frac{(x-x_0)^n}{n!}y^{(n)}(x_0) + R_n

For y′=x2+y2y' = x^2 + y^2, y(0)=1y(0) = 1:

y′=x2+y2⇒y′(0)=1y' = x^2 + y^2 \Rightarrow y'(0) = 1 y′′=2x+2yy′⇒y′′(0)=2y'' = 2x + 2yy' \Rightarrow y''(0) = 2 y′′′=2+2y′2+2yy′′⇒y′′′(0)=2+2+4=8y''' = 2 + 2y'^2 + 2yy'' \Rightarrow y'''(0) = 2 + 2 + 4 = 8 y(4)=6y′y′′+2yy′′′⇒y(4)(0)=12+16=28y^{(4)} = 6y'y'' + 2yy''' \Rightarrow y^{(4)}(0) = 12 + 16 = 28 y(5)=6y′′2+8y′y′′′+2yy(4)⇒y(5)(0)=24+64+56=144y^{(5)} = 6y''^2 + 8y'y''' + 2yy^{(4)} \Rightarrow y^{(5)}(0) = 24 + 64 + 56 = 144

y(x)=1+x+x2+43x3+76x4+65x5+…y(x) = 1 + x + x^2 + \frac{4}{3}x^3 + \frac{7}{6}x^4 + \frac{6}{5}x^5 + \dots

At x=0.5x = 0.5:

y(0.5)=1+0.5+0.25+0.16667+0.07292+0.0375+⋯≈2.027y(0.5) = 1 + 0.5 + 0.25 + 0.16667 + 0.07292 + 0.0375 + \dots \approx 2.027

Including further terms (x6x^6 term ≈0.0193\approx 0.0193, and so on) the sum rises slowly and settles near 2.072.07, so y(0.5)≈2.07y(0.5) \approx 2.07.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2022 · 5 marks

If the true value of π is 3.1415926 and its approximate value is given by 3.1428571. Find the absolute and relative errors.

Answer

True value x=3.1415926x = 3.1415926, approximate value x1=3.1428571x_1 = 3.1428571.

Absolute error

Ea=∣x−x1∣=∣3.1415926−3.1428571∣=0.0012645E_a = |x - x_1| = |3.1415926 - 3.1428571| = 0.0012645

Relative error

Er=Ea∣x∣=0.00126453.1415926=4.025×10−4E_r = \frac{E_a}{|x|} = \frac{0.0012645}{3.1415926} = 4.025 \times 10^{-4}

Percentage error =Er×100≈0.0403%= E_r \times 100 \approx 0.0403\%.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2022 · 5 marks

What are the advantages of Lagrange's formula over Newton's formula? When Newton's forward interpolation formula is used?

Answer

Advantages of Lagrange's formula over Newton's formula

  • It works for unequally spaced as well as equally spaced data, whereas Newton's forward/backward formulas need equal spacing (Newton's divided difference formula handles unequal spacing but needs a table).
  • No difference table has to be built; the formula is written directly from the data points.
  • The data points can be taken in any order, and the formula is symmetric in x0,…,xnx_0, \dots, x_n.
  • It can also be used for inverse interpolation (interchange the roles of xx and yy).

Its drawback is that adding a new data point forces the whole polynomial to be recomputed, which Newton's formula avoids by just adding one more term.

Newton's forward interpolation formula is used when:

  • the values of xx are equally spaced, xi=x0+ihx_i = x_0 + ih, and
  • the point at which ff is required lies near the beginning of the table (the first few values), so that p=(x−x0)/hp = (x - x_0)/h is small.

f(x)=f0+pΔf0+p(p−1)2!Δ2f0+p(p−1)(p−2)3!Δ3f0+…f(x) = f_0 + p\Delta f_0 + \frac{p(p-1)}{2!}\Delta^2 f_0 + \frac{p(p-1)(p-2)}{3!}\Delta^3 f_0 + \dots

(For points near the end of the table, Newton's backward formula is used.)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2022 · 5 marks

Find the polynomial that interpolates f(0) = 0, f(1) = 1, f(2) = 0, f(3) = 1, f(4) = 0 using Newton divided differences. Use the Newton table to generate the necessary divided differences.

Answer

Divided difference table for x=0,1,2,3,4x = 0, 1, 2, 3, 4 and f=0,1,0,1,0f = 0, 1, 0, 1, 0:

xxff1st2nd3rd4th
00
1
11-1
-12/3
201-1/3
1-2/3
31-1
-1
40

(For example, the 3rd difference at the top is 1−(−1)3−0=23\dfrac{1-(-1)}{3-0} = \dfrac23, and the 4th is −2/3−2/34−0=−13\dfrac{-2/3 - 2/3}{4 - 0} = -\dfrac13.)

Newton's divided difference polynomial:

P(x)=f0+(x−x0)f[x0,x1]+(x−x0)(x−x1)f[x0,x1,x2]+(x−x0)(x−x1)(x−x2)f[x0..x3]+(x−x0)(x−x1)(x−x2)(x−x3)f[x0..x4]P(x) = f_0 + (x - x_0)f[x_0,x_1] + (x-x_0)(x-x_1)f[x_0,x_1,x_2] + (x-x_0)(x-x_1)(x-x_2)f[x_0..x_3] + (x-x_0)(x-x_1)(x-x_2)(x-x_3)f[x_0..x_4]

P(x)=0+x(1)+x(x−1)(−1)+x(x−1)(x−2)23+x(x−1)(x−2)(x−3)(−13)P(x) = 0 + x(1) + x(x-1)(-1) + x(x-1)(x-2)\tfrac23 + x(x-1)(x-2)(x-3)\left(-\tfrac13\right)

Expanding:

  • x(x−1)=x2−xx(x-1) = x^2 - x
  • x(x−1)(x−2)=x3−3x2+2xx(x-1)(x-2) = x^3 - 3x^2 + 2x
  • x(x−1)(x−2)(x−3)=x4−6x3+11x2−6xx(x-1)(x-2)(x-3) = x^4 - 6x^3 + 11x^2 - 6x

P(x)=x−x2+x+23x3−2x2+43x−13x4+2x3−113x2+2xP(x) = x - x^2 + x + \tfrac23x^3 - 2x^2 + \tfrac43 x - \tfrac13x^4 + 2x^3 - \tfrac{11}{3}x^2 + 2x

P(x)=−13x4+83x3−203x2+163xP(x) = -\frac13 x^4 + \frac83 x^3 - \frac{20}{3}x^2 + \frac{16}{3}x

Check: P(1)=−1+8−20+163=1P(1) = \frac{-1 + 8 - 20 + 16}{3} = 1, P(2)=−16+64−80+323=0P(2) = \frac{-16 + 64 - 80 + 32}{3} = 0, P(3)=−81+216−180+483=1P(3) = \frac{-81 + 216 - 180 + 48}{3} = 1, P(4)=−256+512−320+643=0P(4) = \frac{-256 + 512 - 320 + 64}{3} = 0.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2022 · 5 marks

Using the trapezium rule, evaluate the integral I=∫01dxx2+6x+10I = \int_0^1 \frac{dx}{x^2 + 6x + 10} with 2 and 4 sub intervals. Compare with the exact solution. Comment on the magnitudes of the errors obtained.

Answer

f(x)=1x2+6x+10f(x) = \dfrac{1}{x^2 + 6x + 10}, a=0a = 0, b=1b = 1.

Exact value: x2+6x+10=(x+3)2+1x^2 + 6x + 10 = (x+3)^2 + 1, so I=[tan⁡−1(x+3)]01=tan⁡−14−tan⁡−13=1.325818−1.249046=0.076772I = \left[\tan^{-1}(x + 3)\right]_0^1 = \tan^{-1}4 - \tan^{-1}3 = 1.325818 - 1.249046 = 0.076772

n = 2, h = 0.5: f(0)=0.1, f(0.5)=113.25=0.075472, f(1)=117=0.058824f(0) = 0.1,\ f(0.5) = \dfrac{1}{13.25} = 0.075472,\ f(1) = \dfrac{1}{17} = 0.058824

I2=0.52[0.1+2(0.075472)+0.058824]=0.25×0.309768=0.077442I_2 = \frac{0.5}{2}\left[0.1 + 2(0.075472) + 0.058824\right] = 0.25 \times 0.309768 = 0.077442

n = 4, h = 0.25: f(0.25)=111.5625=0.086486, f(0.75)=115.0625=0.066390f(0.25) = \dfrac{1}{11.5625} = 0.086486,\ f(0.75) = \dfrac{1}{15.0625} = 0.066390

I4=0.252[0.1+2(0.086486+0.075472+0.066390)+0.058824]=0.125×0.615520=0.076940I_4 = \frac{0.25}{2}\left[0.1 + 2(0.086486 + 0.075472 + 0.066390) + 0.058824\right] = 0.125 \times 0.615520 = 0.076940

Errors

nTrapezoidal valueError =∣I−In∣= \lvert I - I_n\rvert
20.0774420.000670
40.0769400.000168

Comment: Halving hh reduces the error by about a factor of 4 (0.000670/0.000168≈40.000670/0.000168 \approx 4), which agrees with the O(h2)O(h^2) error of the trapezoidal rule. More sub-intervals therefore give a more accurate result.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2022 · 5 marks

For solving a linear system, compare Gauss elimination method and Gauss Jordan method. Why Gauss Seidel method is better than Jacobi's iterative method?

Answer

Gauss elimination vs Gauss-Jordan

Gauss eliminationGauss-Jordan
Reduces the matrix to upper triangular formReduces it to diagonal/identity form
Needs back substitution to get the unknownsSolutions read directly; no back substitution
Fewer operations (about n3/3n^3/3)More operations (about n3/2n^3/2)
Preferred for solving a single systemConvenient for finding the matrix inverse
Elimination only below the pivotElimination above and below the pivot

Both are direct methods and need pivoting for stability.

Why Gauss-Seidel is better than Jacobi

In Jacobi's method every new value xi(k+1)x_i^{(k+1)} is computed only from the old iterate x(k)x^{(k)}. In Gauss-Seidel the newly computed values are used immediately in the same iteration:

xi(k+1)=1aii(bi−∑j<iaijxj(k+1)−∑j>iaijxj(k))x_i^{(k+1)} = \frac{1}{a_{ii}}\left(b_i - \sum_{j<i} a_{ij}x_j^{(k+1)} - \sum_{j>i} a_{ij}x_j^{(k)}\right)

Hence it usually converges about twice as fast (fewer iterations for the same accuracy), and it needs only one vector of storage because values are overwritten in place, while Jacobi must keep both the old and new vectors.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2022 · 5 marks

Using Euler's method find y(0.2) from dydx=x+y,y(0)=1\frac{dy}{dx} = x + y , \quad y(0) = 1 with h = 0.

Answer

The step size is cut off in the question; take h=0.1h = 0.1. Euler's method: yn+1=yn+hf(xn,yn)y_{n+1} = y_n + h f(x_n, y_n) with f=x+yf = x + y, x0=0x_0 = 0, y0=1y_0 = 1.

Step 1: y1=1+0.1(0+1)=1.1y_1 = 1 + 0.1(0 + 1) = 1.1 at x=0.1x = 0.1

Step 2: y2=1.1+0.1(0.1+1.1)=1.1+0.12=1.22y_2 = 1.1 + 0.1(0.1 + 1.1) = 1.1 + 0.12 = 1.22 at x=0.2x = 0.2

y(0.2)≈1.22y(0.2) \approx 1.22

(Exact solution y=2ex−x−1y = 2e^x - x - 1 gives y(0.2)=1.2428y(0.2) = 1.2428, so the Euler error is about 0.0230.023.)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2022 · 10 marks

When would we not use N-R method? Find the root of the equation x3−4x+1=0,x^3 - 4x + 1 = 0, lying in (0, 1) using Bisection method performing 10 iterations.

Answer

When N-R method is not used (or fails)

  • when f′(x)=0f'(x) = 0 at or near the root or at an iterate (division by zero, or a huge step);
  • when f′(x)f'(x) is very small (nearly flat curve), so the iterates fly far from the root;
  • when ff is not differentiable, or f′(x)f'(x) is difficult/expensive to compute;
  • when the initial guess is poor, so the iterates diverge, oscillate or cycle (for example near a local maximum/minimum or an inflection point);
  • for multiple roots, where convergence drops from quadratic to linear.

In such cases a bracketing method such as bisection (or regula falsi, secant) is safer.

Bisection for f(x)=x3−4x+1f(x) = x^3 - 4x + 1 on (0,1)(0, 1)

f(0)=1>0, f(1)=−2<0f(0) = 1 > 0,\ f(1) = -2 < 0, so a root lies in (0,1)(0, 1).

nabcf(c)
1010.5-0.8750
200.50.250.0156
30.250.50.375-0.4473
40.250.3750.3125-0.2195
50.250.31250.28125-0.1028
60.250.281250.265625-0.0438
70.250.2656250.2578125-0.0141
80.250.25781250.25390630.0007
90.25390630.25781250.2558594-0.0067
100.25390630.25585940.2548828-0.0030

After 10 iterations the root lies in (0.2539,0.2549)(0.2539, 0.2549), so x≈0.2549x \approx 0.2549 (the actual root is 0.25410.2541).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2022 · 10 marks

Find the dominant eigenvalue of A=[2354]A = \begin{bmatrix} 2 & 3 \\ 5 & 4 \end{bmatrix} by power method. Apply Gauss Seidel method to solve system of equations:
6x1 − 2x2 + x3 = 11;
-2x1 + 7x2 + 2x3 = 5;
x1 + 2x2 − 5x3 = −1,
with the initial vector of (0, 0, 0).

Answer

Power method for A=[2354]A = \begin{bmatrix}2&3\\5&4\end{bmatrix}

Start with x0=(1,1)Tx_0 = (1, 1)^T. At each step compute y=Axy = Ax, take the largest component as the eigenvalue estimate and divide by it.

kAxkAx_{k}λk\lambda_kxk+1x_{k+1}
1(5, 9)9(0.5556, 1)
2(4.1111, 6.7778)6.7778(0.6066, 1)
3(4.2131, 7.0328)7.0328(0.5991, 1)
4(4.1981, 6.9953)6.9953(0.6001, 1)
5(4.2003, 7.0007)7.0007(0.6000, 1)

The estimates converge to the dominant eigenvalue λ=7\lambda = 7 with eigenvector (0.6,1)T∝(3,5)T(0.6, 1)^T \propto (3, 5)^T. (Check: characteristic equation λ2−6λ−7=0\lambda^2 - 6\lambda - 7 = 0, roots 77 and −1-1.)

Gauss-Seidel

The system is diagonally dominant:

x1=11+2x2−x36,x2=5+2x1−2x37,x3=1+x1+2x25x_1 = \frac{11 + 2x_2 - x_3}{6},\quad x_2 = \frac{5 + 2x_1 - 2x_3}{7},\quad x_3 = \frac{1 + x_1 + 2x_2}{5}

Start with (0,0,0)(0, 0, 0):

Iterx1x_1x2x_2x3x_3
11.83331.23811.0619
22.06901.00201.0146
31.99820.99530.9978
41.99881.00030.9999
52.00011.00011.0001
62.00001.00001.0000

Solution: x1=2, x2=1, x3=1x_1 = 2,\ x_2 = 1,\ x_3 = 1.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2022 · 10 marks

Prepare the multi-step methods available for solving ordinary differential equations. Evaluate the value of y at x = 0.1 and 0.2 to 4 decimal places given dydx=x2y−1y(0)=1,\frac{dy}{dx} = x^2 y - 1 \quad y(0) = 1, using Taylor series method.

Answer

Multi-step methods for ODEs. A multi-step method computes yn+1y_{n+1} using several previous values yn,yn−1,…y_n, y_{n-1}, \dots (a single-step method such as Euler or Runge-Kutta uses only yny_n). The main ones are:

  • Adams-Bashforth (explicit), e.g. 4th order: yn+1=yn+h24(55fn−59fn−1+37fn−2−9fn−3)y_{n+1} = y_n + \frac{h}{24}\left(55f_n - 59f_{n-1} + 37f_{n-2} - 9f_{n-3}\right)
  • Adams-Moulton (implicit), e.g. 4th order: yn+1=yn+h24(9fn+1+19fn−5fn−1+fn−2)y_{n+1} = y_n + \frac{h}{24}\left(9f_{n+1} + 19f_n - 5f_{n-1} + f_{n-2}\right)
  • Milne's predictor-corrector: predictor yn+1=yn−3+4h3(2fn−fn−1+2fn−2)y_{n+1} = y_{n-3} + \frac{4h}{3}(2f_n - f_{n-1} + 2f_{n-2}), corrector yn+1=yn−1+h3(fn+1+4fn+fn−1)y_{n+1} = y_{n-1} + \frac h3(f_{n+1} + 4f_n + f_{n-1}).
  • Adams-Bashforth-Moulton predictor-corrector, using the AB formula to predict and AM to correct.

They need only one new function evaluation per step but require starting values from a single-step method.

Taylor series solution of y′=x2y−1y' = x^2y - 1, y(0)=1y(0) = 1:

y′=x2y−1⇒y′(0)=−1y' = x^2y - 1 \Rightarrow y'(0) = -1 y′′=2xy+x2y′⇒y′′(0)=0y'' = 2xy + x^2y' \Rightarrow y''(0) = 0 y′′′=2y+4xy′+x2y′′⇒y′′′(0)=2y''' = 2y + 4xy' + x^2y'' \Rightarrow y'''(0) = 2 y(4)=6y′+6xy′′+x2y′′′⇒y(4)(0)=−6y^{(4)} = 6y' + 6xy'' + x^2y''' \Rightarrow y^{(4)}(0) = -6 y(5)=12y′′+8xy′′′+x2y(4)⇒y(5)(0)=0y^{(5)} = 12y'' + 8xy''' + x^2y^{(4)} \Rightarrow y^{(5)}(0) = 0

y(x)=1−x+23!x3−64!x4+⋯=1−x+x33−x44+…y(x) = 1 - x + \frac{2}{3!}x^3 - \frac{6}{4!}x^4 + \dots = 1 - x + \frac{x^3}{3} - \frac{x^4}{4} + \dots

At x=0.1x = 0.1: y=1−0.1+0.000333−0.000025=0.900308≈0.9003y = 1 - 0.1 + 0.000333 - 0.000025 = 0.900308 \approx \mathbf{0.9003}

At x=0.2x = 0.2: y=1−0.2+0.002667−0.0004+0.0000036≈0.80227≈0.8023y = 1 - 0.2 + 0.002667 - 0.0004 + 0.0000036 \approx 0.80227 \approx \mathbf{0.8023}

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 · 5 marks

Define error. Explain the Taxonomy Errors.

Answer

Error is the difference between the true (exact) value of a quantity and the approximate value obtained or used in a computation:

Error=xtrue−xapprox\text{Error} = x_{true} - x_{approx}

Absolute error is ∣xtrue−xapprox∣|x_{true} - x_{approx}|, relative error is absolute error divided by ∣xtrue∣|x_{true}|, and percentage error is relative error times 100100.

Taxonomy (classification) of errors

  1. Inherent errors: errors in the input data, caused by limits of measurement or by approximating a physical problem by a mathematical model.
  2. Round-off errors: caused by the finite number of digits a computer or calculator can store; numbers are rounded or chopped, e.g. 2=1.4142\sqrt2 = 1.4142, 1/3=0.33331/3 = 0.3333. They can accumulate over many operations and cause loss of significance when nearly equal numbers are subtracted.
  3. Truncation errors: caused by replacing an infinite or exact mathematical process with a finite one, e.g. using only the first few terms of a Taylor series, or using a finite difference in place of a derivative. The size depends on the method (the step size hh).
  4. Modelling errors: arise from simplifying assumptions made while forming the mathematical model.
  5. Blunders (gross errors): human or programming mistakes such as wrong data entry, wrong formula or wrong units; they can be avoided by checking.

Round-off and truncation errors together are called numerical errors.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 · 5 marks

Estimate the value of sin θ at 9 = 45° using Newton's backward difference formula from the following set of data.θ102030405060
Sin θ0.17360.34200.50000.64280.76600.8660

Answer

Equally spaced data with h=10°h = 10°. The point θ=45°\theta = 45° is near the end of the table, so Newton's backward formula is used with xn=60°x_n = 60°:

p=x−xnh=45−6010=−1.5p = \frac{x - x_n}{h} = \frac{45 - 60}{10} = -1.5

Backward difference table:

θ\thetasin⁡θ\sin\theta∇\nabla∇2\nabla^2∇3\nabla^3∇4\nabla^4∇5\nabla^5
100.1736
200.34200.1684
300.50000.1580-0.0104
400.64280.1428-0.0152-0.0048
500.76600.1232-0.0196-0.00440.0004
600.86600.1000-0.0232-0.00360.00080.0004

y=yn+p∇yn+p(p+1)2!∇2yn+p(p+1)(p+2)3!∇3yn+p(p+1)(p+2)(p+3)4!∇4yn+…y = y_n + p\nabla y_n + \frac{p(p+1)}{2!}\nabla^2y_n + \frac{p(p+1)(p+2)}{3!}\nabla^3y_n + \frac{p(p+1)(p+2)(p+3)}{4!}\nabla^4y_n + \dots

With p=−1.5p = -1.5 and the last entries of each column:

  • p∇yn=(−1.5)(0.1000)=−0.1500p\nabla y_n = (-1.5)(0.1000) = -0.1500
  • p(p+1)2=0.375\dfrac{p(p+1)}{2} = 0.375, term =0.375×(−0.0232)=−0.0087= 0.375 \times (-0.0232) = -0.0087
  • p(p+1)(p+2)6=0.0625\dfrac{p(p+1)(p+2)}{6} = 0.0625, term =0.0625×(−0.0036)=−0.000225= 0.0625 \times (-0.0036) = -0.000225
  • p(p+1)(p+2)(p+3)24=0.0234375\dfrac{p(p+1)(p+2)(p+3)}{24} = 0.0234375, term =0.0234375×0.0008=0.0000188= 0.0234375 \times 0.0008 = 0.0000188

sin⁡45°≈0.8660−0.1500−0.0087−0.000225+0.000019≈0.7071\sin 45° \approx 0.8660 - 0.1500 - 0.0087 - 0.000225 + 0.000019 \approx 0.7071

(The true value is 0.707110.70711.)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 · 5 marks

Write an algorithm and program to calculate integration using Trapezoidal rule.

Answer

Trapezoidal rule: ∫abf(x) dx≈h2[f(x0)+2(f(x1)+⋯+f(xn−1))+f(xn)],h=b−an\int_a^b f(x)\,dx \approx \frac h2\left[f(x_0) + 2\left(f(x_1) + \dots + f(x_{n-1})\right) + f(x_n)\right],\quad h = \frac{b-a}{n}

Algorithm

  1. Define the function f(x)f(x).
  2. Read the limits aa, bb and the number of sub-intervals nn.
  3. Compute h=(b−a)/nh = (b - a)/n.
  4. Set sum=f(a)+f(b)sum = f(a) + f(b).
  5. For i=1i = 1 to n−1n - 1: x=a+ihx = a + ih; sum=sum+2f(x)sum = sum + 2f(x).
  6. Compute I=(h/2)×sumI = (h/2)\times sum.
  7. Print II and stop.

Program (C)

#include <stdio.h>
#include <math.h>

double f(double x) {
    return 1.0 / (1.0 + x * x);      /* change as required */
}

int main() {
    double a, b, h, sum, I;
    int n, i;

    printf("Enter a, b and n: ");
    scanf("%lf %lf %d", &a, &b, &n);

    h = (b - a) / n;
    sum = f(a) + f(b);
    for (i = 1; i < n; i++)
        sum = sum + 2 * f(a + i * h);

    I = h / 2 * sum;
    printf("Value of integral = %.6f\n", I);
    return 0;
}

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 · 5 marks

What is the form of resultant matrix using Gauss-Jordan method? Solve the following system of equations using Gauss-Jordan Method.
x + 2y - 3z = 4
2x + 4y - 6z = 8
x - 2y - 5z = 4

Answer

Form of the resultant matrix. In Gauss-Jordan elimination the augmented matrix [A ∣ b][A\,|\,b] is reduced by row operations until the coefficient part becomes the identity matrix, [I ∣ x][I\,|\,x]; the last column is then the solution directly (no back substitution).

Solution of the system

[12−3424−681−2−54]\left[\begin{array}{ccc|c} 1 & 2 & -3 & 4 \\ 2 & 4 & -6 & 8 \\ 1 & -2 & -5 & 4 \end{array}\right]

R2→R2−2R1, R3→R3−R1R_2 \to R_2 - 2R_1,\ R_3 \to R_3 - R_1:

[12−3400000−4−20]\left[\begin{array}{ccc|c} 1 & 2 & -3 & 4 \\ 0 & 0 & 0 & 0 \\ 0 & -4 & -2 & 0 \end{array}\right]

Swap R2↔R3R_2 \leftrightarrow R_3, then R2→R2/(−4)R_2 \to R_2/(-4):

[12−34011/200000]\left[\begin{array}{ccc|c} 1 & 2 & -3 & 4 \\ 0 & 1 & 1/2 & 0 \\ 0 & 0 & 0 & 0 \end{array}\right]

R1→R1−2R2R_1 \to R_1 - 2R_2:

[10−44011/200000]\left[\begin{array}{ccc|c} 1 & 0 & -4 & 4 \\ 0 & 1 & 1/2 & 0 \\ 0 & 0 & 0 & 0 \end{array}\right]

The rank is 2<32 < 3 (the second equation is twice the first), so the system is consistent with infinitely many solutions. Let z=tz = t:

x=4+4t,y=−t2,z=tx = 4 + 4t,\qquad y = -\frac t2,\qquad z = t

Check in the third equation: (4+4t)−2(−t/2)−5t=4+4t+t−5t=4(4 + 4t) - 2(-t/2) - 5t = 4 + 4t + t - 5t = 4. ✓

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 · 5 marks

Define ordinary differential equation. Use the fourth order Runge-Kutta method to estimate y(0.4) of the equation: dydx=x2+y2 with y(0) = 0 assuming that h = 0.2

Answer

Ordinary differential equation (ODE): an equation that contains an unknown function of a single independent variable and its derivatives, e.g. dydx=f(x,y)\dfrac{dy}{dx} = f(x, y). With a given value y(x0)=y0y(x_0) = y_0 it is an initial value problem.

RK4 for y′=x2+y2y' = x^2 + y^2, y(0)=0y(0) = 0, h=0.2h = 0.2

yn+1=yn+h6(k1+2k2+2k3+k4)y_{n+1} = y_n + \frac h6(k_1 + 2k_2 + 2k_3 + k_4)

Step 1 (x=0, y=0x = 0,\ y = 0): k1=0k_1 = 0, k2=f(0.1,0)=0.01k_2 = f(0.1, 0) = 0.01, k3=f(0.1,0.001)=0.010001k_3 = f(0.1, 0.001) = 0.010001, k4=f(0.2,0.0020002)=0.040004k_4 = f(0.2, 0.0020002) = 0.040004

y(0.2)=0.26(0.080006)=0.002667y(0.2) = \frac{0.2}{6}(0.080006) = 0.002667

Step 2 (x=0.2, y=0.002667x = 0.2,\ y = 0.002667):

k1=0.040007k_1 = 0.040007 k2=f(0.3,0.006668)=0.090044k_2 = f(0.3, 0.006668) = 0.090044 k3=f(0.3,0.011671)=0.090136k_3 = f(0.3, 0.011671) = 0.090136 k4=f(0.4,0.020694)=0.160428k_4 = f(0.4, 0.020694) = 0.160428

y(0.4)=0.002667+0.26(0.040007+0.180088+0.180272+0.160428)=0.002667+0.018693y(0.4) = 0.002667 + \frac{0.2}{6}(0.040007 + 0.180088 + 0.180272 + 0.160428) = 0.002667 + 0.018693

y(0.4)≈0.02136y(0.4) \approx 0.02136

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 · 5 marks

Solve for the steady state temperatures in a rectangular plate of 8cm x 10cm, if one 10cm side is held at 50°C, and the other 10cm side is held at 30°C and other two sides are held at 10°C. Assume grids of size 2cm x 2cm.

Answer

Take the plate with 0≤x≤80 \le x \le 8 and 0≤y≤100 \le y \le 10 (cm). The two 10 cm sides x=0x = 0 and x=8x = 8 are held at 50∘50^\circ and 30∘30^\circ; the 8 cm sides y=0y = 0 and y=10y = 10 are at 10∘10^\circ. With h=2h = 2 cm the interior points are x=2,4,6x = 2, 4, 6 and y=2,4,6,8y = 2, 4, 6, 8, giving 12 unknowns uiju_{ij} (ii for xx, jj for yy). The steady state satisfies Laplace's equation ∇2u=0\nabla^2 u = 0, i.e.

ui,j=14(ui+1,j+ui−1,j+ui,j+1+ui,j−1)u_{i,j} = \frac14\left(u_{i+1,j} + u_{i-1,j} + u_{i,j+1} + u_{i,j-1}\right)

Boundary values: u0,j=50, u4,j=30, ui,0=ui,5=10u_{0,j} = 50,\ u_{4,j} = 30,\ u_{i,0} = u_{i,5} = 10.

Examples of the equations:

4u11=50+10+u21+u124u12=50+u11+u22+u134u21=10+u11+u31+u224u31=30+10+u21+u32\begin{aligned} 4u_{11} &= 50 + 10 + u_{21} + u_{12}\\ 4u_{12} &= 50 + u_{11} + u_{22} + u_{13}\\ 4u_{21} &= 10 + u_{11} + u_{31} + u_{22}\\ 4u_{31} &= 30 + 10 + u_{21} + u_{32} \end{aligned}

and similarly for the others. Solving the 12 equations (by Gauss-Seidel iteration or elimination, starting with all values =30= 30):

y=2y = 2y=4y = 4y=6y = 6y=8y = 8
x=2x = 229.6936.0936.0929.69
x=4x = 422.6828.5928.5922.68
x=6x = 622.4227.0027.0022.42

The steady state temperatures are about u11=u14=29.7∘u_{11} = u_{14} = 29.7^\circ, u12=u13=36.1∘u_{12} = u_{13} = 36.1^\circ, u21=u24=22.7∘u_{21} = u_{24} = 22.7^\circ, u22=u23=28.6∘u_{22} = u_{23} = 28.6^\circ, u31=u34=22.4∘u_{31} = u_{34} = 22.4^\circ, u32=u33=27.0∘u_{32} = u_{33} = 27.0^\circ (symmetric about y=5y = 5).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 · 5 marks

Write a short note on (Any Two):
a) Partial Differential Equations
b) Linear Interpretation
c) Boundary value problems

Answer

(a) Partial Differential Equations

A PDE relates an unknown function of two or more independent variables to its partial derivatives. The general second order linear form Auxx+Buxy+Cuyy+⋯=0Au_{xx} + Bu_{xy} + Cu_{yy} + \dots = 0 is classified by B2−4ACB^2 - 4AC:

  • <0< 0 elliptic (Laplace uxx+uyy=0u_{xx} + u_{yy} = 0, Poisson uxx+uyy=gu_{xx} + u_{yy} = g): steady state problems;
  • =0= 0 parabolic (heat equation ut=c uxxu_t = c\,u_{xx}): diffusion problems;
  • >0> 0 hyperbolic (wave equation utt=c2uxxu_{tt} = c^2u_{xx}): vibrations and wave propagation.

Numerically the region is covered by a grid and each derivative is replaced by a finite difference, e.g. uxx≈(ui+1,j−2ui,j+ui−1,j)/h2u_{xx} \approx (u_{i+1,j} - 2u_{i,j} + u_{i-1,j})/h^2. This gives a system of algebraic equations solved by Gauss-Seidel/Liebmann iteration, or by explicit and implicit (Crank-Nicolson) schemes for time-dependent problems.

(b) Linear Interpolation

Linear interpolation estimates a value between two known data points (x0,y0)(x_0, y_0) and (x1,y1)(x_1, y_1) by fitting a straight line through them:

y=y0+y1−y0x1−x0(x−x0)y = y_0 + \frac{y_1 - y_0}{x_1 - x_0}(x - x_0)

It is the first order case of Lagrange/Newton interpolation. It is simple, but the error (x−x0)(x−x1)2f′′(ξ)\dfrac{(x-x_0)(x-x_1)}{2}f''(\xi) is large when the function is strongly curved or the points are far apart. Example: from f(2)=4f(2) = 4 and f(4)=16f(4) = 16, f(3)≈4+6(1)=10f(3) \approx 4 + 6(1) = 10.

(c) Boundary Value Problems

A boundary value problem is a differential equation whose conditions are given at two or more points (the boundaries) rather than at a single starting point, e.g. y′′=f(x,y,y′)y'' = f(x, y, y') with y(a)=α, y(b)=βy(a) = \alpha,\ y(b) = \beta. Unlike initial value problems it cannot be marched forward step by step. Methods used:

  • Shooting method: guess the missing initial slope, solve as an IVP and adjust the guess until the far boundary condition is met;
  • Finite difference method: replace derivatives by differences at grid points, giving a (tri-diagonal) linear system which is solved directly.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 · 10 marks

a) Fit a straight line to the following set of data using Least Square Regression.
b) Apply the factorization method (any) to solve the equations:
2x + 3y + 7z = 4
2x + 3y + z = 5
3x + 4y + z = 7

Answer

(a) The data table is not reproduced in the question, so the method is given in general form with a worked example.

For data (xi,yi)(x_i, y_i), i=1,…,ni = 1, \dots, n, fit y=a+bxy = a + bx by minimising S=∑(yi−a−bxi)2S = \sum (y_i - a - bx_i)^2. Setting ∂S/∂a=∂S/∂b=0\partial S/\partial a = \partial S/\partial b = 0 gives the normal equations

∑y=na+b∑x,∑xy=a∑x+b∑x2\sum y = na + b\sum x,\qquad \sum xy = a\sum x + b\sum x^2

b=n∑xy−∑x∑yn∑x2−(∑x)2,a=∑y−b∑xnb = \frac{n\sum xy - \sum x\sum y}{n\sum x^2 - (\sum x)^2},\qquad a = \frac{\sum y - b\sum x}{n}

Example: x=1,2,3,4,5x = 1, 2, 3, 4, 5 and y=2,4,5,4,5y = 2, 4, 5, 4, 5: n=5n = 5, ∑x=15\sum x = 15, ∑y=20\sum y = 20, ∑xy=66\sum xy = 66, ∑x2=55\sum x^2 = 55.

b=5(66)−15(20)5(55)−225=3050=0.6,a=20−0.6(15)5=2.2b = \frac{5(66) - 15(20)}{5(55) - 225} = \frac{30}{50} = 0.6,\qquad a = \frac{20 - 0.6(15)}{5} = 2.2

The fitted line is y=2.2+0.6xy = 2.2 + 0.6x.

(b) LU factorization (Doolittle)

2x+3y+7z=4,2x+3y+z=5,3x+4y+z=72x + 3y + 7z = 4,\quad 2x + 3y + z = 5,\quad 3x + 4y + z = 7

Without row exchange the second pivot would be 3−1⋅3=03 - 1\cdot 3 = 0, so interchange equations 2 and 3. The system becomes A=[237341231]A = \begin{bmatrix}2&3&7\\3&4&1\\2&3&1\end{bmatrix}, b=(4,7,5)Tb = (4, 7, 5)^T.

A=LUA = LU with L=[1001.510101],U=[2370−0.5−9.500−6]L = \begin{bmatrix}1&0&0\\1.5&1&0\\1&0&1\end{bmatrix},\qquad U = \begin{bmatrix}2&3&7\\0&-0.5&-9.5\\0&0&-6\end{bmatrix}

(Check: row 2 of UU: 4−1.5⋅3=−0.54 - 1.5\cdot 3 = -0.5, 1−1.5⋅7=−9.51 - 1.5\cdot 7 = -9.5; row 3: l32=(3−3)/(−0.5)=0l_{32} = (3 - 3)/(-0.5) = 0, u33=1−7=−6u_{33} = 1 - 7 = -6.)

Forward substitution Ly=bLy = b: y1=4y_1 = 4, y2=7−1.5(4)=1y_2 = 7 - 1.5(4) = 1, y3=5−4=1y_3 = 5 - 4 = 1.

Back substitution Ux=yUx = y:

−6z=1⇒z=−16-6z = 1 \Rightarrow z = -\frac16 −0.5y−9.5z=1⇒y=76-0.5y - 9.5z = 1 \Rightarrow y = \frac76 2x+3y+7z=4⇒2x=4−3.5+76=53⇒x=562x + 3y + 7z = 4 \Rightarrow 2x = 4 - 3.5 + \frac76 = \frac53 \Rightarrow x = \frac56

x=56≈0.8333,y=76≈1.1667,z=−16≈−0.1667x = \frac56 \approx 0.8333,\quad y = \frac76 \approx 1.1667,\quad z = -\frac16 \approx -0.1667

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2023 · 10 marks

a) Write and implement an algorithm to solve the system of linear equations using Gauss-Seidel method with suitable example.
b) Write a program to solve the ordinary differentia; equations using Heun's method.

Answer

(a) Gauss-Seidel method

For Ax=bAx = b with AA diagonally dominant, rewrite equation ii as

xi(k+1)=1aii(bi−∑j<iaijxj(k+1)−∑j>iaijxj(k))x_i^{(k+1)} = \frac{1}{a_{ii}}\left(b_i - \sum_{j<i}a_{ij}x_j^{(k+1)} - \sum_{j>i}a_{ij}x_j^{(k)}\right)

Algorithm

  1. Read nn, the matrix AA, vector bb, tolerance ε\varepsilon, maximum iterations NN.
  2. Set all xi=0x_i = 0.
  3. For k=1k = 1 to NN:
    1. For each i=1..ni = 1..n: old=xiold = x_i; compute the new xix_i using the formula (with the latest values); record max⁡∣xi−old∣\max|x_i - old|.
    2. If the maximum change <ε< \varepsilon, stop.
  4. Print xx.

Program (C)

#include <stdio.h>
#include <math.h>

int main() {
    int n, i, j, k, maxit;
    double a[10][10], b[10], x[10] = {0}, s, old, err, eps;

    printf("Enter n: ");
    scanf("%d", &n);
    printf("Enter augmented matrix rows (a1..an b):\n");
    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) scanf("%lf", &a[i][j]);
        scanf("%lf", &b[i]);
    }
    printf("Enter tolerance and max iterations: ");
    scanf("%lf %d", &eps, &maxit);

    for (k = 1; k <= maxit; k++) {
        err = 0;
        for (i = 0; i < n; i++) {
            s = b[i];
            for (j = 0; j < n; j++)
                if (j != i) s -= a[i][j] * x[j];
            old = x[i];
            x[i] = s / a[i][i];
            if (fabs(x[i] - old) > err) err = fabs(x[i] - old);
        }
        if (err < eps) break;
    }
    printf("Solution after %d iterations:\n", k);
    for (i = 0; i < n; i++) printf("x%d = %.5f\n", i + 1, x[i]);
    return 0;
}

Example: 6x1−2x2+x3=11, −2x1+7x2+2x3=5, x1+2x2−5x3=−16x_1 - 2x_2 + x_3 = 11,\ -2x_1 + 7x_2 + 2x_3 = 5,\ x_1 + 2x_2 - 5x_3 = -1. Starting from (0,0,0)(0, 0, 0) the iterates are (1.8333,1.2381,1.0619)(1.8333, 1.2381, 1.0619), (2.0690,1.0020,1.0146)(2.0690, 1.0020, 1.0146), (1.9982,0.9953,0.9978)(1.9982, 0.9953, 0.9978), and so on, converging to x1=2, x2=1, x3=1x_1 = 2,\ x_2 = 1,\ x_3 = 1.

(b) Heun's method

For y′=f(x,y)y' = f(x, y), y(x0)=y0y(x_0) = y_0:

yn+1∗=yn+hf(xn,yn),yn+1=yn+h2[f(xn,yn)+f(xn+1,yn+1∗)]y^*_{n+1} = y_n + hf(x_n, y_n),\qquad y_{n+1} = y_n + \frac h2\left[f(x_n, y_n) + f(x_{n+1}, y^*_{n+1})\right]

#include <stdio.h>
#include <math.h>

double f(double x, double y) {
    return x + y;                 /* change as required */
}

int main() {
    double x0, y0, xn, h, k1, k2, yp;
    int n, i;

    printf("Enter x0, y0, xn and number of steps n: ");
    scanf("%lf %lf %lf %d", &x0, &y0, &xn, &n);
    h = (xn - x0) / n;

    printf("x\t\ty\n%f\t%f\n", x0, y0);
    for (i = 0; i < n; i++) {
        k1 = f(x0, y0);
        yp = y0 + h * k1;              /* predictor (Euler) */
        k2 = f(x0 + h, yp);
        y0 = y0 + h / 2 * (k1 + k2);   /* corrector (average slope) */
        x0 = x0 + h;
        printf("%f\t%f\n", x0, y0);
    }
    return 0;
}

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 · 5 marks

Explain absolute and relative error. Find the relative error of number 5.6 if both of its digits are correct.

Answer

Absolute error is the magnitude of the difference between the true value xx and the approximate value xax_a: Ea=∣x−xa∣E_a = |x - x_a|

Relative error is the absolute error compared to the true value: Er=Ea∣x∣≈Ea∣xa∣E_r = \frac{E_a}{|x|} \approx \frac{E_a}{|x_a|} It has no units and may be quoted as a percentage (Er×100E_r \times 100).

Number 5.6 with both digits correct. If both digits are correct, the number is correct to one decimal place, so the maximum absolute error is half a unit of the last place:

Ea=0.05E_a = 0.05

Er=0.055.6=0.00893≈0.893%E_r = \frac{0.05}{5.6} = 0.00893 \approx 0.893\%

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 · 5 marks

On what type of equations Newton's methods can be applicable. Justify.

Answer

The Newton-Raphson iteration xn+1=xn−f(xn)f′(xn)x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)} is applicable to equations f(x)=0f(x) = 0 that satisfy the following:

  • ff is algebraic or transcendental (polynomial, trigonometric, exponential, logarithmic), e.g. x3−4x+1=0x^3 - 4x + 1 = 0 or x−cos⁡x=0x - \cos x = 0;
  • f(x)f(x) is continuous and differentiable near the root, so that f′(x)f'(x) can be evaluated;
  • f′(x)≠0f'(x) \ne 0 near the root (a simple root), because f′f' appears in the denominator;
  • a reasonably good initial guess x0x_0 exists, close enough that ∣f(x)f′′(x)[f′(x)]2∣<1\left|\dfrac{f(x)f''(x)}{[f'(x)]^2}\right| < 1 in the neighbourhood, which guarantees convergence.

Justification. The formula comes from the tangent line at xnx_n (first-order Taylor expansion), which needs the derivative to exist; the tangent's intercept with the xx-axis is the next approximation. For a simple root the convergence is quadratic, en+1≈f′′2f′en2e_{n+1} \approx \dfrac{f''}{2f'}e_n^2, so it is very fast. It does not work well for multiple roots (f′=0f' = 0 at the root), non-differentiable functions or a poor starting point.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 · 5 marks

Write a program to compute integral 0∫x/2 √sinx dx Simpson's 1/3 rule.

Answer

The integral is ∫0π/2sin⁡x dx\displaystyle\int_0^{\pi/2}\sqrt{\sin x}\,dx (the upper limit is read as π/2\pi/2). Simpson's 1/3 rule with an even number nn of sub-intervals, h=(b−a)/nh = (b-a)/n:

I≈h3[f0+4(f1+f3+⋯+fn−1)+2(f2+f4+⋯+fn−2)+fn]I \approx \frac h3\left[f_0 + 4(f_1 + f_3 + \dots + f_{n-1}) + 2(f_2 + f_4 + \dots + f_{n-2}) + f_n\right]

Program (C)

#include <stdio.h>
#include <math.h>

double f(double x) {
    return sqrt(sin(x));
}

int main() {
    double a = 0.0, b = M_PI / 2, h, sum, I;
    int n, i;

    printf("Enter even number of sub-intervals n: ");
    scanf("%d", &n);
    if (n % 2 != 0) {
        printf("n must be even\n");
        return 1;
    }

    h = (b - a) / n;
    sum = f(a) + f(b);
    for (i = 1; i < n; i++) {
        if (i % 2 == 1)
            sum += 4 * f(a + i * h);
        else
            sum += 2 * f(a + i * h);
    }
    I = h / 3 * sum;
    printf("Integral = %.6f\n", I);
    return 0;
}

For n=10n = 10 the program prints about 1.19311.1931 (the true value is 1.19811.1981; the small difference is due to the infinite slope of sin⁡x\sqrt{\sin x} at x=0x = 0, and the result improves as nn increases).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 · 5 marks

Using Runge-Kutta method of 4th order solve the following equation taking each step h = 0.1 dydx=4xy - xy given y(0) = 3.3 calculate y at x = 0.1 and 0.2.

Answer

The right-hand side is read literally as f(x,y)=4xy−xy=3xyf(x, y) = 4xy - xy = 3xy, with y(0)=3.3y(0) = 3.3, h=0.1h = 0.1.

Step 1 (x0=0, y0=3.3x_0 = 0,\ y_0 = 3.3):

k1=f(0,3.3)=0k_1 = f(0, 3.3) = 0

k2=f(0.05, 3.3)=3(0.05)(3.3)=0.495k_2 = f(0.05,\ 3.3) = 3(0.05)(3.3) = 0.495

k3=f(0.05, 3.3+0.05(0.495))=f(0.05, 3.32475)=0.498713k_3 = f(0.05,\ 3.3 + 0.05(0.495)) = f(0.05,\ 3.32475) = 0.498713

k4=f(0.1, 3.3+0.1(0.498713))=f(0.1, 3.349871)=1.004961k_4 = f(0.1,\ 3.3 + 0.1(0.498713)) = f(0.1,\ 3.349871) = 1.004961

y(0.1)=3.3+0.16(0+0.99+0.997425+1.004961)=3.3+0.16(2.992386)=3.34987y(0.1) = 3.3 + \frac{0.1}{6}\left(0 + 0.99 + 0.997425 + 1.004961\right) = 3.3 + \frac{0.1}{6}(2.992386) = 3.34987

Step 2 (x1=0.1, y1=3.34987x_1 = 0.1,\ y_1 = 3.34987):

k1=3(0.1)(3.34987)=1.004961k_1 = 3(0.1)(3.34987) = 1.004961

k2=f(0.15, 3.34987+0.05(1.004961))=f(0.15, 3.400118)=1.530053k_2 = f(0.15,\ 3.34987 + 0.05(1.004961)) = f(0.15,\ 3.400118) = 1.530053

k3=f(0.15, 3.34987+0.05(1.530053))=f(0.15, 3.426373)=1.541868k_3 = f(0.15,\ 3.34987 + 0.05(1.530053)) = f(0.15,\ 3.426373) = 1.541868

k4=f(0.2, 3.34987+0.1(1.541868))=f(0.2, 3.504057)=2.102434k_4 = f(0.2,\ 3.34987 + 0.1(1.541868)) = f(0.2,\ 3.504057) = 2.102434

y(0.2)=3.34987+0.16(1.004961+3.060106+3.083736+2.102434)=3.34987+0.16(9.251237)y(0.2) = 3.34987 + \frac{0.1}{6}\left(1.004961 + 3.060106 + 3.083736 + 2.102434\right) = 3.34987 + \frac{0.1}{6}(9.251237)

y(0.1)≈3.3499,y(0.2)≈3.5041y(0.1) \approx 3.3499,\qquad y(0.2) \approx 3.5041

(The exact solution y=3.3e1.5x2y = 3.3e^{1.5x^2} gives 3.34993.3499 and 3.50413.5041.)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 · 5 marks

Solve the laplace equation Uxx + Uyy = 0 for the following square mesh with the boundary values.

Answer

Laplace equation by finite differences (Liebmann's method). Replacing Uxx+Uyy=0U_{xx}+U_{yy}=0 by central differences on a square mesh (h=kh=k) gives the standard five-point formula

Ui,j=14(Ui+1,j+Ui−1,j+Ui,j+1+Ui,j−1)U_{i,j}=\frac14\left(U_{i+1,j}+U_{i-1,j}+U_{i,j+1}+U_{i,j-1}\right)

so every interior value is the average of its four neighbours.

Worked mesh. Take a 3×33\times3 mesh with interior points u1,u2u_1,u_2 (top row) and u3,u4u_3,u_4 (bottom row), boundary value 100100 along the top edge and 00 along the other three edges.

4u1=100+0+u2+u3,4u2=100+0+u1+u44u_1=100+0+u_2+u_3,\quad 4u_2=100+0+u_1+u_4 4u3=0+0+u1+u4,4u4=0+0+u2+u34u_3=0+0+u_1+u_4,\quad 4u_4=0+0+u_2+u_3

By symmetry u1=u2=au_1=u_2=a and u3=u4=bu_3=u_4=b:

3a=100+b,3b=a3a=100+b,\qquad 3b=a

3a=100+a3  ⇒  8a3=100  ⇒  a=37.5,b=12.53a=100+\frac a3\;\Rightarrow\;\frac{8a}{3}=100\;\Rightarrow\;a=37.5,\qquad b=12.5

Hence u1=u2=37.5u_1=u_2=37.5 and u3=u4=12.5u_3=u_4=12.5. (For a different boundary diagram, substitute its boundary values in the same four equations; they can be solved directly or by repeated averaging until values stop changing.)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 · 10 marks

Solve the given set of linear equations using Dolittle LU decomposition method:
3x 1 + 2x 2 + x 3 = 10
2x 1 + 3x 2 + 2x 3 = 14
3x 1 + 2x 2 + 3x 3 = 14

Answer

Write A=LUA=LU with LL unit lower triangular (Doolittle).

U1=(3,  2,  1),l21=23,l31=33=1U_{1}=(3,\;2,\;1),\qquad l_{21}=\frac23,\quad l_{31}=\frac33=1

u22=3−23(2)=53,u23=2−23(1)=43u_{22}=3-\frac23(2)=\frac53,\qquad u_{23}=2-\frac23(1)=\frac43

l32=2−1⋅25/3=0,u33=3−1⋅1−0⋅43=2l_{32}=\frac{2-1\cdot2}{5/3}=0,\qquad u_{33}=3-1\cdot1-0\cdot\frac43=2

L=[1002310101],U=[32105343002]L=\begin{bmatrix}1&0&0\\ \tfrac23&1&0\\ 1&0&1\end{bmatrix},\qquad U=\begin{bmatrix}3&2&1\\0&\tfrac53&\tfrac43\\0&0&2\end{bmatrix}

Forward substitution Ly=bLy=b, b=(10,14,14)b=(10,14,14):

y1=10,y2=14−23(10)=223,y3=14−10−0=4y_1=10,\quad y_2=14-\frac23(10)=\frac{22}{3},\quad y_3=14-10-0=4

Back substitution Ux=yUx=y:

2x3=4⇒x3=22x_3=4\Rightarrow x_3=2 53x2+43(2)=223⇒53x2=143⇒x2=2.8\frac53x_2+\frac43(2)=\frac{22}3\Rightarrow \frac53x_2=\frac{14}{3}\Rightarrow x_2=2.8 3x1+2(2.8)+2=10⇒x1=0.83x_1+2(2.8)+2=10\Rightarrow x_1=0.8

Solution: x1=0.8,  x2=2.8,  x3=2x_1=0.8,\;x_2=2.8,\;x_3=2. Check: 3(0.8)+2(2.8)+2=103(0.8)+2(2.8)+2=10, 2(0.8)+3(2.8)+4=142(0.8)+3(2.8)+4=14, 3(0.8)+2(2.8)+6=143(0.8)+2(2.8)+6=14.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 · 10 marks

Define initial value problems and final value problems. Using heun’s method, find value of y when x=0.3 given that dydx = x + y and y=1 when x=0.

Answer

Initial value problem (IVP). A differential equation together with conditions on the unknown function given at a single starting point, e.g. y′=f(x,y),  y(x0)=y0y'=f(x,y),\;y(x_0)=y_0. The solution is marched forward from x0x_0.

Final value (boundary value) problem. The conditions are specified at more than one point (e.g. at both ends x=ax=a and x=bx=b, or at the final point), such as y′′=f(x,y,y′),  y(a)=α,  y(b)=βy''=f(x,y,y'),\;y(a)=\alpha,\;y(b)=\beta. It cannot be marched directly from one end.

Heun's method. Predictor and corrector:

yn+1∗=yn+hf(xn,yn),yn+1=yn+h2[f(xn,yn)+f(xn+1,yn+1∗)]y^{*}_{n+1}=y_n+hf(x_n,y_n),\qquad y_{n+1}=y_n+\frac h2\left[f(x_n,y_n)+f(x_{n+1},y^{*}_{n+1})\right]

Here f=x+yf=x+y, x0=0x_0=0, y0=1y_0=1; take h=0.1h=0.1 (three steps to reach x=0.3x=0.3).

Step 1 (x0=0, y0=1x_0=0,\,y_0=1): f=1f=1, y∗=1.1y^*=1.1, f(0.1,1.1)=1.2f(0.1,1.1)=1.2 y1=1+0.05(1+1.2)=1.11y_1=1+0.05(1+1.2)=1.11

Step 2 (x1=0.1, y1=1.11x_1=0.1,\,y_1=1.11): f=1.21f=1.21, y∗=1.231y^*=1.231, f(0.2,1.231)=1.431f(0.2,1.231)=1.431 y2=1.11+0.05(1.21+1.431)=1.24205y_2=1.11+0.05(1.21+1.431)=1.24205

Step 3 (x2=0.2, y2=1.24205x_2=0.2,\,y_2=1.24205): f=1.44205f=1.44205, y∗=1.386255y^*=1.386255, f(0.3,1.386255)=1.686255f(0.3,1.386255)=1.686255 y3=1.24205+0.05(1.44205+1.686255)=1.39847y_3=1.24205+0.05(1.44205+1.686255)=1.39847

So y(0.3)≈1.3985y(0.3)\approx1.3985 (exact value 2e0.3−1.3=1.39972e^{0.3}-1.3=1.3997).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2024 · 10 marks

How can x we use Laterpolation techniques (methods) to approximate the value of the integral for the functions whose antiderivative can't be found? Explain. Write a program to solve sin x - 2x + 1 = 0 using Bisection method.

Answer

Numerical integration by interpolation. When the antiderivative of f(x)f(x) cannot be found in closed form (e.g. ∫e−x2dx\int e^{-x^2}dx), we replace f(x)f(x) by an interpolating polynomial Pn(x)P_n(x) through the tabulated points x0,…,xnx_0,\dots,x_n and integrate that instead:

∫abf(x) dx≈∫abPn(x) dx=∑i=0nwif(xi)\int_a^b f(x)\,dx\approx\int_a^b P_n(x)\,dx=\sum_{i=0}^{n}w_i f(x_i)

Polynomials are easy to integrate exactly. With equally spaced nodes this gives the Newton-Cotes formulas: a degree-1 polynomial gives the trapezoidal rule h2[f0+f1]\frac h2[f_0+f_1], degree 2 gives Simpson's 1/3 rule h3[f0+4f1+f2]\frac h3[f_0+4f_1+f_2], degree 3 gives Simpson's 3/8 rule. Joining many sub-intervals gives the composite rules, whose error falls as hh decreases.

Program (C): bisection for sin⁡x−2x+1=0\sin x-2x+1=0. f(0)=1>0f(0)=1>0, f(1)=−0.159<0f(1)=-0.159<0, so a root lies in [0,1][0,1].

#include <stdio.h>
#include <math.h>

double f(double x) { return sin(x) - 2*x + 1; }

int main() {
    double a = 0, b = 1, c, tol = 0.00001;
    if (f(a) * f(b) > 0) {
        printf("Root not bracketed\n");
        return 0;
    }
    do {
        c = (a + b) / 2;
        if (f(a) * f(c) < 0) b = c;
        else a = c;
    } while (fabs(b - a) > tol);
    c = (a + b) / 2;
    printf("Root = %.5f\n", c);
    return 0;
}

The program prints a root of about 0.88780.8878.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 · 5 marks

What do you mean by true error? Find a positive root of equation x2=1x^2 = 1, which lies between 0 and 1 using bisection method.

Answer

True error. The difference between the exact (true) value and the approximate value: Et=xtrue−xapproxE_t=x_{true}-x_{approx}. Its ratio to the true value, as a percentage, is the relative true error.

Bisection for x2−1=0x^2-1=0 on [0,1][0,1]. f(x)=x2−1f(x)=x^2-1, f(0)=−1<0f(0)=-1<0, f(1)=0f(1)=0. The positive root is exactly x=1x=1, at the upper end of the interval, and bisection approaches it:

nabc=(a+b)/2f(c)
1010.5-0.75
20.510.75-0.4375
30.7510.875-0.2344
40.87510.9375-0.1211
50.937510.96875-0.0615

Since f(c)<0f(c)<0 at every step, aa keeps moving to cc and the midpoints tend to 11. The root is x=1x=1 (true error →0\to0; after 5 steps the error is already about 0.030.03).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 · 5 marks

Solve the following system of equations by Gauss elimination method.
2x+y+4z=122x + y + 4z = 12
8x−3y+2z=238x - 3y + 2z = 23
4x+11y−z=334x + 11y - z = 33

Answer

Augmented matrix:

[214128−3223411−133]\left[\begin{array}{ccc|c}2&1&4&12\\8&-3&2&23\\4&11&-1&33\end{array}\right]

Forward elimination. R2→R2−4R1R_2\to R_2-4R_1, R3→R3−2R1R_3\to R_3-2R_1:

[214120−7−14−2509−99]\left[\begin{array}{ccc|c}2&1&4&12\\0&-7&-14&-25\\0&9&-9&9\end{array}\right]

R3→R3+97R2R_3\to R_3+\frac97R_2:

−9−9⋅147=−27,9−9⋅257=−1627-9-\frac{9\cdot14}{7}=-27,\qquad 9-\frac{9\cdot25}{7}=-\frac{162}{7}

so −27z=−1627-27z=-\dfrac{162}{7}.

Back substitution.

z=1627⋅27=67z=\frac{162}{7\cdot27}=\frac67 −7y−14(67)=−25⇒−7y=−13⇒y=137-7y-14\left(\frac67\right)=-25\Rightarrow -7y=-13\Rightarrow y=\frac{13}{7} 2x+137+247=12⇒2x=477⇒x=47142x+\frac{13}{7}+\frac{24}{7}=12\Rightarrow 2x=\frac{47}{7}\Rightarrow x=\frac{47}{14}

x=3.357,y=1.857,z=0.857x=3.357,\quad y=1.857,\quad z=0.857

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 · 5 marks

Write a program to compute value of yy when x=2x = 2 such that dydx=3x2+1\frac{dy}{dx} = 3x^2 + 1 with y(1)=2y(1) = 2 and h=0.25h = 0.25 using Euler's method.

Answer

Euler's method: yn+1=yn+h f(xn,yn)y_{n+1}=y_n+h\,f(x_n,y_n) with f=3x2+1f=3x^2+1, x0=1x_0=1, y0=2y_0=2, h=0.25h=0.25; four steps reach x=2x=2.

#include <stdio.h>

double f(double x, double y) { return 3*x*x + 1; }

int main() {
    double x = 1, y = 2, h = 0.25, xn = 2;
    printf("x\ty\n%.2f\t%.5f\n", x, y);
    while (x < xn - 1e-9) {
        y = y + h * f(x, y);
        x = x + h;
        printf("%.2f\t%.5f\n", x, y);
    }
    printf("y(%.1f) = %.5f\n", xn, y);
    return 0;
}

Output of the iteration:

xy
1.002.00000
1.253.00000
1.504.42188
1.756.35938
2.008.90625

So y(2)≈8.906y(2)\approx8.906 (the exact value y=x3+xy=x^3+x gives 1010; the difference is Euler's truncation error for h=0.25h=0.25).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 · 5 marks

Find the largest Eigen value and corresponding Eigen vector of the following matrix using power method. [12021000−1]\begin{bmatrix} 1 & 2 & 0 \\ 2 & 1 & 0 \\ 0 & 0 & -1 \end{bmatrix}

Answer

Start with X0=(1,1,1)TX_0=(1,1,1)^T and repeatedly compute AXkAX_k, dividing by the largest component.

AX0=(3,3,−1)T=3 (1, 1, −0.3333)TAX_0=(3,3,-1)^T=3\,(1,\,1,\,-0.3333)^T AX1=(3, 3, 0.3333)T=3 (1, 1, 0.1111)TAX_1=(3,\,3,\,0.3333)^T=3\,(1,\,1,\,0.1111)^T AX2=(3, 3, −0.1111)T=3 (1, 1, −0.0370)TAX_2=(3,\,3,\,-0.1111)^T=3\,(1,\,1,\,-0.0370)^T AX3=(3, 3, 0.0370)T=3 (1, 1, 0.0123)TAX_3=(3,\,3,\,0.0370)^T=3\,(1,\,1,\,0.0123)^T

The scale factor stays at 33 and the third component tends to 00.

Largest eigenvalue λ≈3\lambda\approx3, with eigenvector ≈(1, 1, 0)T\approx(1,\,1,\,0)^T.

Check: A(1,1,0)T=(3,3,0)T=3(1,1,0)TA(1,1,0)^T=(3,3,0)^T=3(1,1,0)^T. (The other eigenvalues are −1,−1-1,-1, so convergence is geometric with ratio 1/31/3.)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 · 10 marks

What do you mean by ill condition? Solve the following system using Jacobi iteration method.
2a+b+c=52a + b + c = 5
3a+5b+2c=153a + 5b + 2c = 15
2a+b+4c=82a + b + 4c = 8

Answer

Ill-conditioned system. A system Ax=bAx=b is ill-conditioned when a small change in the coefficients or in bb (or a small rounding error) causes a large change in the solution. The coefficient matrix is nearly singular (determinant close to zero, large condition number κ(A)=∥A∥∥A−1∥\kappa(A)=\|A\|\|A^{-1}\|). Example: x+y=2,  x+1.001y=2.001x+y=2,\;x+1.001y=2.001 has solution (1,1)(1,1) but x+1.001y=2.002x+1.001y=2.002 gives (0,2)(0,2).

Jacobi iteration. Rewrite each equation for its diagonal unknown and use only the previous iterate:

a(k+1)=5−b(k)−c(k)2,b(k+1)=15−3a(k)−2c(k)5,c(k+1)=8−2a(k)−b(k)4a^{(k+1)}=\frac{5-b^{(k)}-c^{(k)}}{2},\quad b^{(k+1)}=\frac{15-3a^{(k)}-2c^{(k)}}{5},\quad c^{(k+1)}=\frac{8-2a^{(k)}-b^{(k)}}{4}

Start with (0,0,0)(0,0,0):

kabc
12.53.02.0
20.00.70.0
32.153.01.825
40.08750.980.175
51.92252.87751.7112
60.20561.1620.3194
71.75932.74891.6067

The system is only weakly diagonally dominant, so the iterates oscillate and converge slowly towards the exact solution

a=1,b=2,c=1a=1,\quad b=2,\quad c=1

which satisfies all three equations (2+2+1=52+2+1=5, 3+10+2=153+10+2=15, 2+2+4=82+2+4=8).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 · 10 marks

How interpolation is differ from regression? Write down algorithm and program for Lagrange interpolation polynomial.

Answer

Interpolation vs regression.

InterpolationRegression (curve fitting)
The curve passes exactly through every given data pointThe curve follows the general trend and need not pass through any point
Used when data are accurate (tabulated values)Used when data contain noise or experimental error
Degree of polynomial depends on number of points (n+1n+1 points, degree nn)Degree chosen independently, usually much smaller than the number of points
Estimates values between the given pointsGives a best-fit model by minimising the sum of squared errors

Lagrange interpolation. For points (xi,yi)(x_i,y_i), i=0,…,ni=0,\dots,n:

P(x)=∑i=0nyi∏j=0j≠inx−xjxi−xjP(x)=\sum_{i=0}^{n}y_i\prod_{\substack{j=0\\j\ne i}}^{n}\frac{x-x_j}{x_i-x_j}

Algorithm.

  1. Read nn, the data points (xi,yi)(x_i,y_i) and the value xx to interpolate.
  2. Set sum=0sum=0.
  3. For i=0i=0 to nn: set term=yiterm=y_i; for j=0j=0 to nn, j≠ij\ne i: term=term×(x−xj)/(xi−xj)term=term\times(x-x_j)/(x_i-x_j); then sum=sum+termsum=sum+term.
  4. Print sumsum as P(x)P(x).

Program (C).

#include <stdio.h>

int main() {
    int n, i, j;
    float x[20], y[20], xp, term, sum = 0;
    printf("Enter number of points: ");
    scanf("%d", &n);
    printf("Enter x and y values:\n");
    for (i = 0; i < n; i++)
        scanf("%f %f", &x[i], &y[i]);
    printf("Enter x to interpolate: ");
    scanf("%f", &xp);
    for (i = 0; i < n; i++) {
        term = y[i];
        for (j = 0; j < n; j++)
            if (j != i)
                term *= (xp - x[j]) / (x[i] - x[j]);
        sum += term;
    }
    printf("f(%.3f) = %.4f\n", xp, sum);
    return 0;
}

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2025 · 10 marks

What is fixed point iteration method? How it converge the root of non-linear equation? Find the root of equation f(x)=x2−3x+2f(x) = x^2 - 3x + 2 using N-R method.

Answer

Fixed point iteration. To solve f(x)=0f(x)=0, rewrite it as x=g(x)x=g(x) and iterate

xn+1=g(xn),n=0,1,2,…x_{n+1}=g(x_n),\qquad n=0,1,2,\dots

from an initial guess x0x_0. A solution α=g(α)\alpha=g(\alpha) is a fixed point of gg.

Convergence. If gg and g′g' are continuous near the root and ∣g′(x)∣<1|g'(x)|<1 for all xx in an interval around α\alpha containing x0x_0, then the iterates converge to α\alpha, since the error satisfies en+1≈g′(α) ene_{n+1}\approx g'(\alpha)\,e_n. The smaller ∣g′(α)∣|g'(\alpha)|, the faster the convergence (linear, order 1); if ∣g′∣>1|g'|>1 it diverges.

Newton-Raphson for f(x)=x2−3x+2f(x)=x^2-3x+2.

xn+1=xn−f(xn)f′(xn)=xn−xn2−3xn+22xn−3x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}=x_n-\frac{x_n^2-3x_n+2}{2x_n-3}

Take x0=0x_0=0:

nx_nf(x_n)f'(x_n)x_{n+1}
002-30.6667
10.66670.4444-1.66670.9333
20.93330.0711-1.13330.9961
30.99610.0039-1.00780.99998

The iterates converge to the root x=1x=1. (The other root, x=2x=2, is obtained from a starting value such as x0=3x_0=3; indeed x2−3x+2=(x−1)(x−2)x^2-3x+2=(x-1)(x-2).)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2026 · 5 marks

Explain different types of errors in numerical computation with examples.

Answer

An error is the difference between the exact value and the value obtained in computation. The main types are:

  1. Inherent (input) error. Error already present in the data, due to faulty measurement or approximate input. Example: using π=3.14\pi=3.14 or a length measured as 12.312.3 cm when it is really 12.3412.34 cm.
  2. Round-off error. Caused by representing numbers with a finite number of digits (rounding or chopping). Example: 13=0.3333\frac13=0.3333 stored to four digits; the error 0.0000333…0.0000333\ldots is round-off error. It accumulates over many operations.
  3. Truncation error. Caused by cutting off an infinite process after finitely many terms. Example: ex≈1+x+x22!+x33!e^x\approx1+x+\frac{x^2}{2!}+\frac{x^3}{3!} ignores the remaining terms; replacing a derivative by a finite difference.
  4. Blunders (gross errors). Human or programming mistakes, such as a wrong formula or a transposed digit.
  5. Modelling error. Error from simplifying assumptions in the mathematical model (e.g. ignoring air resistance).

Measures of error.

  • Absolute error: Ea=∣xtrue−xapprox∣E_a=|x_{true}-x_{approx}|
  • Relative error: Er=Ea∣xtrue∣E_r=\dfrac{E_a}{|x_{true}|}
  • Percentage error: Er×100%E_r\times100\%

Example: for true value 2.52.5 and approximation 2.42.4, Ea=0.1E_a=0.1, Er=0.04E_r=0.04, i.e. 4%4\%.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2026 · 5 marks

Apply Bisection Method to find a real root of x³ − x − 1 = 0 correct up to three decimal places.

Answer

Let f(x)=x3−x−1f(x)=x^3-x-1. f(1)=−1<0f(1)=-1<0 and f(2)=5>0f(2)=5>0, so a root lies in [1,2][1,2].

nabc=(a+b)/2f(c)
1121.50.875
211.51.25-0.2969
31.251.51.3750.2246
41.251.3751.3125-0.0515
51.31251.3751.343750.0826
61.31251.343751.328130.0146
71.31251.328131.32031-0.0187
81.320311.328131.32422-0.0021
91.324221.328131.326170.0062
101.324221.326171.325200.0020
111.324221.325201.32471-0.00005

The interval is now [1.32471, 1.32520][1.32471,\,1.32520], of width below 0.00050.0005, so the root correct to three decimal places is

x≈1.325x\approx1.325

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2026 · 5 marks

Derive Newton’s forward interpolation formula.

Answer

Let y=f(x)y=f(x) be given at equally spaced points xi=x0+ihx_i=x_0+ih, i=0,…,ni=0,\dots,n, with yi=f(xi)y_i=f(x_i). The forward difference operator is Δyi=yi+1−yi\Delta y_i=y_{i+1}-y_i, and Eyi=yi+1E y_i=y_{i+1}, so E=1+ΔE=1+\Delta.

Let x=x0+phx=x_0+ph, i.e. p=x−x0hp=\dfrac{x-x_0}{h}. Then

f(x)=f(x0+ph)=Epy0=(1+Δ)py0f(x)=f(x_0+ph)=E^{p}y_0=(1+\Delta)^{p}y_0

Expand by the binomial theorem:

(1+Δ)p=1+pΔ+p(p−1)2!Δ2+p(p−1)(p−2)3!Δ3+⋯(1+\Delta)^p=1+p\Delta+\frac{p(p-1)}{2!}\Delta^2+\frac{p(p-1)(p-2)}{3!}\Delta^3+\cdots

Hence Newton's forward interpolation formula:

y(x)=y0+p Δy0+p(p−1)2!Δ2y0+p(p−1)(p−2)3!Δ3y0+⋯+p(p−1)⋯(p−n+1)n!Δny0y(x)=y_0+p\,\Delta y_0+\frac{p(p-1)}{2!}\Delta^2y_0+\frac{p(p-1)(p-2)}{3!}\Delta^3y_0+\cdots+\frac{p(p-1)\cdots(p-n+1)}{n!}\Delta^ny_0

It is a polynomial of degree nn passing through the n+1n+1 points, and is best used for xx near the beginning of the table.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2026 · 5 marks

Solve dx/dy=x+y, y(0) = 1 using Euler’s method (h = 0.1) for x = 0.1.

Answer

The equation is read as dydx=x+y\dfrac{dy}{dx}=x+y with y(0)=1y(0)=1, h=0.1h=0.1 (the given dx/dydx/dy is a misprint for dy/dxdy/dx).

Euler's method: yn+1=yn+h f(xn,yn)y_{n+1}=y_n+h\,f(x_n,y_n).

y(0.1)≈y1=y0+h(x0+y0)=1+0.1(0+1)=1.1y(0.1)\approx y_1=y_0+h(x_0+y_0)=1+0.1(0+1)=1.1

So y(0.1)≈1.1y(0.1)\approx1.1. (The exact solution y=2ex−x−1y=2e^x-x-1 gives 1.11031.1103.)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2026 · 5 marks

Apply Trapezoidal rule to evaluate a definite integral.

Answer

Trapezoidal rule. To evaluate I=∫abf(x) dxI=\int_a^b f(x)\,dx, divide [a,b][a,b] into nn equal sub-intervals of width h=b−anh=\dfrac{b-a}{n}, with xi=a+ihx_i=a+ih and yi=f(xi)y_i=f(x_i). On each sub-interval the curve is replaced by a straight line, so the area is a trapezium of area h2(yi+yi+1)\frac h2(y_i+y_{i+1}). Summing:

I≈h2[y0+2(y1+y2+⋯+yn−1)+yn]I\approx\frac h2\Big[y_0+2(y_1+y_2+\cdots+y_{n-1})+y_n\Big]

The error is of order h2h^2: E=−(b−a)12h2f′′(ξ)E=-\dfrac{(b-a)}{12}h^2f''(\xi).

Example. Evaluate ∫01dx1+x2\int_0^1\dfrac{dx}{1+x^2} with n=4n=4, h=0.25h=0.25.

x00.250.50.751
y10.941180.80.640.5

I≈0.252[1+0.5+2(0.94118+0.8+0.64)]=0.125×6.26236=0.78279I\approx\frac{0.25}{2}\Big[1+0.5+2(0.94118+0.8+0.64)\Big]=0.125\times6.26236=0.78279

The exact value is π/4=0.7854\pi/4=0.7854.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2026 · 10 marks

Explain Shooting Method for boundary value problems with algorithm.

Answer

Boundary value problem (BVP). A second-order differential equation whose conditions are given at two points:

y′′=f(x,y,y′),y(a)=α,y(b)=βy''=f(x,y,y'),\qquad y(a)=\alpha,\quad y(b)=\beta

Shooting method. The BVP is converted into an initial value problem (IVP) by guessing the missing initial slope. Treat the slope y′(a)=sy'(a)=s as an unknown, solve the IVP

y′′=f(x,y,y′),y(a)=α,y′(a)=sy''=f(x,y,y'),\quad y(a)=\alpha,\quad y'(a)=s

up to x=bx=b (using Runge-Kutta or Euler on the equivalent first-order system y′=z,  z′=f(x,y,z)y'=z,\;z'=f(x,y,z)), and obtain y(b;s)y(b;s). The aim is to choose ss so that the "shot" lands on the target:

ϕ(s)=y(b;s)−β=0\phi(s)=y(b;s)-\beta=0

This is a root-finding problem in ss, solved by the secant method, bisection or Newton's method. For a linear BVP, ϕ\phi is linear in ss, so two shots suffice:

s=s1+(β−y(b;s1))(s2−s1)y(b;s2)−y(b;s1)s=s_1+\frac{(\beta-y(b;s_1))(s_2-s_1)}{y(b;s_2)-y(b;s_1)}

Algorithm.

  1. Read a,b,α,βa,b,\alpha,\beta, step size hh, tolerance ε\varepsilon.
  2. Choose two initial guesses s0,s1s_0,s_1 for y′(a)y'(a).
  3. For each guess, solve the IVP y′=z,  z′=f(x,y,z)y'=z,\;z'=f(x,y,z) with y(a)=αy(a)=\alpha, z(a)=sz(a)=s from aa to bb, and record y(b;s0)y(b;s_0), y(b;s1)y(b;s_1).
  4. Compute the new slope by the secant formula sk+1=sk−ϕ(sk)(sk−sk−1)ϕ(sk)−ϕ(sk−1)s_{k+1}=s_k-\frac{\phi(s_k)(s_k-s_{k-1})}{\phi(s_k)-\phi(s_{k-1})}
  5. Solve the IVP with sk+1s_{k+1} and compute ϕ(sk+1)\phi(s_{k+1}).
  6. If ∣ϕ(sk+1)∣<ε|\phi(s_{k+1})|<\varepsilon, stop; the last IVP solution is the required solution of the BVP. Otherwise set k=k+1k=k+1 and go to step 4.

Remarks. It is simple and reuses IVP solvers, but may be unstable for stiff problems or when the solution is very sensitive to ss; then the finite difference method or multiple shooting is preferred.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2026 · 10 marks

Differentiate between Interpolation and approximation with their significances. Derive the formula for Simpson’s (3/8) composite formula.

Answer

Interpolation vs approximation.

InterpolationApproximation
Constructs a function that passes exactly through all the given data pointsConstructs a simpler function that is close to the data or to f(x)f(x) over an interval, not necessarily through the points
Used for accurate tabulated data; estimates values between pointsUsed for noisy data or to replace a complicated function; fits by least squares or minimax
Degree grows with number of pointsDegree chosen freely and kept low
Error is zero at the nodesError is small overall but non-zero everywhere

Significance: interpolation fills gaps in tables, and underlies numerical differentiation and integration. Approximation smooths experimental data, predicts trends, and replaces functions that are expensive to evaluate.

Simpson's 3/8 composite rule. Fit a cubic through four points x0,x1,x2,x3x_0,x_1,x_2,x_3 (xi=x0+ihx_i=x_0+ih). Using Newton's forward formula with x=x0+phx=x_0+ph, dx=h dpdx=h\,dp:

∫x0x3y dx=h∫03[y0+pΔy0+p(p−1)2Δ2y0+p(p−1)(p−2)6Δ3y0]dp\int_{x_0}^{x_3}y\,dx=h\int_0^3\left[y_0+p\Delta y_0+\frac{p(p-1)}2\Delta^2y_0+\frac{p(p-1)(p-2)}6\Delta^3y_0\right]dp

Using ∫03p dp=92\int_0^3p\,dp=\frac92, ∫03p(p−1)2dp=94\int_0^3\frac{p(p-1)}2dp=\frac94, ∫03p(p−1)(p−2)6dp=38\int_0^3\frac{p(p-1)(p-2)}6dp=\frac38:

=h[3y0+92Δy0+94Δ2y0+38Δ3y0]=h\left[3y_0+\frac92\Delta y_0+\frac94\Delta^2y_0+\frac38\Delta^3y_0\right]

Substituting Δy0=y1−y0\Delta y_0=y_1-y_0, Δ2y0=y2−2y1+y0\Delta^2y_0=y_2-2y_1+y_0, Δ3y0=y3−3y2+3y1−y0\Delta^3y_0=y_3-3y_2+3y_1-y_0:

=3h8[y0+3y1+3y2+y3]=\frac{3h}{8}\Big[y_0+3y_1+3y_2+y_3\Big]

(The coefficient of y0y_0 is 3−92+94−38=383-\frac92+\frac94-\frac38=\frac38; of y1y_1: 92−92+98=98\frac92-\frac92+\frac98=\frac98, and so on.)

Composite form. For nn sub-intervals (nn a multiple of 3), h=b−anh=\dfrac{b-a}{n}, apply the rule to each block of three sub-intervals and add. Interior nodes that are multiples of 3 are shared by two blocks and get weight 22; the others get weight 33:

∫abf(x) dx≈3h8[y0+yn+3(y1+y2+y4+y5+⋯+yn−2+yn−1)+2(y3+y6+⋯+yn−3)]\int_a^b f(x)\,dx\approx\frac{3h}{8}\Big[y_0+y_n+3(y_1+y_2+y_4+y_5+\cdots+y_{n-2}+y_{n-1})+2(y_3+y_6+\cdots+y_{n-3})\Big]

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

Questions from TU BCA 2020 Fourth Semester Operating System (TU board exam, 2020), TU BCA 2021 Fourth Semester Operating System (TU board exam, 2021), TU BCA 2022 Fourth Semester Operating System (TU board exam, 2022), TU BCA 2023 Fourth Semester Operating System (TU board exam, 2023), TU BCA 2024 Fourth Semester Operating System (TU board exam, 2024), TU BCA 2025 Fourth Semester Operating System (TU board exam, 2025), TU BCA 2026 Fourth Semester Operating System (TU board exam, 2026), TU BCA 2020 Fourth Semester Database Management System (TU board exam, 2020), TU BCA 2021 Fourth Semester Database Management System (TU board exam, 2021), TU BCA 2022 Fourth Semester Database Management System (TU board exam, 2022), TU BCA 2023 Fourth Semester Database Management System (TU board exam, 2023), TU BCA 2024 Fourth Semester Database Management System (TU board exam, 2024), TU BCA 2025 Fourth Semester Database Management System (TU board exam, 2025), TU BCA 2026 Fourth Semester Database Management System (TU board exam, 2026), TU BCA 2020 Fourth Semester Software Engineering (TU board exam, 2020), TU BCA 2021 Fourth Semester Software Engineering (TU board exam, 2021), TU BCA 2022 Fourth Semester Software Engineering (TU board exam, 2022), TU BCA 2023 Fourth Semester Software Engineering (TU board exam, 2023), TU BCA 2024 Fourth Semester Software Engineering (TU board exam, 2024), TU BCA 2025 Fourth Semester Software Engineering (TU board exam, 2025), TU BCA 2026 Fourth Semester Software Engineering (TU board exam, 2026), TU BCA 2020 Fourth Semester Numerical Method (TU board exam, 2020), TU BCA 2021 Fourth Semester Numerical Method (TU board exam, 2021), TU BCA 2022 Fourth Semester Numerical Method (TU board exam, 2022), TU BCA 2023 Fourth Semester Numerical Method (TU board exam, 2023), TU BCA 2024 Fourth Semester Numerical Method (TU board exam, 2024), TU BCA 2025 Fourth Semester Numerical Method (TU board exam, 2025), TU BCA 2026 Fourth Semester Numerical Method (TU board exam, 2026), TU BCA 2019 Fourth Semester Scripting Language (TU board exam, 2019), TU BCA 2020 Fourth Semester Scripting Language (TU board exam, 2020), TU BCA 2021 Fourth Semester Scripting Language (TU board exam, 2021), TU BCA 2022 Fourth Semester Scripting Language (TU board exam, 2022), TU BCA 2023 Fourth Semester Scripting Language (TU board exam, 2023), TU BCA 2024 Fourth Semester Scripting Language (TU board exam, 2024), TU BCA 2025 Fourth Semester Scripting Language (TU board exam, 2025) and TU BCA 2026 Fourth Semester Scripting Language (TU board exam, 2026). Answers are written for this site; check them against your class notes.