0% found this document useful (0 votes)
85 views

TR2103 Introduction To Numerical Methods Assignment 1-1 (Submit Before 30 October)

1. The document provides instructions for 6 numerical methods assignments involving solving equations and systems of equations. 2. Students are to use methods like false position, Newton's method, Gauss elimination, Gauss-Jordan, Jacobi iteration, and Gauss-Seidel iteration to find roots, inverses, and solutions. 3. The assignments involve finding intervals containing roots, iteratively approximating roots to 2 decimal places, solving systems of 3 equations with 3 unknowns, and obtaining solutions to systems of equations using iterative methods to 3 decimal places.

Uploaded by

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

TR2103 Introduction To Numerical Methods Assignment 1-1 (Submit Before 30 October)

1. The document provides instructions for 6 numerical methods assignments involving solving equations and systems of equations. 2. Students are to use methods like false position, Newton's method, Gauss elimination, Gauss-Jordan, Jacobi iteration, and Gauss-Seidel iteration to find roots, inverses, and solutions. 3. The assignments involve finding intervals containing roots, iteratively approximating roots to 2 decimal places, solving systems of 3 equations with 3 unknowns, and obtaining solutions to systems of equations using iterative methods to 3 decimal places.

Uploaded by

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

TR2103 Introduction to Numerical Methods

Assignment 1-1 (Submit before 30 october)

1 Determine an interval of length one unit in which the negative real root, which is

smallest in magnitude lies for the equation 9x3 + 18x2 – 37x – 70 = 0.

Answer:

f (−x )=−9 x3 +18 x 2−37 x−70=0

The number of changes in the sign of the coefficients (-9,18,-37,-70) is 1. Therefore the
equation has one positive root.
Since the smallest negative real root in the magnitude is required so a table of values is
form for x < 0.
x -5 -4 -3 -2 -1 0
F(x) -560 -210 -40 4 -24 -70

f(-1), f(-2) < 0 the negative root of smallest magnitude lies in the interval (-2,-1).

2 Find the root correct to two decimal places of the equation xex = cos x, using the method

of false position.

Answer:

f ( x )=cos x−x e x =0

f ( 0 )=cos (0)

f ( 0 )=1

f ( x )=cos x−x e x =0

f ( 1 ) =cos ( 1 )−1 e

f ( 1 ) =−1.718

The root in (0,1). So x 0=0∧x 1=1

False position method.

x0 f 1−x 1 f 0
x 2=
f 1−f 0
(0)(−1.718)−(1)(1)
x 2=
−1.718−1

x 2=0.3679

f ( x 2 ) =f ( 0.3679 )

f ( x 2 ) =cos x−x e x

f 2=0.46848

Since f ( 0.3679 ) , f ( 1 ) <0 ,the root lies in the internal (0.3679,1)

x2 f 1−x 1 f 2
x 3=
f 1−f 2

(0.3679)(−1.718)−(1)(0.46848)
x 3=
−1.718−0.46848

x 3=0.50335

f ( x 3 ) =f ( 0.50335 )

f ( x 3 ) =cos x−x e x

f 3=0.16729

Since f ( 0.50335 ) , f ( 1 ) <0 ,the root lies in the internal (0.50335,1)

x 3 f 1−x 1 f 3
x4 =
f 1−f 3

(0.50335)(−1.718)−(1)(0.16729)
x4 =
−1.718−0.16729

x 4 =0.54742

f ( x 4 )=f ( 0.54742 )

f ( x 4 )=cos x −x e x

f 4=0.05358

Since f ( 0.54742 ) , f ( 1 ) <0 ,the root lies in the internal (0.54742,1)

x 4 f 1−x 1 f 4
x 5=
f 1−f 4
(0.54742)(−1.718)−(1)(0.05358)
x 5=
−1.718−0.05358

x 5=0.561108

f ( x 5 ) =f ( 0.561108 )

f ( x 5 ) =cos x−x e x

f 5=0.01655

Since f ( 0.561108 ) , f ( 1 )< 0 ,the root lies in the internal (0.561108,1)

x 5 f 1−x 1 f 5
x 6=
f 1−f 5

(0.561108 )(−1.718)−(1)(0.01655)
x 6=
−1.718−0.01655

x 6=0.56529

