Dca2101 - Computer Oriented Numerical Methods

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

INTERNAL ASSIGNMENT

NAME DHANANJAY
ROLL NO 2214504860
SEMESTER
III

COURSE CODE & NAME


DCA2101 &
Computer Oriented Numerical Methods

SESSION SEPTEMBER 2022

Set I

Question .1.a.) Show that

1
(a) δμ= (∆+ ∇)
2

Answer.:- The Laplacian operator in Cartesian coordinates is given by .:-


2 2 2
2 ∂ ∂ ∂
∆=∇ = 2
+ 2+ 2
∂ x ∂ y ∂z

The gradient operator in Cartesian coordinates is .:-


∂ ^ ∂ ^ ∂ ^
∆= i+ j+ k
∂x ∂ y ∂z
The Kronecker delta , 𝛿, is defined as

{
δij= 1∧if i= j
0∧if i ≠ j

Now , let’s evaluate 𝛿µ in terms of ∆∧∇ .:-

1
δμ= (∆+ ∇)
2

In Cartesian coordinates , Kronecker delta µ = µ is 1 , and for µ ≠ µ is 0 .


Let’s consider the components of 𝛿µ .:-

When µ = µ :

𝛿µµ = 1

When µ = µ :

𝛿µµ = 0

1
Therefore , the expression δμ µ= ( ∆+∇ ) doesn’t hold true for arbitrary µ .
2

(b) ∆−∇=∆ ∇

Answer.:- Given ∆−∇=∆ ∇


Let's use the definition of the Laplacian and gradient operators:
2 2 2
2 ∂ ∂ ∂
The Laplacian operator in Cartesian coordinates is ∆=∇ = 2
+ 2+ 2.
∂ x ∂ y ∂z
∂ ^ ∂ ^ ∂ ^
The gradient operator in Cartesian coordinates is ∆= i+ j+ k .
∂x ∂ y ∂z
Substitute these definitions into the equation:
2
∇ =∇=∇ ( ∇ )
Let's solve this step by step:
2 2 2
2 ∂ ∂ ∂
∇= 2
+ 2 + 2.
∂ x ∂ y ∂z

∇ ( ∇ )=( ∂∂x i^ + ∂∂y ^j + ∂∂z k^ )( ∂∂x i^ + ∂∂y ^j + ∂∂z k^ )


∇ (∇ ) = ( ) ( )
∂ ∂ ^
∂x ∂x
i +
∂ ∂ ^
∂x ∂ y
j +
∂ ∂ ^
∂x ∂z ( ) ( )
k +
∂ ∂ ^
∂ y ∂x
i +
∂ ∂ ^
∂y ∂y
j + ( ) ( ) ( )
∂ ∂ ^
∂ y ∂z
k +
∂ ∂ ^
∂z ∂x
i

+ (
∂ ∂ ^
∂z ∂ y
j )+
∂z(∂z )
∂ ∂ ^
k

It appears that Δ−∇ is not equal to Δ ∇ based on thew definitions of the Laplacian and gradient
operators . The result dose not simplify to the from Δ−∇=¿ Δ ∇.

Therefore ,

As it stands , the equation Δ−∇=¿ Δ ∇ dose not hold true .

Question .2.) Solve the system of equation by Gauss Elimination’s method

2 x+ y+ 4 z=12

4 x+11 y−z=33

8 x−3 y +2 z=20.

Answer.:- The given system of equations is:

1. 2 x+ y+ 4 z=12
2. 4 x+11 y−z=33
3. 8 x−3 y +2 z=20

Let's start by representing this system as an augmented matrix:

( )
2 1 412
2 11 −133
8 −3 220

Now, let's perform row operations to bring this matrix to row-echelon form:

R2 = R2 - 2 * R1

R3 = R3 - 4 * R1

2 1 12 12
( 0 9
)
9 33
0 0 −21- 21

Now, let's solve for z from the last row:

-21 z = -21

z=1
Substituting z =1 into the second row:

9y -9=9

9 y 18

Y=2

Finally , substituting z = 1 y = 2 into the first row :

2 x + 2 + 4 = 12

2x=6

X=3

Therefore ,

The solution to the system of equations is x = 3 , y = 2 , and z = 1 .

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

Answer.:-
Given data:
X: 1, 3, 4, 6, 8, 9, 11, 14
Y: 1, 2, 4, 4, 5, 7, 8, 9

Calculations:
n=8

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


∑ y=1+2+4 +4 +5+7+ 8+9=40
∑ x y=(1∗1)+(3∗2)+(4∗4)+(6∗4 )+(8∗5)+(9∗7)+(11∗8)+(14∗9)=416
∑ x 2=( 12) + ( 32 ) +( 42 ) +( 6 2 ) +( 82 ) +( 92 ) +( 112 ) +( 142 ) =494
Now, let's calculate the slope (m) using the formula:
(8× 416)−(56 × 40) 3328−2240 1088 34 17
m= 2
= = = =
(8 × 494)−( 56 ) 3952−3136 816 26 13
Next, calculate the y-intercept (c):
17 952
40− × 56 40−
13 13 120
c= =
8 8 13
Therefore,
The equation of the best-fitting straight line for this data set is:
17 120
y= x+
13 13

