Chapter 1
Numerical Method
TU BSc CSIT past exam questions
Past questions and answers
70 questions set from this chapter, 1 of them more than once; 1 is most repeated (set, or a close variant set, in 3 or more exams). Most repeated first.
- Most repeated · 3 of 8 exams
- 2079 · 5 marks
Solve the Poisson’s equation ∇^2f=3x^2y over the square domain 0 ≤ x ≤ 3, 0 ≤ y ≤ 3 with f=0 on the boundary and h=1.
Similar questions: Solve the Poison’s equation over the square (2075) · Solve the Poisson’s equation ∇²f = xy (2080)
Answer
Poisson's equation by finite differences. With a square grid of step , the five-point formula for is
Here on , so the interior points are and gives
Boundary values are all zero. Writing :
Subtracting equation 3 from equation 2: .
Let . Adding equations 2 and 3 gives , so . Adding equations 1 and 4 gives . Substituting:
Then , so , , and . From equation 1: , hence .
Check eq. 4: . Correct.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- Asked 2 times
- 2079 · 5 marks
- 2080 · 5 marks
Write down the program for solving ordinary differential equation using Heun’s method.
Answer
Heun's method. For , , with step :
Algorithm.
- Read , , step size and the final value .
- Compute the number of steps .
- Repeat times: ; ; ; ; ; print .
Program (C). The example equation is ; change f for another problem.
#include <stdio.h>
#include <math.h>
double f(double x, double y) {
return x + y; /* dy/dx = f(x, y) */
}
int main(void) {
double x0, y0, xn, h, x, y, k1, k2, yp;
int i, n;
printf("Enter x0, y0: ");
scanf("%lf %lf", &x0, &y0);
printf("Enter final x and step size h: ");
scanf("%lf %lf", &xn, &h);
n = (int)floor((xn - x0) / h + 0.5);
x = x0;
y = y0;
printf("%10s %12s\n", "x", "y");
printf("%10.4f %12.6f\n", x, y);
for (i = 0; i < n; i++) {
k1 = f(x, y);
yp = y + h * k1; /* predictor (Euler) */
k2 = f(x + h, yp);
y = y + h / 2.0 * (k1 + k2); /* corrector (trapezoidal) */
x = x + h;
printf("%10.4f %12.6f\n", x, y);
}
return 0;
}
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 8 marks
Evaluate the following integration using Romberg integration.
Similar questions: Evaluate the following integration using Romberg integration (2078)
Answer
Romberg integration improves trapezoidal estimates by Richardson extrapolation:
Here with (limit), .
Function values: , , , , .
Trapezoidal estimates
- :
- :
- :
- : (adding the four new midpoints )
Romberg table
| (trapezoidal) | ||||
|---|---|---|---|---|
| 1 | 0.920735 | |||
| 0.5 | 0.939793 | 0.946146 | ||
| 0.25 | 0.944514 | 0.946087 | 0.946083 | |
| 0.125 | 0.945691 | 0.946083 | 0.946083 | 0.946083 |
Sample extrapolations:
Successive entries agree to six decimals, so
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 8 marks
Solve the following set of equations using Gauss Seidel method.
x + 2y + 3z = 4
6x – 4y + 5z = 10
5x + 2y + 2z = 25
Similar questions: Solve the following set of equations using (2079)
Answer
Condition for convergence. Gauss-Seidel converges when the coefficient matrix is diagonally dominant (sufficient condition). In the order given, the system is not diagonally dominant, and the iteration diverges. No re-ordering makes the matrix strictly diagonally dominant, but the order below makes the iteration converge (spectral radius ):
Iteration formulas (latest values are used immediately):
Start with .
| Iter | |||
|---|---|---|---|
| 1 | 5.0000 | -0.5000 | -4.4000 |
| 2 | 6.9600 | 5.1200 | -2.2560 |
| 3 | 3.8544 | 3.4568 | 0.1402 |
| 4 | 3.5612 | 0.0092 | -2.2661 |
| 5 | 5.9028 | 2.4478 | -3.1251 |
| 6 | 5.2709 | 4.0522 | -1.0833 |
| 10 | 4.5331 | 2.7784 | -1.2170 |
| 20 | 4.8523 | 2.5477 | -1.7846 |
| 30 | 4.8113 | 2.3958 | -1.8569 |
| 40 | 4.7908 | 2.3729 | -1.8507 |
| 60 | 4.7883 | 2.3748 | -1.8461 |
Example, iteration 1: ; ; .
The iterates oscillate and settle slowly (the convergence is slow because the system is only weakly dominant). They approach
Check by direct elimination. Eliminating gives the exact solution . Substitution in the original equations: , , . All three equations are satisfied.
So .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 8 marks
Solve the Poison’s equation over the square domain 0 ≤ x ≤ 1.5, 0 ≤ y ≤ 1.5 with f = 0 on the boundary and h = 0.5.
Similar questions: Solve the Poisson’s equation ∇^2f=3x^2y over the (2079)
Answer
Setting up. Poisson's equation is . Using the five-point central difference formula on a square grid of side :
With and , the grid points are , a grid. The boundary nodes (12 points) all have the prescribed value . The interior nodes are , which we call :
u3 u4
u1 u2
Equations. The source term is (as given in the question), so the equation is (Laplace form). For each interior node:
- :
- :
- :
- :
By symmetry , so .
Check by elimination: adding all four equations gives , so the sum is , and then each equation with the symmetric structure gives .
Remark. If a non-zero source were supplied, then by symmetry each interior node would satisfy , i.e. for a constant . With and zero boundary values, the solution is identically zero.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2077 · 8 marks
Construct Newton’s forward difference table for the given data points and approximate the value of f(x) at x = 15.
x 10 20 30 40 50 F(x) 0.173 0.342 0.5 0.643 0.766
Similar questions: Construct Newton’s backward difference table for given (2080)
Answer
Forward difference table ()
| 10 | 0.173 | 0.169 | -0.011 | -0.004 | -0.001 |
| 20 | 0.342 | 0.158 | -0.015 | -0.005 | |
| 30 | 0.500 | 0.143 | -0.020 | ||
| 40 | 0.643 | 0.123 | |||
| 50 | 0.766 |
Newton's forward interpolation formula
For : .
Terms:
(The data are ; the true value of is .)
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
Evaluate the following integration using Romberg integration.
Similar questions: Evaluate the following integration using Romberg integration (2075)
Answer
Romberg integration. Romberg integration improves trapezoidal estimates by Richardson extrapolation. With the trapezoidal value using strips:
Problem. , (limit), .
- (1 strip):
- : , so
- : , , so
- : , , , (sum ), so
Romberg table:
| (trapezoid) | 1st extrapolation | 2nd extrapolation | 3rd extrapolation |
|---|---|---|---|
| 0.354037 | |||
| 0.406867 | 0.424477 | ||
| 0.419519 | 0.423737 | 0.423688 | |
| 0.422650 | 0.423694 | 0.423691 | 0.423691 |
For example and .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
Solve the following set of linear equations using the Gauss-Jordan method.
x_2 + 2x_3 + 3x_4 = 9
7x_1 + 6x_2 + 5x_3 + 4x_4 = 33
8x_1 + 9x_2 + x_4 = 27
2x_1 + 5x_2 + 4x_3 + 3x_4 = 23
Similar questions: Solve the following system of linear equations (2081)
Answer
Gauss-Jordan method. The augmented matrix is reduced to the identity (reduced row echelon form) by row operations, so the solution can be read directly from the last column.
Augmented matrix (equations written with all four unknowns):
The first pivot is zero, so interchange and normalise (), then eliminate column 1:
Normalise by its pivot and clear column 2 in all other rows:
Third stage (normalise : gives , then clear column 3):
Fourth stage (, then clear column 4):
Check in equation 2: . Correct.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
Solve the following set of equations using Gauss Siedal method.
x + 2y + 3z = 4
6x + 4y + 5z = 16
5x + 2y + 3z = 12
Similar questions: Solve the following set of equations using (2075)
Answer
Gauss-Seidel method. Each unknown is solved from its own equation, always using the newest available values:
The method converges if the system is diagonally dominant (or if the iteration matrix has spectral radius below 1). The given equations are not diagonally dominant in any order, but taking them in the order
gives a convergent iteration (spectral radius ):
Start with :
| Iteration | |||
|---|---|---|---|
| 1 | 2.4000 | 0.4000 | 0.2667 |
| 2 | 2.0800 | 0.5467 | 0.2756 |
| 3 | 2.0160 | 0.6316 | 0.2403 |
| 4 | 2.0032 | 0.6948 | 0.2024 |
| 5 | 2.0006 | 0.7461 | 0.1691 |
| 10 | 2.0000 | 0.8980 | 0.0680 |
| 20 | 2.0000 | 0.9835 | 0.0110 |
| 30 | 2.0000 | 0.9973 | 0.0018 |
The values tend to (convergence in is slow). Verification: , , .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
Construct Newton’s backward difference table for given data points and approximate the value of f(x) at x=45.
x 10 20 30 40 50 f(x) 0.985 0.934 0.866 0.766 0.643
Similar questions: Construct Newton’s forward difference table for the (2077)
Answer
Backward difference table (, )
| 10 | 0.985 | ||||
| 20 | 0.934 | ||||
| 30 | 0.866 | ||||
| 40 | 0.766 | ||||
| 50 | 0.643 |
Newton's backward formula
Here , so .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
Solve the Poisson’s equation ∇²f = xy and f=2 on boundary by assuming square domain 0 ≤ x ≤ 3 and 0 ≤ y ≤ 3 and h=1.
Similar questions: Solve the Poisson’s equation ∇^2f=3x^2y over the (2079)
Answer
Finite-difference form. With equal step in both directions, the five-point formula for is
The grid has . The interior points are ; all boundary values are . Let , , , .
- At , :
- At , :
- At , :
- At , :
By symmetry :
Second equation: . Substituting in the first: . Then , .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
Solve the following system of linear equations using Gauss-Jordan elimination method.
x+2y-3z=4
2x+4y-6z=8
x-2y+5z=4
Similar questions: Solve the following set of linear equations (2078)
Answer
Augmented matrix:
, :
Interchange (to bring a non-zero pivot up), then :
:
The last row is , so there are only two independent equations for three unknowns: the second equation of the system is twice the first. The system is consistent with infinitely many solutions. Taking as a free parameter:
Check with : gives , , . All three equations hold.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 2 marks
What is non-linear equation? Derive the required expression to calculate the root of non-linear equation using secant method. Using this expression find a root of following equation.
Answer
Non-linear equation. An equation in which is not a linear function of the unknown (it contains terms such as , , , ) is called a non-linear equation. Such equations usually cannot be solved in closed form, so a root is found by an iterative numerical method.
Derivation of the secant method. Let and be two approximations of the root. Draw the secant line through and and take the point where it cuts the -axis as the next approximation .
The slope of the secant is
The line through with this slope is . Putting , :
This is Newton's formula with replaced by the finite-difference slope, so no derivative is needed. The order of convergence is about .
Solving (angles in radians).
, , so a root lies in . Take , .
| n | |||||
|---|---|---|---|---|---|
| 1 | 1 | 2 | -0.82758 | 1.44852 | 1.36360 |
| 2 | 2 | 1.36360 | 1.44852 | -0.19063 | 1.43761 |
| 3 | 1.36360 | 1.43761 | -0.19063 | -0.03799 | 1.45603 |
| 4 | 1.43761 | 1.45603 | -0.03799 | 0.00137 | 1.45539 |
| 5 | 1.45603 | 1.45539 | 0.00137 | -0.00001 | 1.45539 |
Example of one step: .
The successive values agree to five decimals, so the root is
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 2 marks
What is matrix factorization? Factorize the given matrix A into LU using Doolittle algorithm and also solve Ax = b for given b using L and U matrices.
A = and b =
Answer
Matrix factorization. Matrix factorization (decomposition) writes a matrix as a product of simpler matrices. In LU factorization, where is lower triangular and is upper triangular. Then is solved in two easy triangular steps: (forward substitution) and (back substitution).
Doolittle algorithm. has a unit diagonal (). For :
Factorization of A.
Row 1 of : .
Column 1 of : .
Row 2 of : , , .
Column 2 of : , .
Row 3 of : , .
Column 3 of : .
Row 4 of : .
Solving Ax = b.
Forward substitution :
Back substitution :
Check in the first equation: . In the last: . Both are correct.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 2 marks
What is initial value problem and boundary value problem? Write an algorithm and program to solve the boundary value problem using shooting method.
Answer
Initial value problem (IVP). A differential equation whose auxiliary conditions are all given at the same point. Example: with . It can be marched forward directly (Euler, Runge-Kutta).
Boundary value problem (BVP). A differential equation whose conditions are given at two different points. Example: with . Since is unknown, direct marching is not possible.
Shooting method. The BVP is converted into an IVP by guessing the missing initial slope . The IVP is solved (here by RK4) up to , and the computed end value is compared with the required . The mismatch is a non-linear equation in , solved with the secant method: For a linear ODE, is linear in , so one secant step gives the exact slope.
Algorithm
- Read , step , tolerance .
- Choose two guesses for .
- For each guess, write the ODE as the system with and integrate from to by RK4.
- Compute and .
- Compute the new slope by the secant formula; integrate again to get .
- If , stop and output the solution; otherwise set and repeat step 5.
Program (C): solves , , (exact solution ).
#include <stdio.h>
#include <math.h>
/* system: y' = z, z' = g(x,y,z) */
double g(double x, double y, double z) { return -y; }
/* integrate from a to b with n steps; return y(b); print table if pr */
double shoot(double a, double b, double alpha, double s, int n, int pr) {
double h = (b - a) / n, x = a, y = alpha, z = s;
double k1, k2, k3, k4, l1, l2, l3, l4;
int i;
for (i = 0; i < n; i++) {
k1 = h * z; l1 = h * g(x, y, z);
k2 = h * (z + l1 / 2); l2 = h * g(x + h / 2, y + k1 / 2, z + l1 / 2);
k3 = h * (z + l2 / 2); l3 = h * g(x + h / 2, y + k2 / 2, z + l2 / 2);
k4 = h * (z + l3); l4 = h * g(x + h, y + k3, z + l3);
y += (k1 + 2 * k2 + 2 * k3 + k4) / 6;
z += (l1 + 2 * l2 + 2 * l3 + l4) / 6;
x += h;
if (pr) printf("x = %.3f y = %.6f\n", x, y);
}
return y;
}
int main() {
double a = 0, b = 1, alpha = 0, beta = 1, eps = 1e-8;
double s0 = 0.5, s1 = 1.5, f0, f1, s2;
int n = 10, it;
f0 = shoot(a, b, alpha, s0, n, 0) - beta;
for (it = 0; it < 50; it++) {
f1 = shoot(a, b, alpha, s1, n, 0) - beta;
if (fabs(f1) < eps) break;
s2 = s1 - f1 * (s1 - s0) / (f1 - f0);
s0 = s1; f0 = f1; s1 = s2;
}
printf("Required slope y'(a) = %.6f\n", s1);
shoot(a, b, alpha, s1, n, 1);
return 0;
}
The program finds the slope and prints the solution at each grid point, ending with .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 8 marks
Calculate a real negative root of following equation using Newton’s method for polynomial.
Answer
Let . For a polynomial, Newton's method is carried out with synthetic division (Horner's scheme): dividing by gives the remainder ; dividing the quotient again by gives the remainder .
Locating the root. and . The sign change shows a negative root between and , close to . Take .
Iteration 1, :
First synthetic division (coefficients ):
Second division on :
Iteration 2, : so ; so .
Iteration 3, : , .
| n | ||||
|---|---|---|---|---|
| 0 | -2 | -1 | -16 | -2.0625 |
| 1 | -2.0625 | 0.06007 | -17.9462 | -2.05915 |
| 2 | -2.05915 | 0.000181 | -17.8384 | -2.05914 |
The values have converged to five decimals, so the real negative root is
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 8 marks
What is least squares approximation of fitting a function? How does it differ with polynomial interpolation? Explain with suitable example.
Answer
Least squares approximation. Given data points that usually contain measurement errors, we seek a simple function of a chosen form (line, parabola, exponential, etc.) that fits the trend of the data. The parameters are chosen to minimise the sum of squared residuals
For the straight line , setting and gives the normal equations For a polynomial of degree there are normal equations .
Difference from polynomial interpolation.
| Least squares fitting | Polynomial interpolation |
|---|---|
| Curve need not pass through the points; it follows the overall trend | Curve passes exactly through every given point |
| Low-degree function, independent of the number of points | Degree is for points |
| Suitable for noisy experimental data | Suitable for exact (tabulated) data |
| Minimises the sum of squared errors | Error at the nodes is zero |
| Stable; smooth | High degree gives wild oscillations between nodes |
Example. Data: .
.
The least squares line is . Its values at are , with residuals and . The line does not pass through any point exactly, but it is the best straight line in the least squares sense.
Interpolation through the same four points needs a cubic polynomial; it passes through all points with zero error at the nodes, but it is a more complicated curve and follows the scatter (including the error) of the data rather than the trend.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 8 marks
Find the lowest degree polynomial, which passes through the following points:
X -2 -1 1 2 3 4 F(x) -19 0 2 -3 -4 5 Using this polynomial estimate f(x) at x = 0
Answer
The points are not equally spaced, so Newton's divided difference form is used.
| 1st | 2nd | 3rd | 4th | 5th | ||
|---|---|---|---|---|---|---|
| -2 | -19 | |||||
| 19 | ||||||
| -1 | 0 | -6 | ||||
| 1 | 1 | |||||
| 1 | 2 | -2 | 0 | |||
| -5 | 1 | 0 | ||||
| 2 | -3 | 2 | 0 | |||
| -1 | 1 | |||||
| 3 | -4 | 5 | ||||
| 9 | ||||||
| 4 | 5 |
Sample calculations:
- , , , ,
- , , ,
- , ,
The third divided differences are all equal to , so the fourth and fifth differences are zero. The data therefore belong to a polynomial of degree , which is the lowest degree polynomial through the points.
Expanding:
Sum:
Check: , , . All agree.
Estimate at x = 0:
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 8 marks
The fit function of type y = a + bx for the following points using the least square method.
X -1 1.2 2 2.7 3.6 4 F(x) 1 20 27 33 41 45
Answer
For the normal equations are
| -1 | 1 | 1 | -1 |
| 1.2 | 20 | 1.44 | 24 |
| 2 | 27 | 4 | 54 |
| 2.7 | 33 | 7.29 | 89.1 |
| 3.6 | 41 | 12.96 | 147.6 |
| 4 | 45 | 16 | 180 |
| 12.5 | 167 | 42.69 | 493.7 |
with .
The normal equations become
Using the formulas:
The fitted line is
Check: first equation . Second: . Both are satisfied.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 8 marks
Calculate the integral value of the function given below from x = 1.8 to x = 3.4 using Simpson’s 1/3 rule.
X 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.4 F(x) 0.003 0.778 1.632 2.566 3.579 4.672 7.097 8.429
Answer
Simpson's 1/3 rule needs an even number of equal sub-intervals. The table has equal spacing from to (6 intervals, 7 points), but the last interval, from to , has width . Hence Simpson's 1/3 rule is applied on and the remaining strip is handled separately with the trapezoidal rule.
Part 1: [1.8, 3.0], h = 0.2
- ,
- Odd terms: , so
- Even terms: , so
Part 2: [3.0, 3.4], width 0.4 (only the two end values are available)
Total
So .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2075 · 8 marks
From the following differential equation estimate y(1) using RK 4^th order method.
[Take h = 0.5]
Answer
Write the equation as , , . Two steps are needed to reach .
RK4 formulas:
Step 1:
Step 2:
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2077 · 2 marks
Derive the formula for Newton Raphson Method. Solve the equation using Newton Raphson method. Assume error precision is 0.01. Discuss drawbacks of the Newton Raphson method.
Answer
Derivation. Let be an approximation of a root of . Expand about by Taylor's series: If is the root, then . Neglecting terms of order and higher:
Geometrically, is where the tangent to at cuts the -axis. Convergence is quadratic near a simple root.
Solving , .
, , so a root lies in . Take .
| n | |||||
|---|---|---|---|---|---|
| 0 | 2 | 3 | 8 | 1.6250 | 0.3750 |
| 1 | 1.6250 | 0.1406 | 7.2500 | 1.6056 | 0.0194 |
| 2 | 1.6056 | 0.000376 | 7.2112 | 1.60555 | 0.00005 |
At the third iteration the change is , so the iteration stops: (The exact root is .)
Drawbacks of Newton-Raphson method
- It needs the derivative at each step, which may be difficult or costly to compute.
- If or is very small (near a stationary point), the next step is undefined or flies far away.
- It needs a good initial guess; a poor guess can diverge or jump to a different root, and the method can cycle or oscillate (for example on from ).
- Convergence is only linear at a multiple root.
- It does not guarantee convergence (unlike bisection) and gives no bracketing of the root.
- Each iteration evaluates two functions ( and ).
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2077 · 2 marks
How interpolation differs from regression? Write down algorithm and program for Lagrange interpolation.
Answer
Interpolation vs regression
| Interpolation | Regression (curve fitting) |
|---|---|
| The curve passes exactly through all given data points | The curve passes near the points; it need not touch any of them |
| Used when data are exact (tables of function values) | Used when data contain errors or noise (experiments) |
| Degree of polynomial is tied to the number of points ( for points) | Form of the function is chosen independently (line, exponential, etc.) |
| Aim: estimate values between known points | Aim: find the trend/relation between variables |
| Error at the nodes is zero | Minimises the sum of squared errors (least squares) |
Lagrange interpolation. For points : Each if and otherwise, so .
Algorithm
- Read , the data points () and the value at which is wanted.
- Set .
- For to : set ; for to , : ; then .
- Print as .
Program (C)
#include <stdio.h>
int main() {
int n, i, j;
float x[20], y[20], xp, term, sum = 0;
printf("Enter number of data points: ");
scanf("%d", &n);
printf("Enter the values of x and y:\n");
for (i = 0; i < n; i++)
scanf("%f %f", &x[i], &y[i]);
printf("Enter the value of 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 = term * (xp - x[j]) / (x[i] - x[j]);
sum = sum + term;
}
printf("f(%.3f) = %.4f\n", xp, sum);
return 0;
}
Example: for the points and , the program gives , which is the value of at .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2077 · 2 marks
Why partial pivoting is used with Naive Gauss Elimination method? Solve the following system of equations using Gauss Elimination method with partial pivoting? How Gauss Jordan method differs from Gauss elimination method?
2x + 2y – z = 6
4x + 2y + 3z = 4
x + y + z = 0
Answer
Why partial pivoting is used. In naive Gauss elimination the pivot element is used as the divisor to form the multipliers . If the pivot is zero the method breaks down, and if it is very small compared with other elements in the column, the multipliers become huge and round-off errors are magnified, giving inaccurate results. In partial pivoting, before eliminating column , the row having the largest absolute value in that column (from row downward) is swapped into the pivot position. This keeps all multipliers , avoids division by zero and improves numerical stability.
Solution. Augmented matrix:
Column 1: the largest element is (row 2). Swap :
and :
Column 2: compare and ; the pivot is already largest, so no swap. :
Back substitution:
Check in the first equation: . In the third: .
Gauss-Jordan vs Gauss elimination
| Gauss elimination | Gauss-Jordan |
|---|---|
| Reduces the matrix to upper triangular form | Reduces the matrix to diagonal (identity) form |
| Eliminates entries only below the pivot | Eliminates entries above and below the pivot |
| Solution found by back substitution | Solution read directly; no back substitution |
| About operations | About operations (more work) |
| Preferred for solving a single system | Convenient for matrix inversion |
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2077 · 8 marks
Define the terms true error and relative error? Use Horner’ method to evaluate polynomial at x = 3 and write down its algorithm.
Answer
True error. If is the exact (true) value and the approximate value, the true error is
Relative error. The true error expressed as a fraction of the true value:
For example, if and , then and .
Horner's method. A polynomial is written in nested form so that it needs only multiplications and additions:
Evaluation of at . Nested form: .
Synthetic table (coefficients ):
| 2 | -3 | 5 | -2 | |
|---|---|---|---|---|
| 6 | 9 | 42 | ||
| 2 | 3 | 14 | 40 |
Check by direct substitution: .
Algorithm
- Read the degree , the coefficients and the point .
- Set .
- For down to : .
- Print as .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2077 · 8 marks
Fit the curve through the following data points.
x 1 2 3 4 y 1.65 2.70 4.50 7.35
Answer
Take natural logarithms to linearise : Put , , so is a straight line. Its normal equations are
| 1 | 1.65 | 0.50078 | 1 | 0.50078 |
| 2 | 2.70 | 0.99325 | 4 | 1.98650 |
| 3 | 4.50 | 1.50408 | 9 | 4.51223 |
| 4 | 7.35 | 1.99470 | 16 | 7.97880 |
| 10 | 4.99281 | 30 | 14.97831 |
with .
Hence
Check: at , (data 4.50); at , (data 7.35).
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2077 · 8 marks
Discuss the Doolittle LU decomposition method for matrix factorization.
Answer
Idea. LU decomposition factors a square matrix (when no row interchange is needed) as where is lower triangular and is upper triangular. In the Doolittle method the diagonal of is made :
Formulas. Multiplying and equating with gives, for : That is, alternately a row of and then a column of are computed. The requirement is (all leading principal minors non-zero); otherwise pivoting is needed.
Solving . Since , put .
- Forward substitution: , .
- Back substitution: , .
Example.
- Row 1 of :
- Column 1 of :
- Row 2 of :
Check: third row of is .
Advantages
- Once is factored, many right-hand sides can be solved cheaply ( each).
- Determinant: .
- Factoring costs about multiplications, the same as Gauss elimination, and the multipliers are stored in .
Compared with Crout: Crout puts the unit diagonal in instead of .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2077 · 8 marks
Write down algorithm and program for the differentiating continuous function using three point formula.
Answer
Three-point formulas. Differentiate the quadratic through three equally spaced points (spacing ).
- Forward (at , using ):
- Central (at , using ):
- Backward (at , using ):
Each has error of order .
Algorithm
- Define the function .
- Read the point and step size .
- Compute .
- Compute the forward, central and backward estimates from the above formulas.
- Print the results.
Program (C): differentiates (exact derivative ) at a given point.
#include <stdio.h>
#include <math.h>
double f(double x) { return sin(x); }
int main() {
double x0, h, fwd, cen, bwd;
printf("Enter the point x0 and step size h: ");
scanf("%lf %lf", &x0, &h);
fwd = (-3 * f(x0) + 4 * f(x0 + h) - f(x0 + 2 * h)) / (2 * h);
cen = (f(x0 + h) - f(x0 - h)) / (2 * h);
bwd = (3 * f(x0) - 4 * f(x0 - h) + f(x0 - 2 * h)) / (2 * h);
printf("Forward three-point: f'(%.3f) = %.6f\n", x0, fwd);
printf("Central three-point: f'(%.3f) = %.6f\n", x0, cen);
printf("Backward three-point: f'(%.3f) = %.6f\n", x0, bwd);
printf("Exact value : %.6f\n", cos(x0));
return 0;
}
For , the central formula gives against the exact .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2077 · 8 marks
How Simpson’s 1/3 rule differs from Trapezoidal rule? Drive the formula for Simson’s 1/3 rule.
Answer
Difference between the two rules
| Trapezoidal rule | Simpson's 1/3 rule |
|---|---|
| Replaces on each sub-interval by a straight line (degree 1) | Replaces on each pair of sub-intervals by a parabola (degree 2) |
| Works with any number of intervals | Needs an even number of intervals |
| Formula: | Formula: |
| Error , order | Error , order |
| Exact for linear functions | Exact for polynomials up to degree 3 |
| Less accurate | More accurate for the same |
Derivation of Simpson's 1/3 rule. Take three equally spaced points with values . Fit the Newton forward polynomial through them, with , :
Integrate from to , i.e. to :
Evaluate each integral:
Substitute and :
Composite rule. For an even number of sub-intervals, apply this to each pair and add. Interior odd points occur once with weight 4, interior even points twice (end of one pair and start of the next):
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2077 · 8 marks
Appropriate the solution of y’ = 2x + y , y(0) = 1 using Euler’s method with step size 0.1. Approximate the value of y(0.4).
Answer
Euler's method: , with , , , .
| n | ||||
|---|---|---|---|---|
| 0 | 0.0 | 1.0000 | 1.0000 | 1.1000 |
| 1 | 0.1 | 1.1000 | 1.3000 | 1.2300 |
| 2 | 0.2 | 1.2300 | 1.6300 | 1.3930 |
| 3 | 0.3 | 1.3930 | 1.9930 | 1.5923 |
Hence
(For comparison, the exact solution of this linear equation is , giving ; the difference is the Euler truncation error.)
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2077 · 8 marks
A plate of dimension 18cm x 18cm is subjected to temperatures as follows: left side at , right side at . Upper part at , and lower at . If square grid length of 6cm x 6cm is assumed, what will be the temperature at the interior nodes?
Answer
Steady-state temperature in the plate satisfies Laplace's equation . With a square grid, the five-point formula gives, at an interior node, the average of its four neighbours:
Grid. The plate is cm with grid spacing cm, so there are nodes and interior nodes: (top left), (top right), (bottom left), (bottom right).
Boundary temperatures: top C, bottom C, left C, right C.
Equations
Solution. Subtract equation 3 from equation 2: .
Equation 1: . Equation 4: . Equation 2: .
From the first two, and . Substituting in equation 2:
Then , .
Check: and .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2077 · 8 marks
How boundary value problems differs from initial value problems? Discuss shooting method for solving boundary value problem.
Answer
Difference between BVP and IVP
| Initial value problem (IVP) | Boundary value problem (BVP) |
|---|---|
| All conditions are given at one point, e.g. | Conditions are given at two (or more) points, e.g. |
| Solution is obtained by marching step by step from the initial point | Cannot be marched directly because the starting slope is unknown |
| Solved directly by Euler, Runge-Kutta, etc. | Solved by shooting method, finite difference method |
| Usually has a unique solution | May have no solution, one or many |
| Typical for time-dependent problems | Typical for space-dependent problems (beam deflection, heat flow) |
Shooting method. Consider the second order BVP The idea is to convert it into an IVP by guessing the missing initial slope and "shooting" the solution toward , like aiming a gun.
- Write the ODE as a first order system: , with , .
- Guess and integrate (RK4 or Euler) from to to get .
- Define the error function . We need .
- If , take another guess and compute .
- Improve the guess with the secant method:
- Repeat until . The last integration is the required solution.
Remarks
- For a linear ODE, is a linear function of , so by linear interpolation of two shots, gives the exact slope (the solution is ).
- For a non-linear ODE, several iterations (a root-finding procedure such as secant or bisection) are needed.
- Advantage: uses ready IVP solvers and is simple to code. Disadvantage: may be unstable and sensitive to the guess when the solution grows rapidly.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 10 marks
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.
Answer
Horner's rule for . For write it in nested form Set and, for , Then . This is synthetic division of by : the () are the coefficients of the quotient and is the remainder, so It requires only multiplications and additions.
Horner's rule for . Differentiate the identity above: So is obtained by applying the same procedure again to the quotient coefficients: put , and for , Then .
Example: at . Coefficients : , so . Second pass on : , so . (Check: .)
Root of a polynomial. Combining both evaluations in Newton's method gives repeated until .
Algorithm
- Read the degree , coefficients , initial guess , tolerance , maximum iterations.
- Repeat:
- , .
- For down to : ; .
- (now , and ).
- If , stop (derivative zero).
- .
- If , print and stop; else .
- If the iteration limit is reached, print "no convergence".
Program (C)
#include <stdio.h>
#include <math.h>
int main() {
int n, i, iter;
double a[20], x, xn, b, c, eps;
printf("Enter the degree of the polynomial: ");
scanf("%d", &n);
printf("Enter coefficients a[n] ... a[0] (highest power first):\n");
for (i = n; i >= 0; i--)
scanf("%lf", &a[i]);
printf("Enter initial guess and tolerance: ");
scanf("%lf %lf", &x, &eps);
for (iter = 1; iter <= 100; iter++) {
b = a[n];
c = a[n];
for (i = n - 1; i >= 1; i--) {
b = a[i] + b * x; /* quotient coefficient / value */
c = b + c * x; /* derivative */
}
b = a[0] + b * x; /* b = p(x), c = p'(x) */
if (fabs(c) < 1e-12) {
printf("Derivative is zero. Try another guess.\n");
return 1;
}
xn = x - b / c;
printf("Iteration %d: x = %.8f p(x) = %.8f\n", iter, xn, b);
if (fabs(xn - x) < eps) {
printf("Root = %.6f\n", xn);
return 0;
}
x = xn;
}
printf("Did not converge in 100 iterations.\n");
return 1;
}
Test: for with the program converges to the root in a few iterations.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 10 marks
Write matrix factorization? How can be used to solve a system of linear equations? Factorize the given matrix A and solve the system of equations Ax = b for given b using L and U matrices.
A = and b =
Answer
Matrix factorization (LU decomposition). A square matrix is factorized as a product of a lower triangular matrix (with unit diagonal) and an upper triangular matrix :
is the result of Gaussian elimination on , and the entries of below the diagonal are the multipliers used during elimination.
Solving using and . Substituting gives . Put . Then:
- Solve by forward substitution.
- Solve by back substitution.
The expensive factorization is done only once, so the same , can be reused for many right-hand sides (cost of each extra solve is only ).
Factorization of .
Multipliers: , .
, .
Multiplier: . .
Check: row 3 of = . Correct.
Forward substitution , :
Back substitution :
Check in equation 3: . Correct.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 10 marks
What is a higher-order differential equation? How can you solve the higher-order differential equation? Explain. Solve the following differential equation for 1 ≤ x ≥ 2, taking h = 0.25
, width y(1) = 1 and y^‘(1) = 2
Answer
Higher-order differential equation. An ordinary differential equation containing a derivative of order two or more, e.g. , is a higher-order ODE. It needs as many initial conditions as its order.
Numerical solution. A numerical method (Euler, Heun, Runge-Kutta) works on first-order equations, so the -th order equation is reduced to a system of first-order equations by introducing new variables for the lower derivatives:
- Let .
- Write (the equation solved for the highest derivative).
- Apply the one-step method to the vector simultaneously, using the initial values.
Problem. Take , . Let . Then
Using Heun's (improved Euler) method:
with and .
Step 1 (): . . .
, .
Step 2 (): . . .
, .
Step 3 (): . . .
, .
Step 4 (): . . .
, .
| 1.00 | 1.25 | 1.50 | 1.75 | 2.00 | |
|---|---|---|---|---|---|
| 1 | 1.1563 | 0.9707 | 0.6761 | 0.3983 | |
| 2 | -0.0313 | -0.9150 | -1.1015 | -0.9412 |
So .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
How the half-interval method can be estimate a root of a non-linear equation? Find a real root of the following equation using the half-interval method to correct up to two decimal places.
x^2 – e^-x – x = 1
Answer
Half-interval (bisection) method. If is continuous on and , a root lies in . Take the midpoint . If the root is in (set ); otherwise it is in (set ). Repeating halves the interval each time until (or ) is smaller than the required tolerance.
Problem. .
, , so a root lies in .
| 1 | 1 | 2 | 1.5 | -0.4731 |
| 2 | 1.5 | 2 | 1.75 | 0.1387 |
| 3 | 1.5 | 1.75 | 1.625 | -0.1813 |
| 4 | 1.625 | 1.75 | 1.6875 | -0.0248 |
| 5 | 1.6875 | 1.75 | 1.71875 | 0.0561 |
| 6 | 1.6875 | 1.71875 | 1.703125 | 0.0154 |
| 7 | 1.6875 | 1.703125 | 1.6953 | -0.0048 |
| 8 | 1.6953 | 1.703125 | 1.6992 | 0.0053 |
The root now lies in , so both ends round to and the successive midpoints agree to two decimal places.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
Calculate the real root of the given equation using fixed point iteration correct up to 3 significant figures.
2x^3 – 2x = 5
Answer
Equation: , i.e. .
and ; , , . The root lies near .
Rearrangement. .
Convergence needs near the root: at , so the iteration converges.
Start with :
| 0 | 1.5000 | 1.5874 |
| 1 | 1.5874 | 1.5989 |
| 2 | 1.5989 | 1.6004 |
| 3 | 1.6004 | 1.6006 |
| 4 | 1.6006 | 1.6006 |
The values agree to four decimals, so
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
What is Newton’s interpolation? Obtain the divided difference table from the following data set and estimate the f(x) at x = 2 and x = 5.
x 3.2 2.7 1.0 4.8 5.6 f(x) 22.0 17.8 14.2 38.3 51.7
Answer
Newton's interpolation. Newton's divided-difference interpolation fits a polynomial through points (which may be unequally spaced) in the form
where divided differences are and so on recursively. A new point only adds one new term.
Divided difference table (points in the order given):
| 1st | 2nd | 3rd | 4th | ||
|---|---|---|---|---|---|
| 3.2 | 22.0 | ||||
| 8.4000 | |||||
| 2.7 | 17.8 | 2.8556 | |||
| 2.1176 | -0.5275 | ||||
| 1.0 | 14.2 | 2.0116 | 0.2558 | ||
| 6.3421 | 0.0865 | ||||
| 4.8 | 38.3 | 2.2626 | |||
| 16.7500 | |||||
| 5.6 | 51.7 |
Sample entries: ; ; ; .
Polynomial:
At : , , , .
At : , , , .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
What is linear regression? Fit the linear function to the following data
x 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 f(x) 2.0 2.6 3.9 6.0 9.3 15 20.6 30.4
Answer
Linear regression. Linear regression fits a straight line to data by the method of least squares, i.e. choosing that minimise . Setting gives the normal equations
Computation ():
| 1.0 | 2.0 | 1.00 | 2.00 |
| 1.2 | 2.6 | 1.44 | 3.12 |
| 1.4 | 3.9 | 1.96 | 5.46 |
| 1.6 | 6.0 | 2.56 | 9.60 |
| 1.8 | 9.3 | 3.24 | 16.74 |
| 2.0 | 15.0 | 4.00 | 30.00 |
| 2.2 | 20.6 | 4.84 | 45.32 |
| 2.4 | 30.4 | 5.76 | 72.96 |
| 13.6 | 89.8 | 24.80 | 185.20 |
Normal equations:
Determinant .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
What are the problems with polynomial interpolation for a large number of data set? How such problems are addressed? Explain with an example.
Answer
Problems with polynomial interpolation for a large data set.
- High degree. points need a polynomial of degree . A high-degree polynomial is costly to build and evaluate and the coefficients are very sensitive to rounding errors (ill-conditioned Vandermonde system).
- Oscillation (Runge's phenomenon). Between the data points, especially near the ends of the interval, a high-degree polynomial swings wildly, so the interpolated values can be far from the true function even though it passes exactly through every point. For equally spaced nodes the error does not shrink as grows; it can get larger.
- Global dependence. Changing or adding one data point changes the whole polynomial.
- Noisy data are reproduced exactly, including the noise.
Remedy: piecewise (spline) interpolation. Instead of one polynomial for all the points, a separate low-degree polynomial (usually cubic) is fitted on each subinterval . The pieces are joined so that the function, its first derivative and its second derivative are continuous at the interior nodes (cubic spline). Since each piece is low degree, there is no wild oscillation, and a change in one point affects mainly the neighbouring intervals. Other remedies are least-squares curve fitting with a low-degree polynomial, and using Chebyshev-spaced nodes.
Example. Take on with 11 equally spaced points. The degree-10 interpolating polynomial gives about near against the true value , and it oscillates strongly near both ends. A cubic spline through the same 11 points follows the curve closely everywhere.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
Solve the following differential equation for 1 ≤ x ≤ 2, taking h = 0.25 using Heun’s method.
y^‘(x) + x^2y = 3x, with y(1) = 1
Answer
Heun's method (predictor-corrector, 2nd order) for :
Here , , , .
Step 1: . . .
Step 2: . . .
Step 3: . . .
Step 4: . . .
| 1.00 | 1.25 | 1.50 | 1.75 | 2.00 | |
|---|---|---|---|---|---|
| 1 | 1.4258 | 1.6705 | 1.7090 | 1.6045 |
.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2078 · 5 marks
Consider a metallic plate of size 90cm by 90cm. The two adjacent sides of the plate are maintained at a temperature of 100^0C and the remaining two adjacent sides are held at 200^0C. Calculate the steady-state temperature at interior points assuming a grid size of 30 cm by 30 cm.
Answer
Setup. The steady-state temperature satisfies Laplace's equation . With a square grid of step , each interior point is the average of its four neighbours:
The plate is cm and cm, so there are divisions and interior points. Let the top and left sides be at C and the right and bottom sides at C. Label the interior points
(top row ; bottom row ).
Equations.
Solution. Equations 2 and 3 are symmetric, so . Then
Also . From the first, ; from the second, . Substituting:
Hence , , .
Check: ; . Correct.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 10 marks
How secant method can approximate the root of a non-linear equation? Explain with necessary derivation. Estimate a real root of following equation using secant method. Assume error precisionn of 0.01.
x^3 + 2x – cos(x) = 4
Answer
Secant method. For , Newton's method needs . The secant method replaces by the slope of the chord through the two latest points and :
Derivation. The straight line through the two points is
The next approximation is where this line crosses the -axis ():
It needs two starting values but no derivative and no bracketing. The order of convergence is about .
Problem. .
, . Take .
| 1 | 1 | 2 | -1.5403 | 8.4161 | 1.15470 | 0.8453 |
| 2 | 2 | 1.15470 | 8.4161 | -0.5552 | 1.20701 | 0.0523 |
| 3 | 1.15470 | 1.20701 | -0.5552 | -0.1833 | 1.23280 | 0.0258 |
| 4 | 1.20701 | 1.23280 | -0.1833 | 0.0076 | 1.23177 | 0.0010 |
Since , we stop.
(Check: .)
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 10 marks
How spline interpolation differs with the Langrage’s interpolation? Estimate the value of f(0) and f(4) using cubic spline interpolation from the following data.
x -1 1 2 3 f(x) -10 -2 14 86
Answer
Spline vs Lagrange interpolation. Lagrange interpolation passes a single polynomial of degree through all points. For many points it has high degree and can oscillate badly between points (Runge's phenomenon), and it changes completely if one point is altered. Spline interpolation fits a separate low-degree polynomial (cubic) on each interval and joins them so that , and are continuous at interior nodes. It is smooth, stable and local.
Cubic spline. On , with and :
Continuity of gives, for interior nodes,
Data. ; ; . Use natural end conditions .
Slopes: , , .
At :
At :
Solving: from the first ; then , .
lies in (, , , ):
lies outside the data, so the last cubic (interval , , , ) is extended (extrapolation):
At : ; ; .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 10 marks
What is pivoting? Why is it necessary? Write an algorithm and program to solve the set of n linear equations using Gaussian elimination method.
Answer
Pivoting. In Gaussian elimination the element used to eliminate column is the pivot. Pivoting means choosing a good pivot by interchanging rows (partial pivoting: pick the row with the largest for ; complete pivoting also interchanges columns).
Why it is necessary.
- If a pivot is zero, the multipliers cannot be computed (division by zero) even though the system may have a unique solution, e.g. .
- If a pivot is very small compared with other elements, the multipliers are huge and round-off errors are magnified, giving wrong answers.
Partial pivoting keeps all multipliers in magnitude and so improves accuracy and stability.
Algorithm (Gaussian elimination with partial pivoting).
- Read and the augmented matrix , , .
- For to :
- Find row with the largest . If it is zero, the matrix is singular; stop.
- If interchange rows and .
- For to : ; for to : .
- Back substitution: ; for down to : .
- Print .
Program (C).
#include <stdio.h>
#include <math.h>
int main(void) {
int n, i, j, k, p;
double a[20][21], x[20], m, t, s;
printf("Enter number of equations: ");
scanf("%d", &n);
printf("Enter augmented matrix (%d x %d):\n", n, n + 1);
for (i = 0; i < n; i++)
for (j = 0; j <= n; j++)
scanf("%lf", &a[i][j]);
/* forward elimination with partial pivoting */
for (k = 0; k < n - 1; k++) {
p = k;
for (i = k + 1; i < n; i++)
if (fabs(a[i][k]) > fabs(a[p][k]))
p = i;
if (fabs(a[p][k]) < 1e-12) {
printf("Matrix is singular; no unique solution.\n");
return 1;
}
if (p != k)
for (j = 0; j <= n; j++) {
t = a[k][j]; a[k][j] = a[p][j]; a[p][j] = t;
}
for (i = k + 1; i < n; i++) {
m = a[i][k] / a[k][k];
for (j = k; j <= n; j++)
a[i][j] -= m * a[k][j];
}
}
if (fabs(a[n - 1][n - 1]) < 1e-12) {
printf("Matrix is singular; no unique solution.\n");
return 1;
}
/* back substitution */
for (i = n - 1; i >= 0; i--) {
s = a[i][n];
for (j = i + 1; j < n; j++)
s -= a[i][j] * x[j];
x[i] = s / a[i][i];
}
printf("Solution:\n");
for (i = 0; i < n; i++)
printf("x%d = %.4f\n", i + 1, x[i]);
return 0;
}
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
Calculate a real root of the following function using bisection method correct upto 3 significant figures.
x^2 – e^-x = 3
Answer
.
and , so a root lies in .
| 1 | 1 | 2 | 1.5 | -0.9731 |
| 2 | 1.5 | 2 | 1.75 | -0.1113 |
| 3 | 1.75 | 2 | 1.875 | 0.3623 |
| 4 | 1.75 | 1.875 | 1.8125 | 0.1219 |
| 5 | 1.75 | 1.8125 | 1.78125 | 0.0044 |
| 6 | 1.75 | 1.78125 | 1.765625 | -0.0536 |
| 7 | 1.765625 | 1.78125 | 1.7734 | -0.0247 |
| 8 | 1.7734 | 1.78125 | 1.7773 | -0.0101 |
| 9 | 1.7773 | 1.78125 | 1.7793 | -0.0029 |
| 10 | 1.7793 | 1.78125 | 1.7803 | 0.0008 |
The root lies in ; both ends and the midpoints round to (3 significant figures).
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
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.
Answer
Fixed point iteration. To solve , rewrite it in the form and iterate from a starting guess :
A root of is a fixed point of (where the curve meets the line ). Iteration stops when is smaller than the tolerance.
Convergence condition. Let and . By the mean value theorem . If and are continuous on an interval around containing , and
then the error is multiplied by at most at every step, so (linear convergence; the smaller , the faster). In the cobweb diagram, gives a monotone staircase and gives a spiral into the root.
Diverging cases. If near the root, the error grows and the iteration moves away from the root.
Example 1. has root . Taking : , so . Starting at : , which diverges. Rearranged as , , and converges.
Example 2. The equation (root ) written as has , so . The iterates oscillate with growing amplitude:
So the same equation can converge or diverge depending on the choice of ; one must check near the root.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
Fit the quadratic function for the data given below using least square method.
x 1.0 1.5 2.0 2.5 3.0 3.5 4.0 f(x) 2.7 4 5.8 8.3 11.2 15 19
Answer
Fit by least squares. The normal equations () are
| 1.0 | 2.7 | 1.00 | 1.000 | 1.0000 | 2.70 | 2.700 |
| 1.5 | 4.0 | 2.25 | 3.375 | 5.0625 | 6.00 | 9.000 |
| 2.0 | 5.8 | 4.00 | 8.000 | 16.0000 | 11.60 | 23.200 |
| 2.5 | 8.3 | 6.25 | 15.625 | 39.0625 | 20.75 | 51.875 |
| 3.0 | 11.2 | 9.00 | 27.000 | 81.0000 | 33.60 | 100.800 |
| 3.5 | 15.0 | 12.25 | 42.875 | 150.0625 | 52.50 | 183.750 |
| 4.0 | 19.0 | 16.00 | 64.000 | 256.0000 | 76.00 | 304.000 |
| 17.5 | 66.0 | 50.75 | 161.875 | 548.1875 | 203.15 | 675.325 |
Solving (eliminate ): multiply eq. 1 by and subtract from eq. 2, and by and subtract from eq. 3:
(for example , , ). From the first, . Substituting: , ; then and .
Check at : (data ).
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
Estimate the integral value of following function from x =1.2 to 2.4 using Simpson’s 1/3 rule.
x 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 f(x) 1.53 2.25 3.18 4.32 5.67 7.23 8.98 10.94 13.08
Answer
Simpson's 1/3 rule. For an even number of strips of width :
The range to with has 6 strips (even), 7 ordinates:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|---|
| 1.2 | 1.4 | 1.6 | 1.8 | 2.0 | 2.2 | 2.4 | |
| 2.25 | 3.18 | 4.32 | 5.67 | 7.23 | 8.98 | 10.94 |
- Ends:
- Odd ordinates: , times 4
- Even ordinates: , times 2
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
What is Gaussian integration formula? Evaluate the following integration using Gaussian integration three ordinate formula
_0∫^1 Sinx/x dx
Answer
Gaussian integration formula. Gauss quadrature chooses both the nodes and the weights so that the formula is exact for polynomials up to degree with ordinates:
(for a general interval use ). For three ordinates, with weights .
Problem. . Put , :
Nodes: , , .
(The exact value is .)
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2079 · 5 marks
Solve the following differential equation for 0 ≤ x ≤ 1 taking h=0.5 using Runge Kutta 4th order method.
y'(x) + y = 3x with y(0)=2
Answer
RK4 formulas for :
Here , , .
Step 1 ():
Step 2 ():
| 0 | 0.5 | 1.0 | |
|---|---|---|---|
| 2 | 1.5339 | 1.8409 |
(Exact solution gives .)
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 10 marks
How secant methods differs from Newton Rhapson method? Derive the formula for Secant Method. Solve the equation Cosx + 2Sinx – x² = 0 using Secant method. Assume error precision as 0.01. Discuss the drawbacks of the Newton Rhapson method.
Answer
Secant vs Newton-Raphson.
| Newton-Raphson | Secant |
|---|---|
| Needs the derivative | No derivative needed; slope is approximated by a chord |
| One starting value | Two starting values |
| Order of convergence 2 | Order about 1.618 |
| Two function-type evaluations per step ( and ) | One new evaluation of per step |
Derivation of the secant formula. Replace in Newton's formula by the difference quotient . Equivalently, the line through and is
Setting gives the new approximation:
Problem. . and , so a root lies between 1 and 2. Take , .
| 1 | 1 | 2 | 1.2232 | -2.5976 | 1.32015 | 0.680 |
| 2 | 2 | 1.32015 | -2.5976 | 0.4427 | 1.41915 | 0.099 |
| 3 | 1.32015 | 1.41915 | 0.4427 | 0.1141 | 1.45353 | 0.034 |
| 4 | 1.41915 | 1.45353 | 0.1141 | -0.0095 | 1.45089 | 0.0026 |
The change , so we stop:
Drawbacks of Newton-Raphson.
- It needs , which may be difficult or costly to find.
- If or is very small (near a stationary point), the step is undefined or huge.
- It can diverge or jump to a different root if the initial guess is not close enough to the root; it may also cycle or oscillate (e.g. from ).
- Convergence is only linear at multiple roots.
- It is sensitive to the starting value and requires to be differentiable.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 10 marks
Define the terms interpolation and extrapolation. Write down the algorithm and program for Newton’s divided difference interpolation.
Answer
Interpolation is estimating the value of a function at a point lying inside the range of the given data points (i.e. ), using a function (usually a polynomial) that passes through the data.
Extrapolation is estimating the value at a point outside that range ( or ). It is less reliable because the fitted curve is not constrained there.
Newton's divided difference interpolation.
with and .
Algorithm.
- Read (number of points), the arrays , and the value at which to interpolate.
- Store .
- For to and for to : .
- Set and .
- For to : ; .
- Print as .
Program (C).
#include <stdio.h>
int main(void) {
int n, i, j;
double x[20], d[20][20], xp, sum, prod;
printf("Enter number of data points: ");
scanf("%d", &n);
printf("Enter x and f(x) values:\n");
for (i = 0; i < n; i++) {
scanf("%lf %lf", &x[i], &d[i][0]);
}
printf("Enter the value of x to interpolate: ");
scanf("%lf", &xp);
/* divided difference table */
for (j = 1; j < n; j++)
for (i = 0; i < n - j; i++)
d[i][j] = (d[i + 1][j - 1] - d[i][j - 1]) / (x[i + j] - x[i]);
/* Newton's form */
sum = d[0][0];
prod = 1.0;
for (j = 1; j < n; j++) {
prod *= (xp - x[j - 1]);
sum += d[0][j] * prod;
}
printf("f(%.4f) = %.6f\n", xp, sum);
return 0;
}
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 10 marks
How Gauss Jordan method differs from Gauss Elimination method? Solve the following system of equations using Gauss Jordan method. How can we use Gauss Jordan method to find the inverse of a matrix? Discuss.
2x – y + 4z = 15
2x + 3y – 2z = 4
3x + 2y – 4z = -4
Answer
Difference between Gauss Elimination and Gauss-Jordan.
| Gauss Elimination | Gauss-Jordan |
|---|---|
| Reduces the augmented matrix to an upper triangular form (zeros only below the diagonal). | Reduces it to a diagonal (identity) form (zeros above and below each pivot). |
| Solution is obtained by back substitution. | Solution is read directly; no back substitution is needed. |
| Fewer operations, about multiplications. | More operations, about . |
| Pivot rows are normalised only if required. | Every pivot row is divided by its pivot to make the pivot 1. |
Solution of the system by Gauss-Jordan
Step 1: , then , :
Step 2: , then , :
Step 3: , then , :
Check in equation 1: .
Finding the inverse using Gauss-Jordan
To find of an non-singular matrix, form the augmented matrix and apply row operations (the same Gauss-Jordan steps, including row swaps for partial pivoting) until the left half becomes . Because every row operation is equivalent to multiplying by an elementary matrix ,
so the right half now holds . If a zero pivot cannot be removed by a row swap, is singular and has no inverse.
Procedure:
- Write .
- For each column : choose the pivot (largest , swap if needed), divide the pivot row by the pivot, and eliminate column from all other rows.
- Read from the right half.
For the system above, obtained this way gives , the same solution as found directly.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
Define the terms approximate errot and relative approximate error? Discuss the working of Half Interval method for finding the roots of non-linear equation.
Answer
Approximate error. If and are the present and previous approximations of a root in an iterative method (the true value being unknown), the approximate error is
and the relative approximate error is
Iteration stops when . (For comparison, the true error is , usable only when is known.)
Half Interval (Bisection) method. It finds a root of for a continuous on where ; by the intermediate value theorem a root lies in .
Working:
- Choose with and a tolerance .
- Compute the midpoint .
- Test:
- if , is the root;
- if , the root lies in , so set ;
- else the root lies in , so set .
- Repeat steps 2-3 until (or ). The final is the root.
Each step halves the interval, so after steps the width is . The number of iterations needed for accuracy is
The method always converges (linearly) but is slow, and it cannot find roots where touches zero without changing sign.
Example: on : , , root in ; , , root in ; , and so on, converging to .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
Fit the quadratic curve through the following data points and estimate the value of f(x) at x=2.
x 1 3 4 5 6 y 2 7 8 7 5
Answer
Quadratic least-squares fit . The normal equations are
| 1 | 2 | 1 | 1 | 1 | 2 | 2 |
| 3 | 7 | 9 | 27 | 81 | 21 | 63 |
| 4 | 8 | 16 | 64 | 256 | 32 | 128 |
| 5 | 7 | 25 | 125 | 625 | 35 | 175 |
| 6 | 5 | 36 | 216 | 1296 | 30 | 180 |
| 19 | 29 | 87 | 433 | 2259 | 120 | 548 |
Solving the three equations simultaneously (elimination or Cramer's rule, with determinant ):
At :
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
How can we calculate derivatives of discrete (tabulated) functions? Write down its algorithm.
Answer
Derivatives of tabulated functions. When is known only at points , we fit an interpolating polynomial through the data and differentiate that polynomial, since .
- For equally spaced points ( constant) use Newton's formulas. With and forward differences, At (): . Near the end of the table use the backward-difference version, and in the middle use central differences:
- For unequally spaced points use Lagrange's or Newton's divided-difference polynomial and differentiate it.
Algorithm (Newton forward formula, equal spacing)
- Read and the data (); read the point where the derivative is wanted.
- Compute and .
- Build the difference table: for .
- Compute using as many terms as the table allows.
- Print (and similarly if required) and stop.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
Find the following integral using composite trapezoidal rule for using 2 segments (k=2) and 4 segments (k=4).
_2∫^4 (x³+2) dx
Answer
Composite trapezoidal rule
with , , .
k = 2: , nodes : .
k = 4: , nodes :
| 2 | 2.5 | 3 | 3.5 | 4 | |
|---|---|---|---|---|---|
| 10 | 17.625 | 29 | 44.875 | 66 |
The exact value is , so the errors are (k=2) and (k=4); the error falls by about a factor of 4 when is halved.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2080 · 5 marks
Approximate the solution of y’=3x², y(1)=1 using Taylor’s series method using first four terms. Approximate the value of y(2).
Answer
Taylor series about :
Derivatives from , at , :
First four terms:
At ():
(The next derivative , so the series terminates and this is exact: , .)
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 10 marks
What are inherent errors? Derive the Newton Raphson method for solving non-linear equation and using this method solve
. Calculate upto 3 decimal places.
Answer
Inherent errors. These are errors already present in the data or problem before any computation begins: they arise from imprecise measurements, approximate physical constants, or a mathematical model that simplifies reality (also called data or input errors). They cannot be removed by improving the numerical method, only by more accurate input data. Example: using instead of , or a length measured as cm.
Derivation of Newton-Raphson method. Let have a root near , and let the true root be with small. Expanding by Taylor's series:
Neglecting and higher terms:
so the improved estimate is
Geometrically, is where the tangent to at cuts the -axis. Convergence is quadratic near a simple root.
Solution of
, , so
Take (note , and lies to the right).
| 0 | 0.000 | 6.000 | 1.200 | |
| 1 | 1.200 | 1.440 | 1.754 | |
| 2 | 1.754 | 0.307 | 1.959 | |
| 3 | 1.959 | 0.043 | 1.998 | |
| 4 | 1.998 | 0.002 | 2.000 | |
| 5 | 2.000 | 0.000 | 2.000 |
Two successive values agree to three decimals, so one root is .
The other root is found by starting on the other side, e.g. : , , , . Hence the roots are and , which agree with the factorisation .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 10 marks
What are the limitations of direct methods for solving a system of linear equations? How Gauss Seidel method differs from Jacobi iteration? Solve the following system of linear equation using Jacobi iteration method.
2x-7y-10z=-17
5x+y+3z=14
x+10y+9z=7
Answer
Limitations of direct methods (Gauss elimination, Gauss-Jordan, LU):
- Cost grows as operations, which is very large for big systems.
- Round-off errors accumulate through the many elimination steps; without pivoting a small or zero pivot can ruin the result, and ill-conditioned systems amplify the error.
- For large sparse systems (as arise from PDEs) elimination causes fill-in: zeros become non-zeros, so memory and time are wasted.
- The coefficient matrix is modified and the method cannot make use of a good initial guess; there is no way to improve a solution cheaply.
Gauss-Seidel versus Jacobi.
| Jacobi | Gauss-Seidel |
|---|---|
| Every new component is computed only from values of the previous iteration: | Uses the latest available values, including components already updated in the current iteration: |
| Slower convergence (simultaneous displacement) | Usually about twice as fast (successive displacement) |
| Needs two copies of the vector; easily parallelised | Needs one copy, sequential |
Both need a diagonally dominant matrix (or similar) to guarantee convergence.
Solution by Jacobi iteration. The given order is not diagonally dominant, so the equations are rearranged:
(Row 1: ; row 2: ; row 3: .) Then
Start from , using only previous-iteration values:
| Iteration | |||
|---|---|---|---|
| 1 | 2.800 | 0.700 | 1.700 |
| 2 | 1.640 | 1.770 | |
| 3 | 1.960 | 2.805 | |
| 4 | 1.328 | 2.832 | |
| 5 | 1.505 | 3.380 | |
| 8 | 1.086 | 3.679 | |
| 12 | 1.023 | 3.912 | |
| 15 | 1.020 | 3.977 |
The iterates approach (slowly, because the dominance is weak) the exact solution
which satisfies all three equations: , , .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 10 marks
Write an algorithm and program to implement Lagrange interpolation method.
Answer
Lagrange interpolation. For points the interpolating polynomial is
Each if and otherwise, so . The nodes need not be equally spaced, but must be distinct.
Algorithm
- Start.
- Read the number of data points and the values for .
- Read the value at which is to be interpolated.
- Set .
- For to :
- set ;
- for to , if : ;
- .
- Print as .
- Stop.
Program (C)
#include <stdio.h>
int main(void)
{
int n, i, j;
float x[20], y[20], xp, term, sum = 0.0f;
printf("Enter number of data points: ");
scanf("%d", &n);
printf("Enter the values of x and y:\n");
for (i = 0; i < n; i++)
scanf("%f %f", &x[i], &y[i]);
printf("Enter the value of x for interpolation: ");
scanf("%f", &xp);
for (i = 0; i < n; i++) {
term = y[i];
for (j = 0; j < n; j++) {
if (j != i)
term = term * (xp - x[j]) / (x[i] - x[j]);
}
sum = sum + term;
}
printf("Interpolated value f(%.3f) = %.4f\n", xp, sum);
return 0;
}
Sample: for points and the program prints , as expected from .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
Consider the following data points estimate the f(0.6) using Newton’s interpolation formula.
x 0.1 0.2 0.3 0.4 0.5 f(x) 2.68 3.04 3.38 3.69 3.97
Answer
Since lies just beyond the last tabulated point , Newton's backward difference formula is the appropriate one (it is used here as an extrapolation).
Backward difference table ():
| 0.1 | 2.68 | ||||
| 0.2 | 3.04 | 0.36 | |||
| 0.3 | 3.38 | 0.34 | |||
| 0.4 | 3.69 | 0.31 | |||
| 0.5 | 3.97 | 0.28 | 0.00 | 0.01 |
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
What is regression analysis? Fit a second order polynomial for the following data values.
x 2 4 6 8 10 y 1.4 2.0 2.4 2.6 2.8
Answer
Regression analysis. It is a statistical/numerical technique for finding a mathematical relationship between a dependent variable and one or more independent variables from observed data that contain error. A curve (line, polynomial, etc.) is chosen so that it passes close to, rather than exactly through, the points; the commonest criterion is the least-squares one, which minimises . The fitted curve is then used to predict for other .
Second-order polynomial . Normal equations:
| 2 | 1.4 | 4 | 8 | 16 | 2.8 | 5.6 |
| 4 | 2.0 | 16 | 64 | 256 | 8.0 | 32.0 |
| 6 | 2.4 | 36 | 216 | 1296 | 14.4 | 86.4 |
| 8 | 2.6 | 64 | 512 | 4096 | 20.8 | 166.4 |
| 10 | 2.8 | 100 | 1000 | 10000 | 28.0 | 280.0 |
| 30 | 11.2 | 220 | 1800 | 15664 | 74.0 | 570.4 |
Eliminating : (2nd 1st) gives ; (3rd 1st) gives . From the first, ; substituting: . Then , and .
Check at : .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
What is numerical differentiation? The table below gives the values of distance travelled by a vehicle at various time interval, estimate the velocity and acceleration at x = 4.
Time(x) 1 2 4 8 10 Distance(y) 0 1 5 21 27
Answer
Numerical differentiation. It is the process of estimating the derivatives of a function from a set of its tabulated values, without an analytical expression. The data are fitted by an interpolating polynomial and , . It is used when is known only at discrete points or is too complicated to differentiate.
Estimate at . The time points are unequally spaced, so Newton's divided-difference polynomial is used. Velocity is and acceleration is .
Divided differences (nodes ):
| 1st | 2nd | 3rd | 4th | ||
|---|---|---|---|---|---|
| 1 | 0 | ||||
| 2 | 1 | 1 | |||
| 4 | 5 | 2 | 1/3 | ||
| 8 | 21 | 4 | 1/3 | 0 | |
| 10 | 27 | 3 |
Velocity. Differentiating term by term and putting :
- first term:
- second term:
- third term:
- fourth term: since is a factor, the derivative at is
Acceleration.
- second term:
- fourth term: with , , and , so and the term is
So the velocity at is about and the acceleration about (distance units per time and per time).
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
What is an application of numerical integration? Find the value of the integral
using Simpson’s rule with .
Answer
Application of numerical integration. It is used when the integral cannot be found analytically (e.g. has no elementary form) or when is known only at tabulated points. Typical uses are the area under a curve from survey or experimental data, work done by a variable force, the distance travelled from velocity readings, and probability (area under a distribution curve).
Simpson's 3/8 rule (for a multiple of 3):
Here , so .
| 0 | 1.0000 | 2.71828 |
| 1 | 1.1667 | 2.75252 |
| 2 | 1.3333 | 2.84525 |
| 3 | 1.5000 | 2.98779 |
| 4 | 1.6667 | 3.17669 |
| 5 | 1.8333 | 3.41166 |
| 6 | 2.0000 | 3.69453 |
Sum .
So .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
Given the data points below
X 1.0 3.0 4.0 f(x) 1.5 4.5 9.0 Find cubic spline which belongs to 1<=x<=3 and estimate f(2) using cubic splines.
Answer
Nodes: with ; . No end conditions are given, so the natural spline (, where ) is used.
Equation for the interior moment.
Cubic on :
Check: and .
Estimate at :
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
What is differential equation? Differentiate between ODE and PDE with example.
Answer
Differential equation. An equation that contains an unknown function and its derivatives with respect to one or more independent variables. Example: . Its order is that of the highest derivative and its degree is the power of that derivative. A solution is a function that satisfies the equation (general solution has arbitrary constants; extra conditions fix them).
ODE versus PDE.
| Ordinary differential equation (ODE) | Partial differential equation (PDE) |
|---|---|
| Unknown function depends on a single independent variable. | Unknown function depends on two or more independent variables. |
| Contains ordinary derivatives . | Contains partial derivatives . |
| Conditions: initial value or boundary value at points. | Conditions on boundaries (curves/surfaces) and initial profiles. |
| Methods: Euler, Taylor, Runge-Kutta, shooting. | Methods: finite difference, finite element. |
Examples:
- ODE: , or Newton's cooling law .
- PDE: Laplace equation , heat equation , wave equation .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
Solve , at using Runge–Kutta’s order method.
Answer
, , . The step size is not given, so take (two steps to reach ).
RK4 formulas:
Step 1 ():
Step 2 ():
Check: the exact solution is , giving .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2081 · 5 marks
Solve the Poisson equation
with boundary conditions:
Answer
Setting up. With the grid is and the interior points are . The five-point formula for is
Let . Boundary: on and ; on and .
Right-hand sides :
- :
- and :
- :
Equations
- :
- :
- :
- :
By symmetry :
From the first, . From the third, . Substituting into the second:
Then and .
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
Questions from TU BSc CSIT 2075 Third Semester Numerical Method (TU IOST board exam, 2075), TU BSc CSIT 2077 Third Semester Numerical Method (TU IOST board exam, 2077), TU BSc CSIT 2078 Third Semester Numerical Method (TU IOST board exam, 2078), TU BSc CSIT 2079 Third Semester Numerical Method (TU IOST board exam, 2079), TU BSc CSIT 2080 Third Semester Numerical Method (TU IOST board exam, 2080), TU BSc CSIT 2081 Third Semester Numerical Method (TU IOST board exam, 2081), TU BSc CSIT 2075 Third Semester Computer Architecture (TU IOST board exam, 2075), TU BSc CSIT 2077 Third Semester Computer Architecture (TU IOST board exam, 2077), TU BSc CSIT 2078 Third Semester Computer Architecture (TU IOST board exam, 2078), TU BSc CSIT 2079 Third Semester Computer Architecture (TU IOST board exam, 2079), TU BSc CSIT 2080 Third Semester Computer Architecture (TU IOST board exam, 2080), TU BSc CSIT 2081 Third Semester Computer Architecture (TU IOST board exam, 2081), TU BSc CSIT 2075 Third Semester Computer Graphics (TU IOST board exam, 2075), TU BSc CSIT 2077 Third Semester Computer Graphics (TU IOST board exam, 2077), TU BSc CSIT 2078 Third Semester Computer Graphics (TU IOST board exam, 2078), TU BSc CSIT 2079 Third Semester Computer Graphics (TU IOST board exam, 2079), TU BSc CSIT 2080 Third Semester Computer Graphics (TU IOST board exam, 2080), TU BSc CSIT 2081 Third Semester Computer Graphics (TU IOST board exam, 2081), TU BSc CSIT 2082 Third Semester Computer Graphics (TU IOST board exam, 2082), TU BSc CSIT 2074 Third Semester Data Structures and Algorithms (TU IOST board exam, 2074), TU BSc CSIT 2075 Third Semester Data Structures and Algorithms (TU IOST board exam, 2075), TU BSc CSIT 2077 Third Semester Data Structures and Algorithms (TU IOST board exam, 2077), TU BSc CSIT 2078 Third Semester Data Structures and Algorithms (TU IOST board exam, 2078), TU BSc CSIT 2079 Third Semester Data Structures and Algorithms (TU IOST board exam, 2079), TU BSc CSIT 2080 Third Semester Data Structures and Algorithms (TU IOST board exam, 2080), TU BSc CSIT 2081 Third Semester Data Structures and Algorithms (TU IOST board exam, 2081), TU BSc CSIT 2075 Third Semester Statistics II (TU IOST board exam, 2075), TU BSc CSIT 2077 Third Semester Statistics II (TU IOST board exam, 2077), TU BSc CSIT 2078 Third Semester Statistics II (TU IOST board exam, 2078), TU BSc CSIT 2079 Third Semester Statistics II (TU IOST board exam, 2079), TU BSc CSIT 2080 Third Semester Statistics II (TU IOST board exam, 2080), TU BSc CSIT 2081 Third Semester Statistics II (TU IOST board exam, 2081) and TU BSc CSIT 2082 Third Semester Statistics II (TU IOST board exam, 2082). Answers are written for this site; check them against your class notes.