f ( x 6 ) =f ( 0.56529 )

f ( x 6 ) =cos x−x e x

f 6=0.005048

Since f ( 0.56529 ) , f ( 1 ) <0 ,the root lies in the internal (0.56529,1)

x 6 f 1−x 1 f 6
x 7=
f 1−f 6

(0.56529)(−1.718)−(1)( 0.005048)
x 7=
−1.718−0.005048

x 7=0.56657

|x 7−x 6|=0.56657−0.56529=0.00128
So, x ≈ x 7=0.56657 .
3 Perform four iterations of the Newton’s method to find the smallest positive root of the

equation f(x) = x3 – 5x + 1 = 0.

Answer:

f ( x )=x 3−5 x +1
f ' ( x )=3 x 2−5

x 0=0

f ( 0 )=( 0)3 −5 ( 0 ) +1=1

f ' ( 0 ) =3(0)2−5=−5

1
Newton Raphson first iteration method x 1=0 — =0.2
5

x 1=0.2

|x 1−x 0|=0.2−0=0.2>1e-4
k = 1 for iteration 2 is

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

x 2=0.2−¿ ¿

|x 2−x 1|=0.20164−0.2=0.0016>1e-4
k = 2 for iteration 3 is

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

x 2=0.20164−¿ ¿

Therefore the smallest root is x = 0.20164


4 Solve the system of equations

3x1 + 3x2 + 4x3 = 20

2x1 + x2 + 3x3 = 13

x1 + x2 + 3x3 = 6

using the Gauss elimination method.

Answer:

3 3 4 20

[ ][ ]
3 1 3 13
1 1 3 6
R 1 ↔ R3

1 1 3 6
[ ][ ]
3 1 3 13
3 3 4 20

R1
R 2− ( )
5

1 1 3 6
[ 1.8 0.8 2.4 11.8
3 3 4 20 ][ ]
R 3− ( 10R )
1

1 1 3 6
[ 1.8 0.8 2.4 11.8
2.9 2.9 3.7 19.4 ][ ]
R2 ↔ R3

1 1 3 6
[ 2.9 2.9 3.7 19.4
1.8 0.8 2.4 11.8 ][ ]
3.2
R 3− ( 10.1 )R 2

1 1 3 6
[ 2.9 2.9 3.7 19.4
0 0 1 5.7 ][ ]
5.7
x 3= =5.7
1

19.4−1(5.7)
x 2= =4.724
2.9

x 1=6−1 ( 4.724 ) −3 (5.7 )=−15.824


5 Using the Gauss-Jordan method, find the inverse of

 2 2 3
 2 1 1
 
 1 3 5
Answer:

2 2 3

[ ] 2 1 1 ¿
1 3 5

R1 /2

1 1 3/2

[ 2 1 1 ¿
1 3 5 ]
R2−2 R1 , R 3−R1

1 1 3/2

[ 0 −1 −2 ¿
0 2 7/2 ]
R2 ↔ R3

1 1 3/2

[ 0 2 7/2 ¿
0 −1 −2 ]
R2 / ( 2 )

1 1 3 /2

[ 0 1 7/ 4 ¿
0 −1 −2 ]
R1−R 2 , R3 + R2

1 0 −1/ 4

[ 0 1 7 /4 ¿
0 0 −1/ 4 ]
R3 /(−1/4)

1 0 −1/ 4

[ 0 1 7 /4 ¿
0 0 1 ]
R1 +(1 /4)R 3 , R2−(7 /4) R 3

1 0 0

[ ] 0 1 0 ¿
0 0 1
Therefore the inverse of the matrix is

2 −1 −1

[
−9 7
5 −4 −2
4
]
6 Solve the system of equations

26x1 + 2x2 + 2x3 = 12.6

3x1 + 27x2 + x3 = – 14.3

2x1 + 3x2 + 17x3 = 6.0

using the Jacobi and Gauss-Seidel iteration method. Obtain the result correct to three

decimal places.

1. Jacobi Method

1
x(k1 +1)= (12.6−(2 x(k) (k)
2 +2 x3 ))
26

1
x(k2 +1)= (−14.3−(3 x(k) (k )
1 + x 3 ))
27

1
x(k3 +1)= (6.0−(2 x(k) (k)
1 +3 x 2 ))
17

