Вы находитесь на странице: 1из 8

Q11. Determine the lowest real root of 𝑓(𝑥) = −12 − 21𝑥 + 18𝑥2-2.

4 𝑥3 using the Secant


method to a value of ℇS corresponding to three significant figures.

Solution:

Given function, 𝑓(𝑥) = −12 − 21𝑥 + 18𝑥2-2.4 𝑥3

f ( x i)( x i−1−x i)
Secant Formula, x i+1=x i−
f ( xi −1 ) −f ( xi )

Take two initial guesses,

Let, x 0=1and x 1=0

First iteration, i=1,

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

f ( x 0 ) =−12−21 ( 1 ) +18 (1 )2 −2.4 ( 1 )3=−17.400

f ( x 1 ) =−12−21 ( 0 ) +18 ( 0 )2−2.4 ( 0 )3=−12.000

(−12 )( 1−0 )
x 2=0−
(−17.4 )−(−12 )

x 2=−2.222

2 3
f ( x 2 ) =−12−21 (−2.222 ) +18 (−2.222 ) −2.4 (−2.222 ) =149.863

Second iteration, i=2

f ( x 2 )(x1 −x2 )
x 3=x 2−
f ( x 1 ) −f (x 2 )

( 149.863 ) ( 0−(−2.222 ) )
x 3=−2.222−
(−12 ) −( 149.863 )

x 3=−0.165

f ( x 3 ) =−12−21 (−0.165 ) +18 (−0.165 )2−2.4 (−0.165 )3=−8.042


Third iteration, i=3

f (x 3)( x 2−x 3 )
x 4 =x3 −
f ( x 2 )−f (x 3)

(−8.042 ) (−2.222−(−0.165 ) )
x 4 =−0.165−
( 149.863 )− (−8.042 )

x 4 =−0.269

By using spreadsheet, the result as below.

i Xi X(i-1) f(Xi) fX(i-1) x(i+1) Error


1 0.000 1.000 -12.000 -17.400 -2.222 1.000
2 -2.222 0.000 149.893 -12.000 -0.165 12.491
3 -0.165 -2.222 -8.042 149.893 -0.269 0.389
4 -0.269 -0.165 -4.987 -8.042 -0.440 0.388
5 -0.440 -0.269 0.948 -4.987 -0.413 0.066
6 -0.413 -0.440 -0.081 0.948 -0.415 0.005
7 -0.415 -0.413 -0.001 -0.081 -0.415 0.000
8 -0.415 -0.415 0.000 -0.001 -0.415 0.000
9 -0.415 -0.415 0.000 0.000 -0.415 0.000
10 -0.415 -0.415 0.000 0.000 -0.415 0.000

The lowest real root is -0.415 in the 6th iteration with ℇS=0.005 corresponding to three
significant figures.
d x1 d x2
Q13. Given =1999 x1 +2999 x 2 and =−2000 x 1−3000 x 2. If x 1 ( 0 )=x 2 ( 0 )=¿1, obtain
dt dt
a solution from t=0 to 0.2 using step size of 0.05 with the Euler methods.

x i+1=x i + f ( x i , t i ) h

Solution:

d x1
For the first differential equation of solution as below.
dt

Initial condition at x 1=1 ,t 1=0.05

f ( 1 , 0.05 )=1999 ( 1 ) +2999 ( 1 )=4998

Therefore, the approximate Xi at ti=0.05 is,

x 1=x 1+ f ( x 1 , t 1) h

x 1 (0.05)=x 1 (0)+ f ( 1 ,0.05 ) h

x 1 ( 0.05 )=1+ ( 4998 ) ( 0.05 )

¿ 250.9

The actual Xi at ti=0.05 is,

x 1=1999 x1 t 1 +2999 x 2 t 1+ 1

x 1=1999 ( 250.9 )( 0.05 )+ 2999 (−249 )( 0.05 ) +1

¿−12259.095

Hence, the error is

Et = Actual− Approximate=−12259.095−250.9=−12509.995
Besides, the relative error, εt= 1.020 or 102.047%

d x2
For the second differential equation of solution as below.
dt

Initial condition at x 2=1 ,t 1=0.05

f ( 1 , 0.05 )=−2000 ( 1 ) −3000 ( 1 ) =−5000

Therefore, the approximate Xi at ti=0.05 is,

x 2=x 2+ f ( x 2 , t 1 ) h

x 2 (0.05)=x 2 (0)+ f ( 1 ,0.05 ) h

x 2 ( 0.05 )=1+ (−5000 ) ( 0.05 )

¿−249

The actual Xi at ti=0.05 is,

x 2=−2000 x 1 t 1−3000 x2 t 1+1

x 2=−2000 ( 250.9 ) ( 0.05 )−3000 (−249 ) ( 0.05 ) +1

¿ 12261.000

Hence, the error is

Et = Actual− Approximate=12261−(−249)=12510

Besides, the relative error, εt=1.0203 or 102.03%


The whole calculation for every step size were put in excel by using formula given. Refer
table below.

d x1
First differential equation, =1999 x1 +2999 x 2
dt

Approximate Relative
i ti dx/dt Actual Xi Error, Et
Xi Error
0.0
0 1.000 4998.000 1.000 0.000 0.000
0
0.0
1 250.900 -245201.900 -12259.095 -12509.995 1.020
5
0.1
2 -12009.195 12014608.195 1201461.820 1213471.015 1.010
0
0.1 - - -
3 588721.215 1.007
5 588716072.215 88307409.832 88896131.047
-
0.2 28847087281.3 5769417457.2 5798264539.6
4 28847082.39 1.005
0 96 79 75
6

d x2
Second differential equation, =−2000 x 1−3000 x 2.
dt

Approximat Relative
i ti dx/dt Actual Xi Error, Et
e Xi Error
0.0
0 1.000 -5000.000 1.000 0.000 0.000
0
0.0
1 -249.000 245200.000 12261.000 12510.000 1.020
5
0.2
2 12011.000 -12014610.000 -2402921.000 -2414932.000 1.005
0
0.2 147179018.62 147767738.12
3 -588719.500 588716070.500 1.004
5 5 5
- - -
0.2 28847084.02
4 28847087283.0 5769417455.6 5798264539.6 1.005
0 5
25 05 30
Q15. Derive LU Decomposition for the matrix below and then, determine its matrix inverse.

3 −0.1 −0.2

[
[ A ] = 0.1 7 −0.3
0.3 −0.2 10 ]
Solution:

It follows the rules of matrix multiplication that

[ L ][ Y ] =[ X ]

[ U ] [ X ] =[ I ]

[ X ] is the identical matrix and [ I ] is the inverse matrix.

3 −0.1 −0.2

[
[ A ] = 0.1 7 −0.3
0.3 −0.2 10 ]
3 −0.1 −0.2

[
¿ 0 7
0.3 −0.2
−0.29
10 ]
3 −0.1 −0.2

[
¿ 0 7 −0.29
0 −0.19 10.02 ]
3 −0.1 −0.2

[
¿ 0
0
7
0
−0.29 =U
10.01 ]
1 0 0

[
¿ 0.03 1 0 =L
0.1 −0.03 1 ]
Inverse matrix:

0.333 0.005 0.007

[
[ A−1 ]= −0.005 0.143 0.004
−0.010 0.003 0.100 ]

Вам также может понравиться