[go: up one dir, main page]

0% found this document useful (0 votes)
34 views11 pages

Computer Oriented Numerical Methods

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views11 pages

Computer Oriented Numerical Methods

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

NAME Srikanth Dodda

ROLL NUMBER 2314104658

SESSION MAY_JUNE 2024

PROGRAM BCA

SEMESTER
III

DCA2101 & COMPUTER


COURSE CODE &
ORIENTED NUMERICAL
NAME
METHODS
SET-I

1. Show that

(a) 휹 = � (∆ + �)
(b) ∆ − � = ∆�

Ans 1.

To prove the given identities, let's start by defining the operators:

Δ = Laplacian operator (also known as the second-order spatial derivative operator)

∇ = Gradient operator (vector of first-order spatial derivatives)

� = Divergence operator (divergence of a vector field)

= Scalar

a) To show that 휹 = �
(� + �) :

We'll start with the left-hand side (LHS):

LHS = �

Using the definition of divergence (�) and scalar ( ), we have:

LHS = ∇ ⋅

Next, let's expand the dot product using the detinition of the gradient (∇) :

∂ ∂ ∂
LHS = , , ⋅
∂x ∂y ∂x

Now, distribute the dot product to each component:

∂ ∂ ∂
LHS = + +
∂� ∂� ∂�

Taking the partial derivatives of � with respect to each coordinate:


∂ ∂ ∂
LHS = + +
∂� ∂� ∂�

Rearranging the terms, we can rewrite this as:

1 ∂ ∂ ∂
LHS = 2 +2 +2
2 ∂� ∂� ∂�

Factoring out the 2 .

1 ∂ ∂ ∂
LHS = 2 + +
2 ∂� ∂� ∂�

∂ ∂ ∂
We can recognize that ∂�
+
∂�
+
∂�
is equal to the Laplacian of (Δ ) :

1
LHS = (2Δ )
2
Simplifying, we get:

LHS = Δ = �

Therefore, we have shown that LHS = RHS, and 휹 = �
(� + �).

b) To prove � − � = �� :

Let's start with the left-hand side (LHS):

LHS = Δ − ∇

Using the definitions of the Laplacian (Δ) and gradient (∇) operators, we have:

∂2 ∂2 ∂2 ∂ ∂ ∂
LHS = + + − , ,
∂�2 ∂�2 ∂�2 ∂� ∂� ∂�

Expanding the terms, we can distribute the negative sign to each component of the
gradient:

∂2 ∂2 ∂2 ∂ ∂ ∂
LHS = 2
+ 2
+ 2
− , ,
∂� ∂� ∂� ∂� ∂� ∂�

Now, let's distribute the Laplacian operator to each component of the gradient:
∂2 ∂ ∂2 ∂ ∂ ∂2
LHS = − , − , −
∂x2 ∂x ∂�2 ∂y ∂�2 ∂x

We can rearrange the terms to group the partial derivatives:

∂2 ∂ ∂2 ∂ ∂ ∂2
LHS = − , − , −
∂�2 ∂� ∂�2 ∂y ∂ℏ2 ∂�

∂2 ∂ ∂ ∂
Recognizing that ∂�2

∂�
is the same as ∂� ∂�
and similarly for the other
components, we can rewrite this as:

∂ ∂ ∂ ∂ ∂ ∂
LHS = , ,
∂� ∂� ∂� ∂� ∂� ∂�

Which is the same as the Laplacian of the gradient operator Δ∇

LHS = Δ∇

Therefore, we have shown that LHS = RHS, and � − � = ��.

QUES :- 2.

Ans 2.

Lagrange Interpolation for Given Points

We are given four data points:

x y
1 -3
3 0
4 30
6 132
Our goal is to find the Lagrange interpolation polynomial, L(x), and use it to estimate
y(5).

1. Lagrange Basis Polynomials:

For each data point (x_i, y_i), we define a Lagrange basis polynomial, ℓ_i(x):

�_�(�) = ∏ (� − �_�) / (�_� − �_�) 푓� 푎�� � ≠ �


0 ≤ � ≤ �

where n is the number of data points (n = 3 in this case).

2. Computing Basis Polynomials:

푎. �_1(�):

�_1(�) = (� − 3)(� − 4)(� − 6) / ((1 − 3)(1 − 4)(1 − 6))


= − (� − 3)(� − 4)(� − 6) / 30

�. �_2(�):

�_2(�) = (� − 1)(� − 4)(� − 6) / ((3 − 1)(3 − 4)(3 − 6))


= (� − 1)(� − 4)(� − 6) / 6

�. �_3(�):

�_3(�) = (� − 1)(� − 3)(� − 6) / ((4 − 1)(4 − 3)(4 − 6))


= − (� − 1)(� − 3)(� − 6) / 6

�. �_4(�):

�_4(�) = (� − 1)(� − 3)(� − 4) / ((6 − 1)(6 − 3)(6 − 4))


= (� − 1)(� − 3)(� − 4) / 30

3. Lagrange Interpolation Polynomial:

The Lagrange interpolation polynomial is constructed as a weighted sum of the basis


polynomials:

�(�) = ∑ �_� �_�(�) 푓� � = 0 푡� �

In our case:

�(�) = − 3 �_1(�) + 0 �_2(�) + 30 �_3(�) + 132 �_4(�)


4. Simplifying L(x):

Substitute the expressions for the basis polynomials and expand:

�(�) = (3/10)(� − 3)(� − 4)(� − 6) − 5(� − 1)(� − 3)(� − 6)


+ (22/5)(� − 1)(� − 3)(� − 4)

5. Estimating y(5):

Set x = 5 in L(x) and evaluate:

3 22
� 5 = 2 1 −1 − 5 4 2 −1 + 4 2 1 = 74.6
10 5

