Ass Dca2101

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Name OM AGARWAL

Roll Number 2114501437


Program BACHELOR OF COMPUTER APPLICATION (BCA)
Semester 3
Course Name COMPUTER ORIENTED NUMERICAL METHODS
Course Code DCA2101
SET - 1

(Answer #1) (A)

We know Taylor’s series expansion of function f ( x) at the point x 0 is,

2 3 n n
(x−x 0)f ' (x 0) (x−x 0 ) f ' ' ( x 0) ( x−x 0 ) f ' ' ' (x 0) ( x−x 0) f ( x0 )
f ( x)=f ( x 0) + + + + ............. +
1! 2! 3! n!

So at x 0=3 we have, ---- (1)

(x−3) f ' (3) ( x−3)2 f ' ' (3) (x−3)3 f ' ' ' (3) (x−3)n f n (3)
f ( x)=f (3) + + + + ............. +
1! 2! 3! n!

Now, Differentiate the given equation,


3 2
f ( x ) = x −10 x +6

f ' ( x ) = 3 x 2−20 x

f ' ' ( x ) = 6 x−20

f ' ' ' (x) = 6

f '' ' ' (x) = 0

At x 0=3 we have,

f ( 3 ) = 27−90+ 6=−57

f ' ( 3 ) = 27−60=−33

f ' ' ( 3 ) = 18−20=−2

f ' ' ' (3) = 6

Putting these values (1) we get,


2 3
f ( x)=−57 − 33 ( x−3) − ( x−3) + ( x−3) + 0

f ( x)= +( x−3)3 − (x−3)2− 33( x−3)−57

(Answer #1) (B)

We have the equation,


2 2 2 2 2 2
f ( x , y , z )=3 x y +5 y z −7 x z +38 —— (1)

Where we have,

x= y=z =1 & ∆ x=−0.05 , ∆ y=0.001 , ∆ z=0.02 ——(2)

We know that,
If f(x, y, z) be a function of 3-variables (x, y, z). Let Δ f represents the error f,

Δf = | ∂∂ fx ×Δ x | + | ∂∂fy ×Δ y | + | ∂∂ fz ×Δ z | ——(3)

from equ(1), differentiating it with respect to x ,

∂f 2 2
= 6 x y −14 x z
∂x

from equ(1), differentiating it with respect to y,

∂f
= 6 y x 2 +10 y z 2
∂y

from equ(1), differentiating it with respect to z ,

∂f
= 10 z y 2−14 z x 2
∂z

Then putting all the values in equ(3)

Δ f = | (6 x y −14 x z )×Δ x | + | ( 6 y x +10 y z )×Δ y | + | (10 z y −14 z x )×Δ z |


2 2 2 2 2 2

from equ(2)

Δ f = | (−8)×(−0.05) | + | (16)×(0.001) | + | (−4)×(0.02) |

Δ f = 0.4 + 0.016 − 0.08 = 0.336

Now,

f ( 1,1,1 )= 39

Finanlly relative error for the given function,

Δ f = 0.4 + 0.016 − 0.08 = 0.336

Δf 0.336
Er = = = 0.00861538461
f 39
(Answer #2)

the given series: 8,12,19,29,42


let assume the 6th term as X.

so: 8,12,19,29,42, X
given that the second-order difference is constant, constructing a difference table

Difference table,

X Y ∆ ∆^2 ∆^3
1 8 4 3 0
2 12 7 3 0
3 19 10 3 X-58
4 29 13 X-55
5 42 X-42
6 X

Because second-order difference is constant so third-order difference must be 0 in all conditions,


X-58 = 0
X = 58

so the 6th term will be: 58


and series: 8,12,19,29,42, 58

(Answer #3) (A)

Let a function f(x) is given at point (0,2), (2,10), (4,15), (6,18), (8,22), (10,10). Find .
∇ y 4 ,∇ 3 y 3

The F(x) is given at points (0,2), (2,10), (4,15), (6,18), (8,22), (10,10),
which mean,

x 0=0 , y 0=2 ,

x 1=2 , y 1=10 ,

x 2=4 , y 2=15 ,

x 3=6 , y3 =18 ,

x 4=8 , y 4 =22 ,

x 5=10 , y 5=10
So, backward differences of 1st order.

∇ y 1= y 1− y 0 =10−2=8 ,

∇ y 2= y 2− y1 =15−10=5 ,

∇ y 3= y 3 − y 2=18−15=3 ,

∇ y 4 = y 4 − y 3=22−18=4 ,

∇ y 5= y 5 − y 4=10−22=−12

So, backward differences of 2nd order.


2
∇ y 1=∇ y 2−∇ y 1=5−8=−3 ,

2
∇ y 2=∇ y 3 −∇ y 2=3−5=−2 ,

2
∇ y 3=∇ y 4−∇ y3 =4−3=1 ,

2
∇ y 4 =∇ y 5−∇ y 4=−12−4=−16 ,

So, backward differences of 3rd order.


3 2 2
∇ y 1=∇ y 2−∇ y 1=1 ,

3 2 2
∇ y 2=∇ y 3 −∇ y 2=3 ,

3 2 2
∇ y 3=∇ y 4−∇ y 3=−17 ,

So, ∇ y 4=4 , ∇ 3 y 3=−17

(Answer #3) (B)

Let x = √ 12 , so that it can be x 2 − 12 = 0

taking the function f ( x) = x 2 − 12

Now putting x = 0, f (0) = −12


Now putting x = 1, f (1) = −11

Now putting x = 2, f (2) = −8

Now putting x = 3, f (3) = −3


Now putting x = 4, f (4) = 4

f (3) < 0 < f (4) Therefore a root of f(x) lies between 3 and 4, so x 0=3

f ' (x) = 2 x —— (1)

By Newton’s – Raphson formula

f (x n )
x(n+1) = x n − where n = 0,1,2,3….. & f ' (x n)≠0
f '( x n )

from equ(1) and given equ we will have,

x 2n−12
x(n+1) = x n − —— (2)
2 xn

1st iteration from equ(2) and putting, n = 0


2
x 0−12 9−12 1
x1 = x0 − =3− = 3 + = 3.5
2 x0 6 2

2nd iteration from equ(2) and putting, n = 1


2
x 1−12 12.25−12 0.25
x2 = x1 − = 3.5 − = 3.5 − = 3.5 − 0.0357142 = 3.4642
2 x1 7 7

3rd iteration from equ(2) and putting, n = 2


2
x 2−12 12.0006−12 0.0006
x 3 = x2 − = 3.4642 − = 3.4642 − = 3.4642−8.6705=−5.2063
2 x2 6.92 6.92

4th iteration from equ(2) and putting, n = 3


2
x 3−12 27.1055−12 15.1055
x4 = x3 − = −5.2063 − = −5.2063 − = −5.2063+1.4506=−3.7557
2 x3 −10.4126 −10.4126

SET - 2

(Answer #4)

From the given system of equations,

83 x +11 y – 4 z=95 , |83| > |11| + |4|


7 x +52 y +13 z=104 , |52| > |7| + |13|

3 x+ 8 y+ 29 z=71 , |71| > |3| + |8|

So, rewriting the given system as,

1
x=( )∗(95−11 y +4 z) ——(1)
83

1
y=( )∗( 104−13 z−7 x) ——(1)
52

1
z=( )∗( 71−8 y−3 x) ——(1)
29

Take the initial approximation vector as,


x = x 0 = 0, y = y 0 = 0, z = z 0 = 0.

Now, from equation(1) and Substituting initial approximation vector, we gets the 1st iteration.

95
x 1=( )=1.1445 ——(2)
83

104
y 1=( )=2 ——(2)
52

71
z 1=( )=2.4482 ——(2)
29

Now, from equation(1) and Substituting equation (2), we gets the 2nd iteration.

1 1
x 2=( )∗(95−11∗2+ 4∗2.4482)=( )∗( 82.7928)=0.9975 ——(3)
83 83

1 1
y 2=( )∗(104−13∗2.4482−7∗1.1445)=( )∗(64.1928)=1.2344 ——(3)
52 52

1 1
z 2=z=( )∗(71−8∗2−3∗1.145)=( )∗(51.565)=1.7781 ——(3)
29 29

Now, from equation(1) and Substituting equation (3), we gets the 3rd iteration.

1 1
x 3=( )∗(95−11∗1.2344+ 4∗1.7781)=( )∗(88.534)=1.0666 ——(4)
83 83

1 1
y 3=( )∗(104−13∗1.7781−7∗0.9975)=( )∗(73.9022)=1.4211 ——(4)
52 52
1 1
z 3=z=( )∗( 71−8∗1.2344−3∗0.9975)=( )∗( 58.1323)=2.0045 ——(4)
29 29

Now, from equation(1) and Substituting equation (4), we gets the 4th iteration.

1 1
x 4=( )∗(95−11∗1.4211+ 4∗2.0045)=( )∗(87.3859)=1.052 ——(5)
83 83

1 1
y 4 =( )∗(104−13∗2.0045−7∗1.0666)=( )∗(70.4753)=1.355 ——(5)
52 52

1 1
z 4=z =( )∗(71−8∗1.4211−3∗1.0666)=( )∗(56.4314)=1.945 ——(5)
29 29

Now, from equation(1) and Substituting equation (5), we gets the 5th iteration.

1 1
x 5=( )∗(95−11∗1.355+4∗1.945)=( )∗(87.875)=1.058 ——(6)
83 83

1 1
y 5=( )∗(104−13∗1.945−7∗1.052)=( )∗(71.351)=1.372 ——(6)
52 52

1 1
z 2=z=( )∗(71−8∗1.355−3∗1.052)=( )∗(57.004)=1.9655 ——(6)
29 29

the 4th and 5th iteratios given almost the same values,
Hence the solution to the given system of equations, are:

x = 1.058 , y = 1.372, z = 1.965

(Answer #5)

the given equation for the straight line is,

y=ax+ b

And The normal equations of least square fit are,

∑ y = nb + a ∑ x
∑ xy = b ∑ x + a ∑ x2
From the given data, we get,

x y xy x
2

0.5 15 7.5 0.25


1.0 17 17 1
1.5 19 28.5 2.25
2.0 14 28 4
2.5 10 25 6.25
3.0 7 21 9
∑ x=10.5 ∑ y =82 ∑ xy=127 ∑ x 2=22.75
Because we have 6 endpoints so n = 6,
Putting these summations into normal equations of least square fit. we gets,

82 = 6b + 10.5a ——(1)
127 = 10.5b + 22.75a ——(2)

Sloving equations 1 & 2,

(82 – 10.5a) / 6 = b ——(3)

127 = 10.5*(82 – 10.5a) / 6 + 22.75a

861 110.25∗a
127= − +22.75 a
6 6

127=143.5−18.375 a+22.75 a

127=143.5−4.375 a

(143.5−127)
a= =3.771
4.375

(10.5∗3.771)
b=13.667− =13.667−6.56=7.107
6

Therefore the required straight line that fits for the given data is,

y = 3.771x + 7.107

(Answer #6)

Let consider,

x y
21 = x−1 18.4708 = y−2
25 = x−1 17.8144 = y−1
29 = x 0 17.1070 = y 0
33 = x 1 16.3432 = x 1
37 = x 2 15.5154 = x 2

The difference table,

x y Δy Δ^2y Δ^3y Δ^4y


21 18.4708
-0.6564
25 17.8144 -0.051
-0.7074 -0.005
29 17.1070 -0.056 -0.003
-0.7638 -0.008
33 16.3432 -0.064
-0.8278
37 15.5154

So from the Gauss Forward formula, we have:


2 3
u (u−1)× Δ ( y−1 ) u( u−1)(u+1)×Δ ( y−1)
y = y 0 + uΔy 0 + + + ......... .
2! 3!

where,
x '−x 0
u stands for: ,
h
and we have given h = x 2−x1 =4 & x '=0

0−29
So, u= =−7.25
4

Substituting values from the difference table,

−7.25(−7.25−1)×−0.056
y = 17.1070 + −7.25∗−0.7638 +
2!

−7.25(−7.25−1)(−7.25+1)×(−0.008) −7.25(−7.25−1)(−7.25+1)(−7.25−2)×(−0.003)
+ +
3! 4!

y = 17.1070 + 5.53755 + −1.67475 + 0.4984375 − 0.4322387

y = 21.0359988

You might also like