Sie sind auf Seite 1von 8

Example 1.

Use Cramers rule to solve

10 + +4 = 1
2 7 = 3

2 + +5 =0

The determinant | | can be written as

10 1 4
| |= 1 2 7
2 1 5

Evaluate the determinant of A:

2 7 1 7 1 2
det[ ] = 10(1) + (1) + 4(1) = 29
1 5 2 5 2 1

| |
Applying = | |
obtain the solution:

1 1 4
3 2 7
= 0 1 5 = 0
29

10 1 4
1 3 7
= 2 0 5 = 5
29

10 1 1
1 2 3
= 2 1 0 = 1
29

Example 2. Let

2 1 0 1
= 1 6 2 , = 3
4 3 8 9

Carry out a number of iterations of the Jacobi iteration, starting with the zero initial vector.
Rewriting the equations, we have the Jacobi method:

( ) 1 ( ) 1
= +
2 2

( ) 1 ( ) 1 ( ) 1
= + +
6 3 2

( ) 1 ( ) 3 ( ) 9
= + +
2 8 8

Taking the initial vector to be = [0 0 0] , iterate the solution


k
0 0 0 0
1 0.5 0.5 0.5
2 0.75 0.9583 1.0625
3 0.9792 0.9792 1.1094
4 0.9896 1.033 1.0026
5 1.0165 0.9991 1.0176

1 1 1

Example 3. Solve the following system of equations using Jacobi method

4 8 + = 21

4 + =7
2 + + 5 = 15
To meet the convergence condition

| |> , = 1,

re-arrange the rows I and II of the system

4 + =7

4 8 + = 21
2 + + 5 = 15
( )
1 ( )
1 ( )
7
= +
4 4 4

( )
1 ( )
1 ( )
21
= + +
2 8 8

( )
2 ( )
1 ( )
= +3
5 5

Guess = [1 1 1] and start iterations

k
0 1 1 1
1 1.75 3.25 3.2
2 1.7625 3.9 3.05
3 1.9625 3.8875 2.925
4 1.9906 3.9719 3.0075
5 1.9911 3.9962 3.0019

2 4 3

Example 4. The following system of equations is designed to determine concentrations (the cs


in g/m3) in a series of coupled reactors as a function of amount of mass input to each reactor (the
right-hand sides in g/d),

17 2 3 = 500

5 + 21 2 = 200

5 5 + 22 = 30

Solve this problem with the Gauss-Seidel method to = 5% .

Consider the vector c=(0 0 0) as initial and use it to recomputed each element of c, always using
the latest available values of vector components.

( ) 2 ( ) 3 ( ) 500
= + +
17 17 17
( ) 5 ( ) 2 ( ) 200
= + +
21 21 21

( ) 5 ( ) 5 ( ) 30
= + +
22 22 22

Iterations give us

k
0 0 0 0
1 29.4118 16.5266 11.8042
2 33.4392 18.6097 13.1929
3 33.9293 18.8587 13.3609

Estimate the errors for components of solution:

( ) ( )

= ( )
100% <

33.9293 33.4392
= 100% = 1.4%
33.9293

= 0.16%; = 0.15% - convergence criteria are satisfied

Example 5. Use the Gauss-Seidel iterative technique to find approximate solutions to

10 +2 =6

+ 11 +3 = 25

2 + 10 = 11

3 +8 = 15
Starting with the zero initial vector ( = 5%).

The iterations can be implemented as

( ) 1 ( ) 1 ( ) 3
= +
10 5 5

( ) 1 ( ) 1 ( ) 3 ( ) 25
= + +
11 11 11 11
( ) 1 ( ) 1 ( ) 1 ( ) 11
= + +
5 10 10 10

( ) 3 ( ) 1 ( ) 15
= + +
8 8 8

Present the results in table

( ) ( ) ( ) ( )
k
1 0.6 2.3273 -0.9873 0.8789
2 1.030 2.037 -1.014 0.984
3 1.0065 2.0036 -1.0025 0.9983
= 2.3% = 1.7% = 1.1% = 1.4%

1.0065
After 3 iterations the maximum error is 2.3% and we obtain the result = 2.0036
1.0025
0.9983

Example 6. Of the following three sets of linear equations, identify the set that you could not
solve using an iterative method such as Gauss-Seidel. Show using any number of iterations that
is necessary that your solution does not converge. Clearly state your convergence criteria (how
you know it is not converging).

Set One Set Two Set Three


8 + 3 + = 12 +4 +5 = 8 + +5 = 7
6 + 7 = 1 2 + 2 3 = 3 +4 =4
2 +4 = 5 2 =1 3 + =3

If rearrange rows of the Set 1 and 3 and make them diagonally dominant they will converge

Set One Set Three


8 + 3 + = 12 3 + =3
2 +4 = 5 +4 =4
6 + 7 = 1 + +5 = 7
For the Set 3 convergence condition

| |> , = 1,

is not satisfied.

Using the Gauss-Seidel method show that the solution does not converge

2 + 2 3 = 3
2 = 1

+4 +5 = 8
The results of iterations are shown in Table

k x y z
0 0 0 0
1 1.5 0.5 1.5
2 -0.25 1.25 0.55
3 1.925 0.775 1.365
4 0.2275 1.1825 0.6995
5 1.6333 0.8498 1.2468

As we can see iterations oscillate about the true solution x=(1 1 1)T.

Example 7. Solve the problem using the SOR iteration with relaxation factor = 0.90 and
= 5%.

5 + 12 = 80

4 = 2

6 +8 = 45
After reordering rows obtain:

4 = 2
6 +8 = 45

5 + 12 = 80
Initially guessing = = = 0 apply relaxation to results

( ) ( ) ( ) ( )
= + + (1 )

( )

( ) 3 ( ) 45 ( )
= + + (1 )
4 8

( ) 5 ( ) 20 ( )
= + + (1 )
12 3

k
0 0 0 0
1 -0.45 5.3663 5.8313
2 2.0245 4.2326 7.3423
3 2.3568 3.8949 7.6180
4 2.3761 3.8481 7.6528

0.8% 1.2% 0.5%

Example 8. Solve the non-convergent system from Ex.6 using relaxation ( = 0.5)

2 + 2 3 = 3

2 = 1

+4 +5 = 8
The results of computations are summarized in Table

k x y z
0 0 0 0
1 0.75 0.25 0.775
2 0.6688 0.5688 1.0269

6 0.8561 0.9826 0.9955
7 0.9228 0.9902 0.9939
= 7.3% = 0.8% = 0.2%
From solution we can be verified that under-relaxation (0 < < 1) makes a non-convergent
system converge.

Das könnte Ihnen auch gefallen