Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

Computer Oriented Numerical Methods

The document contains multiple mathematical problems and their solutions, including Lagrange's interpolation polynomial, eigenvalues and eigenvectors of a matrix, Cramer's rule for solving systems of equations, and linear regression for best fitting lines. It also discusses conditions for unique, infinite, or no solutions in systems of equations. Additionally, it applies Euler's method to approximate solutions for differential equations.

Uploaded by

downloadingleo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Computer Oriented Numerical Methods

The document contains multiple mathematical problems and their solutions, including Lagrange's interpolation polynomial, eigenvalues and eigenvectors of a matrix, Cramer's rule for solving systems of equations, and linear regression for best fitting lines. It also discusses conditions for unique, infinite, or no solutions in systems of equations. Additionally, it applies Euler's method to approximate solutions for differential equations.

Uploaded by

downloadingleo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

NAME

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

Ans.:- The given data can be arranged as follows:

x 1 3 4 6

y=f(x) -3 0 30 132

Using Lagrange’s interpolation polynomial formula :

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,

y(x)=(−5𝑥³ + 135𝑥² − 460𝑥 + 300) = 1(−𝑥³ + 27𝑥² − 92𝑥 + 60)


2

Which is the required Lagrange’s interpolation polynomial, so y(5)=75.

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.

(b) Find the eigenvalues and eigenvectors of the matrix A= |2 1|


|4 5|

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

y₅= E⁵yₒ= (1+ Δ)⁵yₒ


= yₒ+ 5C₁Δyₒ+ 5C₂Δ²yₒ+5C₃Δ³yₒ+.......

=8+5(4)+10(3)+10(0)= 58

So the 6th term is 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

Where A is the matrix, λ is the eigenvalue, and I is the identity matrix.

Let's calculate the eigenvalues:


A = |2 1|
|4 5|

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

Setting the determinant equal to zero and solving for λ: λ^2


- 7λ + 2 = 0

Using the quadratic formula:


λ = (-(-7) ± sqrt((-7)^2 - 4(1)(2))) / (2(1))
= (7 ± sqrt(49 - 8)) / 2
= (7 ± sqrt(41)) / 2

So, the eigenvalues are:


λ₁ = (7 + sqrt(41)) / 2 λ₂
= (7 - sqrt(41)) / 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₁|

This leads to the following system of equations:


-(3 + sqrt(41))/2 * x₁ + y₁ = 0
4 * x₁ - (3 + sqrt(41))/2 * y₁ = 0

Solving this system of equations, we find:


x₁ = (3 + sqrt(41))/2 * y₁

Therefore, the eigenvector corresponding to λ₁ is:


v₁ = |(3 + sqrt(41))/2 * y₁|
|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.

Que.-3:- (a) Solve the system of equation by Cramer’s rule, 3x+y+2z=3,

2x-3y-z=3

(b) Evaluate to four decimal places by Newton’s-Raphson formula.

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:

The system of equations:


3x + y + 2z = 3 (Equation 1)
2x - 3y - z = 3 (Equation 2)
Step 1: Calculate the determinant of the coefficient matrix, D.
D = |3 1 2|
|2 -3 -1|
|0 0 1|
D = (3*(-31 - (-10))) - (1*(21 - (-10))) + (2*(20 - (-30)))
D = (3*(-3)) - (1*(2)) + (2*(0))
D = -9 - 2 + 0
D = -11

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

Step 5: Calculate the values of x, y, and z.


x = Dx / D = -12 / -11 = 12/11 y = Dy / D
= -7 / -11 = 7/11 z = Dz / D = -33 / -11 =
33/11

Therefore, the solution to the given system of equations is:


x = 12/11 y = 7/11
z = 33/11

(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

We repeat the process until we reach the desired precision.


X(2) = (X(1) + (12 / X(1))) / 2
X(3) = (X(2) + (12 / X(2))) / 2
X(4) = (X(3) + (12 / X(3))) / 2

Performing these iterations, we arrive at an approximation with four decimal places:


X(2) = 3.464285714285714
X(3) = 3.4641016151377544
X(4) = 3.4641016151377544

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

Ans.:- The given system can be written as

|1 1 1 | |x| |6 |
|1 2 3 | |y| = |10| |1
2 λ | |z| |μ |

AX=B

The augmented matrix.

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

|1 2 λ-3 μ-10 | R₃→R₃-R₂

Case (i) : λ−3=0 and μ−10≠0

(ie) λ=3,μ≠10

ρ(A)=2,ρ(A,B)=3

∴ρ(A) ≠ ρ(A,B)
The given system is inconsistent but has no solution.

Case (ii) : λ−3≠0 and μ R

(ie) λ≠3

\rho(A) = \rho(A,B) =3$$

The given system is consistent and has a unique solution.

Case (iii) : λ=3 and μ=10

ρ(A)=ρ(A,B)=2< number of unknowns.

The given system is consistent but has an infinite number of solutions.

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.

The given data points are as follows:


X: 1, 3, 4, 6, 8, 9, 11, 14
Y: 1, 2, 4, 4, 5, 7, 8, 9

Step 1: Calculate the means of X and Y:


X̄ = (1 + 3 + 4 + 6 + 8 + 9 + 11 + 14) / 8 = 56 / 8 = 7
Ȳ = (1 + 2 + 4 + 4 + 5 + 7 + 8 + 9) / 8 = 40 / 8 = 5

Step 2: Calculate the differences from the means:


ΔX = X - X̄ : (-6, -4, -3, -1, 1, 2, 4, 7)
ΔY = Y - Ȳ: (-4, -3, -1, -1, 0, 2, 3, 4)

Step 3: Calculate the sum of the products of the differences:


Σ(ΔX * ΔY) = (-6 * -4) + (-4 * -3) + (-3 * -1) + (-1 * -1) + (1 * 0) + (2 * 2) + (4 * 3) + (7 * 4) =
24 + 12 + 3 + 1 + 0 + 4 + 12 + 28
= 84

Step 4: Calculate the sum of the squared differences of X:


Σ(ΔX^2) = (-6)^2 + (-4)^2 + (-3)^2 + (-1)^2 + (1)^2 + (2)^2 + (4)^2 + (7)^2 =
36 + 16 + 9 + 1 + 1 + 4 + 16 + 49
= 132

Step 5: Calculate the slope of the best fitting line: Slope,


m = Σ(ΔX * ΔY) / Σ(ΔX^2)

Step 6: Calculate the y-intercept of the best fitting line:


y-intercept, b = Ȳ - (m * X̄ )
= 5 - (0.6364 * 7)
≈ 0.2727

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.

Given the equation: dy/dx = 1 - y


Initial conditions: x(0) = 0, y(0) = 0
Interval length: h = 0.1

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

Interval 2: x(1) = x(0) + h = 0 + 0.1 =


0.1 y(1) = 0.1 (from the previous
interval) f(x(1), y(1)) = 1 - y(1) = 1 -
0.1 = 0.9
y(2) = y(1) + h * f(x(1), y(1)) = 0.1 + 0.1 * 0.9 = 0.19

Interval 3: x(2) = x(1) + h = 0.1 + 0.1 =


0.2 y(2) = 0.19 (from the previous
interval) f(x(2), y(2)) = 1 - y(2) = 1 -
0.19 = 0.81
y(3) = y(2) + h * f(x(2), y(2)) = 0.19 + 0.1 * 0.81 = 0.271

The solution for x = 0.2 using Euler's method with an interval length of 0.1 is y ≈ 0.271.

You might also like