Computer Oriented Numerical Methods
Computer Oriented Numerical Methods
ROLL NUMBER
PROGRAM
SEMESTER III
COURSE CODE & NAME
SET-1
Que.-1:- Find Lagrange’s interpolation polynomial fitting the points y(1)= -3, y(3)=0, y(4)=
30, y(6)=132 . Hence find y(5).
x 1 3 4 6
y=f(x) -3 0 30 132
We have:
y(x)= f(x)= ( 𝑥−3)(𝑥−4)(𝑥−6)(-3) +(
𝑥−1)(𝑥−4)(𝑥−6)(0) + (30)+
(132)
(1−3)(1−4)(1−6) (3−1)(3−4)(3−6)
= 𝑥³−13𝑥²+54𝑥−72(-3) + 𝑥³−11𝑥²+34𝑥−24(0)+𝑥³−10𝑥²+27𝑥−18(30)+𝑥³−8𝑥²+19𝑥−12(132)
−30 6 −6 30
On simplification we get,
Que.-2:- (a) By constructing a difference table and taking the second-order difference as
constant, find the sixth term of the series 8,12,19,29,42.
Ans.:- (a) x= 0 1 2 3 4
y=8 12 19 29 42
Δy= 4 7 10 13
Δ²y= 3 3 3
Δ³y= 0 0
=8+5(4)+10(3)+10(0)= 58
(b) To find the eigenvalues and eigenvectors of the matrix A, we need to solve the characteristic
equation.
The characteristic equation is given by:
|A - λI| = 0
I = |1 0|
|0 1|
A - λI = |2 - λ 1 |
|4 5 - λ|
Determinant of A - λI = (2 - λ)(5 - λ) - (4)(1)
= λ^2 - 7λ + 6 - 4
= λ^2 - 7λ + 2
To find the eigenvectors, we substitute each eigenvalue back into the equation (A - λI)v = 0 and
solve for v.
For λ₁ = (7 + sqrt(41)) / 2:
(A - λ₁I)v₁ = 0
|2 - λ₁ 1 | |x₁| = 0
|4 5 - λ₁| |y₁|
Substituting the value of λ₁:
|2 - (7 + sqrt(41))/2 1 | |x₁| = 0
|4 5 - (7 + sqrt(41))/2| |y₁|
Simplifying:
|-(3 + sqrt(41))/2 1 | |x₁| = 0
|4 -(3 + sqrt(41))/2| |y₁|
Similarly, for λ₂ = (7 - sqrt(41))/2, we can follow the same steps and find the eigenvector v₂ as:
v₂ = |(3 - sqrt(41))/2 * y₂|
|y₂|
Please note that y₁ and y₂ can be any non-zero values.
So, the eigenvalues of matrix A are λ₁ = (7 + sqrt(41))/2 and λ₂ = (7 - sqrt(41))/2, and the
corresponding eigenvectors are v₁ = |(3 + sqrt(41))/2 * y₁| and v₂ = |(3 - sqrt(41))/2 * y₂|, where y₁
and y₂ are any non-zero values.
2x-3y-z=3
Ans.:- (a) To solve the given system of equations using Cramer's rule, we need to find the values
of x, y, and z by calculating the determinants of the coefficient matrix and the matrices obtained
by replacing each column with the constants of the equations. Let's proceed with the steps:
Step 2: Calculate the determinant of the matrix obtained by replacing the x-column with the
constants, Dx.
Dx = |3 1 2|
|3 -3 -1|
|0 0 1|
Dx = (3*(-31 - (-10))) - (1*(31 - (-10))) + (2*(30 - (-30)))
Dx = (3*(-3)) - (1*(3)) + (2*(0))
Dx = -9 - 3 + 0
Dx = -12
Step 3: Calculate the determinant of the matrix obtained by replacing the y-column with the
constants, Dy.
Dy = |3 1 2|
|2 3 -1|
|0 0 1|
Dy = (3*(3*(-1) - (-10))) - (1(2*(-1) - (-10))) + (2(20 - (30)))
Dy = (3*(-3)) - (1*(-2)) + (2*(0))
Dy = -9 + 2 + 0
Dy = -7
Step 4: Calculate the determinant of the matrix obtained by replacing the z-column with the
constants, Dz.
Dz = |3 1 2|
|2 -3 3|
|0 0 1|
Dz = (3*(-33 - (30))) - (1*(23 - (30))) + (2*(20 - (-30)))
Dz = (3*(-9)) - (1*(6)) + (2*(0))
Dz = -27 - 6 + 0
Dz = -33
(b) To evaluate the square root of 12 using Newton's-Raphson formula, we will iterate through
the formula until we reach the desired level of precision. The formula is as follows: X(n+1) =
(X(n) + (12 / X(n))) / 2
where X(n+1) is the next approximation, X(n) is the current approximation, and 12 is the number
for which we want to find the square root.
Let's start with an initial approximation and perform the iterations until we achieve the desired
precision.
Initial approximation: Let's start with X(0) = 3, which is close to the actual square root of 12.
Using the Newton's-Raphson formula, we can iterate as follows:
X(1) = (X(0) + (12 / X(0))) / 2
X(1) = (3 + (12 / 3)) / 2
X(1) = (3 + 4) / 2
X(1) = 7 / 2
X(1) = 3.5
Therefore, the square root of 12, evaluated using Newton's-Raphson formula to four decimal
places, is approximately 3.4641.
SET-2
Que.-4:- For what value of λ μ the following system of equations:
x+y+z=6
x+2y+3z=10 x+2y+ λz=
μ may have (i) Unique
solution
(ii) Infinite number of solutions
(iii) No solution
|1 1 1 | |x| |6 |
|1 2 3 | |y| = |10| |1
2 λ | |z| |μ |
AX=B
|1 1 1 6 |
(A,B)= |1 2 3 10|
|1 2 λ μ |
|1 1 1 6 |
(A,B)= |1 2 3 4| R₂→R₂-R₁
(ie) λ=3,μ≠10
ρ(A)=2,ρ(A,B)=3
∴ρ(A) ≠ ρ(A,B)
The given system is inconsistent but has no solution.
(ie) λ≠3
Que.-5:- Find the equation of the best fitting straight line for the data:
X 1 3 4 6 8 9 11 14
Y 1 2 4 4 5 7 8 9
Ans.:- To find the equation of the best fitting straight line for the given data, we can use linear
regression. Linear regression finds the line that minimizes the sum of the squared differences
between the observed data points and the predicted values on the line.
Step 7: Write the equation of the best fitting line in slope-intercept form:
y = mx + b y =
0.6364x + 0.2727
Therefore, the equation of the best fitting straight line for the given data is y = 0.6364x + 0.2727.
Que.-6:- Find the solution for X=0.2 taking interval length 0.1 using Euler’s method to solve:
𝒅𝒚 = 1-y given y(0)=0 .
𝒅𝒙
Ans.:- To solve the given initial value problem using Euler's method, we will approximate the
value of y at each interval using the formula: y(n+1) = y(n) + h * f(x(n), y(n)) where y(n+1) is
the approximation of y at the next interval, y(n) is the current approximation, h is the interval
length, f(x, y) is the derivative function, and x(n) is the current value of x.
Using Euler's method, we can calculate the values of y at each interval as follows:
Interval 1:
x(0) = 0 y(0)
=0
f(x(0), y(0)) = 1 - y(0) = 1 - 0 = 1
y(1) = y(0) + h * f(x(0), y(0)) = 0 + 0.1 * 1 = 0.1
The solution for x = 0.2 using Euler's method with an interval length of 0.1 is y ≈ 0.271.