Therefore, the value of y(5) using Lagrange interpolation is 74.6.

Q3.

X 10 20 30 40 50
y= 46 66 81 93 101
f(x)

Ans 3.

To evaluate f(15) using the given table of values, you can use interpolation. Since the
table provides values of y = f(x) for specific values of x, you can interpolate to find
the value of f(15) which falls between x = 10 and x = 20.

We can use linear interpolation for this purpose. Linear interpolation assumes that
the function f(x) varies linearly between two data points. Here's how you can
calculate f(15):

First, identify the two data points that surround x = 15 in the table:

x1 = 10,

y1 = 46

x2 = 20,

y2 = 66

Now, use the formula for linear interpolation:

f(15) = y1 + [(x - x1) / (x2 - x1)] * (y2 - y1)


Plug in the values:

f(15) = 46 + [(15 - 10) / (20 - 10)] * (66 - 46) f(15)

= 46 + (5 / 10) * 20 f(15)

= 46 + 5 * 2 f(15)

= 46 + 10 f(15)

= 56

So, f(15) is equal to 56.

Set-II

Q 4.

X 1 3 4 6 8 9 1 1
1 4
Y 1 2 4 4 5 7 8 9

Ans 4.

To find the equation of the best-fitting straight line for the given data points, you can
use linear regression. The equation of a straight line is typically represented as:

Y = mx + b

Where:

 Y is the dependent variable (in this case, the Y values).

 X is the independent variable (in this case, the X values).

 m is the slope of the line.

 b is the y-intercept.
You need to find the values of m and b that best fit the data points. You can use the
following formulas to calculate them:

m = [(nΣxy) - (Σx)(Σy)] / [(nΣx^2) - (Σx)^2]

b = [(Σy)(Σx^2) - (Σx)(Σxy)] / [(nΣx^2) - (Σx)^2]

Where:

 n is the number of data points (in this case, n = 8).

 Σxy is the sum of the product of X and Y values.

 Σx is the sum of X values.

 Σy is the sum of Y values.

 Σx^2 is the sum of the squares of X values.

Let's calculate m and b step by step:

Calculate the necessary sums:

Σx = 1 + 3 + 4 + 6 + 8 + 9 + 11 + 14 = 56

Σy = 1 + 2 + 4 + 4 + 5 + 7 + 8 + 9 = 40

Σxy = (11) + (32) + (44) + (64) + (85) + (97) + (118) + (149) = 385

Σx^2 = (1^2) + (3^2) + (4^2) + (6^2) + (8^2) + (9^2) + (11^2) + (14^2) = 488

Now, calculate m and b using the formulas:

m = [(8 * 385) - (56 * 40)] / [(8 * 488) - (56^2)] m = [3080 - 2240] / [3904 - 3136] m
= 840 / 768 m = 35/32

b = [(40 * 488) - (56 * 385)] / [(8 * 488) - (56^2)]


b = [19520 - 21560] / [3904 - 3136] b = -2040 / 768 b = -85/32

So, the equation of the best-fitting straight line for the given data is:

Y = (35/32)X - (85/32)

Q5.

Ans 5.

System of Equations:

Given system of equations:


1. x + y + z = 6
2. x + 2y + 3z = 10
3. x + 2y + λz = μ

(i) Unique Solution:


For a unique solution, the determinant of the coefficient matrix must be non-zero.

Coefficient matrix:

1 1 1
� = 1 2 3
1 2 λ

Determinant of A:

det(A)=1⋅(2λ−3⋅2)−1⋅(1⋅λ−3⋅1)+1⋅(1⋅2−2⋅1)
=1⋅(2λ−6)−1⋅(λ−3)+1⋅(2−2)
=2λ−6−λ+3
=λ−3

For a unique solution:

λ-3≠0⟹λ≠3

(ii) Infinite Number of Solutions:


For infinite solutions, the determinant must be zero and the augmented matrix must
be consistent.
λ−3=0
λ=3
Augmented matrix:

1 1 1 6
1 2 3 10
1 2 3 μ

Row operations give:

1 1 1 6
�2 → �2 − �1: 0 1 2 4
1 2 3
1 1 1 6
�3 → �3 − �1: 0 1 2 4
0 1 2 −6
1 1 1 6
�3 → �3 − �2: 0 1 2 4
0 0 0 − 10

For consistency:

μ−10=0
μ=10

Thus, infinite solutions occur if λ=3\lambda = 3λ=3 and μ=10\mu = 10μ=10.

(iii) No Solution:
For no solution, the determinant must be zero and the augmented matrix must be
inconsistent.
λ=3
μ ≠ 10

QUES :- 6.

Ans 6.

Euler's Method Solution


Find the solution for x=0.2 taking interval length 0.1 using Euler’s method to solve:
dy/dx = 1 - y, given y(0) = 0.
Solution:
Given differential equation:

dy/dx = 1 - y

Initial condition: y(0) = 0

Step size (h): 0.1

Using Euler's method:


Euler's method formula: y_{n+1} = y_n + h * f(x_n, y_n)

Where f(x, y) = 1 - y

Step 1:

x_1 = x_0 + h = 0 + 0.1 = 0.1

y_1 = y_0 + h * f(x_0, y_0) = 0 + 0.1 * (1 - 0) = 0 + 0.1 * 1 = 0.1

Step 2:

x_2 = x_1 + h = 0.1 + 0.1 = 0.2

y_2 = y_1 + h * f(x_1, y_1) = 0.1 + 0.1 * (1 - 0.1) = 0.1 + 0.1 * 0.9 = 0.1 + 0.09 =
0.19

Initial condition: y(0) = 0

Step size: h = 0.1

Solution at x = 0.2: y(0.2) = 0.19

You might also like