Computer Oriented Numerical Methods Assignment 2101
Computer Oriented Numerical Methods Assignment 2101
INTERNAL ASSIGNMENT
PROGRAM BCA
SEMESTER III
(b) ∆ − 𝛁 = ∆𝛁
Solu: ∆ − ∇ = (𝐸 − 1) − (1 − 𝐸 −1 )
= 𝐸 − 2 + 𝐸 −1 [A]
∆∇ = (𝐸 − 1)(1 − 𝐸 −1 )
= 𝐸 − 1 − 𝐸𝐸 −1 + 𝐸 −1
= 𝐸 + 𝐸 −1 − 2 [B]
From equations A and B, we get ∆ − ∇ = ∆∇
Q2. Find Lagrange’s interpolation polynomial fitting the points y(1) = -3, y(3) = 0, y(4)
= 30, y(6) = 132 Hence find y(5).
Solu: The given data can be arranged as follows:
x 1 3 4 6
y = f(x) -3 0 30 132
= 75
Q4. 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
Solu: Let Y = a + bX be the required best-fit straight line.
Its normal equations are given by
𝑌 = 𝑛𝑎 + 𝑏𝑋
𝑋𝑌 = 𝑎𝑋 + 𝑏𝑥 2
There are 8 tabulated data, therefore n = 8
X Y XY 𝑿𝟐
1 1 1 1
3 2 6 9
4 4 16 16
6 4 24 36
8 5 40 64
9 7 63 81
11 8 88 121
14 9 126 196
𝑿 = 𝟓𝟔 𝒀 = 𝟒𝟎 𝑿𝒀 = 𝟑𝟔𝟒 𝑿𝟐 = 𝟓𝟐𝟒
The normal equations become
40 = 8𝑎 + 56𝑏 (1)
364 = 56𝑎 + 524𝑏 (2)
(2)– (1) ∗ 7 , we get
132𝑏 = 84
𝑏 = 0.64
Substituting the value of b in (1) we get 𝑎 = 0.52
The equation 𝑌 = 𝑎 + 𝑏𝑋 becomes
𝑌 = 0.52 + 0.64𝑋
Q5. For what value of & the following system of equations:
𝒙+𝒚+𝒛=𝟔
𝒙 + 𝟐𝒚 + 𝟑𝒛 = 𝟏𝟎
𝒙 + 𝟐𝒚 + 𝒛 = may have
(i) Unique solution
(ii) Infinite number of solutions
(iii) No solution
Solu: Analysing the system’s consistency and properties of the coefficient matrix
Given,
𝑥+𝑦+𝑧 =6
𝑥 + 2𝑦 + 3𝑧 = 10
𝑥 + 2𝑦 + 𝑧 =
The coefficient matrix is:
1 1 1
A= [1 2 3]
1 2
The augmented matrix is:
1 1 1 6
[A|B] = [1 2 3 10]
1 2
(i) Unique Solution: The system will have a unique solution when the determinant of A is
non-zero
1 1 1
𝐷𝑒𝑡(𝐴) = |1 2 3|
1 2
Expanding along the first row:
2 3 1 3 1 2
𝐷𝑒𝑡(𝐴) = 1. | | − 1. | | + 1. | |
2 1 1 2
Computing each minor:
2 3
| | = (2. − 2.3) = 2 − 6
2
1 3
| | = (1. − 1.3) = − 3
1
1 2
| | = (1.2 − 1.2) = 0
1 2
So,
𝐷𝑒𝑡(𝐴) = 1. (2 − 6) − 1. ( − 3) + 1.0
𝐷𝑒𝑡(𝐴) = 2 − 6 − + 3 = − 3
Hence, for a unique solution, 𝐷𝑒𝑡(𝐴) ≠ 0, 𝑖. 𝑒., ≠ 3
(ii) Infinite Solutions: 𝐷𝑒𝑡(𝐴) = 0, 𝑖. 𝑒., = 3, and the system must be consistent.
Substituting = 3 into the third equation: 𝑥 + 2𝑦 + 3𝑧 = 𝜇
The system becomes:
1. 𝑥 + 𝑦 + 𝑧 = 6
2. 𝑥 + 2𝑦 + 3𝑧 = 10
3. 𝑥 + 2𝑦 + 3𝑧 = 𝜇
For consistency, the third equation must not contradict the second. Hence, 𝜇 = 10
Hence, for infinite solutions, = 3 and 𝜇 = 10
Q6. Find the solution for 𝒙 = 𝟎. 𝟐 taking interval length 0.1 using Euler’s method to
𝒅𝒚
solve: 𝒅𝒙 = 𝟏 − 𝒚 given 𝒚(𝟎) = 𝟎.
𝑑𝑦
Solu. The given differential equation is 𝑑𝑥 = 1 − 𝑦
Therefore 𝑓(𝑥, 𝑦) = 1 − 𝑦
Also, we have 𝑥0 = 0, 𝑦0 = 0, ℎ = 0.1
𝑥1 = 𝑥0 + ℎ = 0 + 0.1 = 0.1
Putting 𝑖 = 0 in Euler’s formula 𝑦𝑖+1 = 𝑦𝑖 + ℎ𝑓(𝑥𝑖 , 𝑦𝑖 )
We get
𝑦(𝑥1 ) = 𝑦1 = ℎ 𝑓 (𝑥0 , 𝑦0 )
𝑦(𝑥1 ) = 𝑦1 = 𝑦0 + ℎ(1 − 𝑦0 )
= 0 + 0.1(1 − 0) = 0.10
Therefore 𝑦(0.1) = 𝑦1 = 0.10
Put 𝑖 = 1 in equation (1), we get
𝑥2 = 𝑥1 + ℎ = 0.1 + 0.1 = 0.2
𝑦2 = 𝑦(𝑥2 ) = 𝑦1 + ℎ𝑓(𝑥1 , 𝑦1 ) = 𝑦1 + ℎ(1 − 𝑦1 ) = 0.1 + 0.1(1 − 0.1)
= 0.19
Hence 𝑦(0.1) = 0.10 and 𝑦(0.2) = 0.19