Set - II

Question .4.) Evaluate f (15), given the following table of values:

x 10 20 30 40 50

y = f (x) 46 66 81 93 101
Answer.:-
Given the points (x, y):
(10, 46) and (20, 66)
The formula for linear interpolation between two points is:
(x−x 0).(f (x 1)−f (x 0 ))
f ( x )=f ( x 0 )
x 1−x 0

Where .:-
x 0∧f (x 0 )are t h e values at t h e point before t h e target value(¿ t his case , x=10∧f (x )=46)

x 1∧f (x 1)are t h e va lues at t h e point before t h e target value (¿ t h is case , x=20∧f (x)=66)

¿ f ( x )=66 ¿ ,

¿ x is t h e target value(¿ t h is case , x =15).


let ’ s plug i nt h e values. :−¿

(15−10).(66−46)
f ( 15 )=46 +
20−10
5.20
f ( 15 )=46 +
10
f ( 15 )=46 +10
f ( 15 )=56
So ,
Based on linear interpolation from the given table , f ( 15 )=56

Question .5.) Use Taylor’s series method to solve the initial value problem:

dy 2 2
=x + y for x=0 . 25∧0 . 5 given that y (0)=1 .
dx

Answer.:-

The differential equation given is:


dy 2 2
=x + y
dx
Given the initial condition y (0) = 1 , we’ll start by finding the Taylor series expansion for y (x)
around x = 0 :-
2 3
Let y ( x )= y 0 + y 1 x + y 2 x + y 3 x + ………..
dy 2
= y 1+2 y 2 x+3 y 3 x ......... .
dx
Using the given differential equation, we get:
2
y 1 +2 y 2 x +3 y 3 x +¿ ……….. x 2+ ¿

To solve for the coefficients, equate the corresponding powers of x on both sides of the
equation.
At x = 0 :
2 2
y 1=0 + y 0 ¿

So , y1 = 1 .
At x = 0 :
y 1=¿ 2y2(0)= 02

So , y2 = 0 .
We've found the first two coefficients. Now, we can express y(x) using the Taylor series
expansion:
Substituting the values we found:
y (x) = 1 + x
Now, we'll use this approximation to find the values of Y AT X = 0.25 and x = 0.5 :
Y ( 0 . 25) = 1 + 0.25 = 1.25
Y ( 0.5) = 1 + 0.5 = 1.5
So, using Taylor's series method, the approximated values of y at x = 0.25 and x = 0.5
are 1.25 and 1.5 respectively , based on the first – order Taylor series expansion around
x=0.

Question .6.) Apply Runge-Kutta fourth order method to find an approximate


dy 2
value of y when x = 0.1 given that dx =x − y , y ( 0 )=1.

Answer .:-
dy 2
Given the initial condition =x − y , y ( 0 )=1 , we need to solve for y at x = 0.1
dx
The fourth-order Runge-Kutta method involves the following steps:
1. Define the step size , h .
2. Using following formulas to iterate and approximate y :
k 1=h f (x n , y n)
h k1
k 2=h f (x n + , y n + )
2 2
h k 2
k 3=h f (x n+ , y n+ )
2 2
k 4=h f (x n +h , y n +k 3)
1
y n +1= y n+ ( k 1+ 2 k 2+ 2k 3+ 2 k 4 )
6
w h ere .:−¿
 h is the step size .
 x n and y n are the known x and y values at the current step .
 F(x,y) is the differential equation : x2 – y .
Let's implement this algorithm to find the approximate value of y when x = 0.1 we’ll
start with h = 0.1 for this example .
Let me recompute the solution using the fourth-order Runge-Kutta method.
dy 2
Given the differential equation =x − y and the initial condition y(0) = 1 , we want
dx
to find the approximate value of y at x = 0.1 .
1. Define the function f(x,y) based on the given differential equation .:-
2. Using the following formulas to iterate and approximate y :

k 1=h . f (x n , y n)
h k1
k 2=h . f ( x n + , y n + )
2 2
h k 2
k 3=h . f ( x n + , y n + )
2 2
k 4=h . f (x n+ h , y n+ k 3)
1
y n +1= y n+ ( k 1+ 2 k 2+ 2k 3+ 2 k 4 )
6
Let's compute the approximate value of y at x 0.1 using the given method and
initial conditions .
Let's use the fourth-order Runge-Kutta method to approximate the value of y
where x = 0.1 for the given differential equation :-
dy 2
=x − y
dx
with the initial condition y (0) = 1.
The fourth-order Runge-Kutta method involves iterative steps. We'll use a step
size h and perform calculations to approximate y at x = 0.1. The
formulas for the method are:

1. k 1=h . f (x n , y n)
h k
2. k 2=h . f ( x n + , y n + 1 )
2 2
h k
3. k 3=h . f ( x n + , y n + 2 )
2 2
4. k 4=h . f (x n+ h , y n+ k 3)

Where f( x, y ) = x2 y , and then :


1
y n +1= y n (k 1 +2 k 2 +2 k 3 +2 k 4)
6

You might also like