x(0) (0) (0)


1 =0 , x2 =0 , x 3 =0

First Iteration:

1
x(1)
1 = (12.6−(2( 0)+ 2(0)))=0.48 5
26

1
x(1)
2 = (−14.3−(3 (0)+(0)))=−0.52 0
27

1
x (31) = ( 6.0−( 2 ( 0 ) +3 ( 0 ) ) ) =0.353
17

Second Iteration:

1
x(2)
1 = (12.6−(2(−0.52 0)+2( 0.353)))=0 .498
26
1
x(2)
2 = (−14.3−(3 (0.48 5)+(0 .353)))=−0.5 9 7
27

1
x (32 )= ( 6.0−( 2 ( 0.485 )+ 3 (−0.520 ) ) )=0.38 8
17

Third Iteration:

1
x(3)
1 = (12.6−(2(−0.59 7)+ 2(0.38 8)))=0.50 1
26

1
x(3)
2 = (−14.3−(3(0.49 8)+(0.3 88)))=−0.5 99
27

1
x (33 )= ( 6.0−( 2 ( 0.498 ) +3 (−0.59 7 ) ) ) =0 .399
17

Fourth Iteration:

1
x(41 )= (12.6−(2(−0.599)+2(0.399)))=0.5 00
26

1
x(42 )= (−14.3−(3(0.50 1)+(0 .399)))=−0.600
27

1
x (34 )= ( 6.0−( 2 ( 0 .50 1 ) +3 (−0.599 ) ) ) =0.3 99
17

Fifth Iteration:

1
x(5)
1 = (12.6−( 2(−0. 600)+2(0.3 99)))=0.500
26

1
x(5)
2 = (−14.3−( 3(0.500)+(0.399)))=¿-0.600
27

1
x (35 )= ( 6.0−( 2 ( 0.500 ) +3 (−0. 600 ) ) )=¿0.400
17

So I get x 1=0.5 , x 2=−0.6 , x3 =0.4

2. Gauss Seidel Method

1
x(k1 +1)= (12.6−(2 x(k) (k)
2 +2 x3 ))
26

1
x(k2 +1)= (−14.3−(3 x(k+1 )
1 + x (k)
3 ))
27
1
x(k3 +1)= (6.0−(2 x(k+1)
1 +3 x(k2 +1)))
17

x(0) (0) (0)


1 =0 , x2 =0 , x 3 =0

First Iteration:

1
x(1)
1 = (12.6−(2( 0)+ 2(0)))=0.485
26

1
x(1)
2 = (−14.3−(3 (0.485)+(0)))=−0.5 84
27

1
x (31) = ( 6.0−( 2 ( 0.485 )+ 3 (−0.584 ) ) ) =0. 399
17

Second Iteration:

1
x(1)
1 = (12.6−(2(−0.584)+2(0.399)))=0.499
26

1
x(1)
2 = (−14.3−(3 (0.499)+(0.399)))=−0.615
27

1
x (31) = ( 6.0−( 2 ( 0.499 )+ 3 (−0.615 ) ) ) =0 .403
17

Third Iteration:

1
x(1)
1 = (12.6−(2(−0.615)+ 2(0.403)))=0 .501
26

1
x(1)
2 = (−14.3−(3 (0.501)+(0 .403)))=−0. 600
27

1
x (31) = ( 6.0−( 2 ( 0.501 ) +3 (−0.600 ) ) )=0 .399
17

Fourth Iteration:

1
x(1)
1 = (12.6−(2(−0.600)+ 2(0 .399)))=0. 500
26

1
x(1)
2 = (−14.3−(3 (0.500)+(0.399)))=−0.599
27

1
x (31) = ( 6.0−( 2 ( 0.500 ) +3 (−0.599 ) ) ) =0.399
17

Fifth Iteration:
1
x(1)
1 = (12.6−(2(−0.599)+ 2(0 .399)))=0.500
26

1
x(1)
2 = (−14.3−(3 (0 .500)+(0 .399)))=−0. 599
27

1
x (31) = ( 6.0−( 2 ( 0.500 )+ 3 (−0.599 ) ) )=0.39 9
17

So I get x 1=0.5 , x 2=−0.6 , x3 =0.4

You might also like