# Jacobi's method

This example shows how the non ended loops of iterative methods (because of non verified stopping criteria) can be avoided by using CADNA. The number of iterations is optimized for a same numerical quality of results.

This program solves a linear system of order 20 by using Jacobi's method.

The stopping criterion is

|| X(n+1) - X(n) || <= eps

where ||X|| is the maximum norm and eps=0.0001 . (for the matrix and the right hand-side, see the source code).

niter = 1000
 x_sol( 1) = 0.1700196E+01 (right value : 0.1700000E+01), residu( 1) = 0.3841369E-03 x_sol( 2) = -0.4746890E+04 (right value : -0.4746890E+04), residu( 2) = -0.2979056E-02 x_sol( 3) = 0.5023017E+02 (right value : 0.5023000E+02), residu( 3) = 0.8360886E-03 x_sol( 4) = -0.2453201E+03 (right value : -0.2453200E+03), residu( 4) = -0.1759439E-02 x_sol( 5) = 0.4778290E+04 (right value : 0.4778290E+04), residu( 5) = 0.9692840E-03 x_sol( 6) = -0.7572979E+02 (right value : -0.7573000E+02), residu( 6) = 0.1725890E-02 x_sol( 7) = 0.3495430E+04 (right value : 0.3495430E+04), residu( 7) = 0.4875915E-02 x_sol( 8) = 0.4350791E+01 (right value : 0.4350000E+01), residu( 8) = 0.4516218E-03 x_sol( 9) = 0.4529802E+03 (right value : 0.4529800E+03), residu( 9) = 0.1504409E-02 x_sol(10) = -0.2759527E+01 (right value : -0.2760000E+01), residu(10) = 0.2770665E-02 x_sol(11) = 0.8239240E+04 (right value : 0.8239240E+04), residu(11) = -0.2254617E-02 x_sol(12) = 0.3460363E+01 (right value : 0.3460000E+01), residu(12) = 0.1678284E-02 x_sol(13) = 0.1000000E+04 (right value : 0.1000000E+04), residu(13) = -0.2312908E-02 x_sol(14) = -0.5000558E+01 (right value : -0.5000000E+01), residu(14) = -0.2520537E-02 x_sol(15) = 0.3642399E+04 (right value : 0.3642400E+04), residu(15) = -0.1822454E-02 x_sol(16) = 0.7353602E+03 (right value : 0.7353600E+03), residu(16) = 0.2192364E-02 x_sol(17) = 0.1699791E+01 (right value : 0.1700000E+01), residu(17) = 0.5826736E-03 x_sol(18) = -0.2349170E+04 (right value : -0.2349170E+04), residu(18) = 0.1020119E-02 x_sol(19) = -0.8247519E+04 (right value : -0.8247520E+04), residu(19) = 0.2886578E-02 x_sol(20) = 0.9843569E+04 (right value : 0.9843570E+04), residu(20) = 0.3246601E-02

-----------------------------------------------------
CADNA software --- University P. et M. Curie --- LIP6
Self-validation detection: ON
Mathematical instabilities detection : ON
Branching instabilities detection : ON
Intrinsic instabilities detection : ON
Cancellation instabilities detection : ON
-----------------------------------------------------
niter = 30
 x_sol( 1) = 0.169E+01 (right value : 0.1700000E+01), residu( 1) = @.0 x_sol( 2) = -0.474689E+04 (right value : -0.4746890E+04), residu( 2) = @.0 x_sol( 3) = 0.50229E+02 (right value : 0.5023000E+02), residu( 3) = @.0 x_sol( 4) = -0.24532E+03 (right value : -0.2453200E+03), residu( 4) = @.0 x_sol( 5) = 0.477829E+04 (right value : 0.4778290E+04), residu( 5) = @.0 x_sol( 6) = -0.7573E+02 (right value : -0.7573000E+02), residu( 6) = @.0 x_sol( 7) = 0.349543E+04 (right value : 0.3495430E+04), residu( 7) = @.0 x_sol( 8) = 0.435E+01 (right value : 0.4350000E+01), residu( 8) = @.0 x_sol( 9) = 0.45298E+03 (right value : 0.4529801E+03), residu( 9) = @.0 x_sol(10) = -0.276E+01 (right value : -0.2760000E+01), residu(10) = @.0 x_sol(11) = 0.823924E+04 (right value : 0.8239240E+04), residu(11) = @.0 x_sol(12) = 0.346E+01 (right value : 0.3460000E+01), residu(12) = @.0 x_sol(13) = 0.999999E+04 (right value : 0.9999999E+03), residu(13) = @.0 x_sol(14) = -0.500E+01 (right value : -0.5000000E+01), residu(14) = @.0 x_sol(15) = 0.3642399E+04 (right value : 0.3642400E+04), residu(15) = @.0 x_sol(16) = 0.73536E+03 (right value : 0.7353601E+03), residu(16) = @.0 x_sol(17) = 0.170E+01 (right value : 0.1700000E+01), residu(17) = @.0 x_sol(18) = -0.234917E+04 (right value : -0.2349170E+04), residu(18) = @.0 x_sol(19) = -0.824752E+04 (right value : -0.8247519E+04), residu(19) = @.0 x_sol(20) = 0.984357E+04 (right value : 0.9843570E+04), residu(20) = @.0
-----------------------------------------------------
CADNA software --- University P. et M. Curie --- LIP6
There are 38 numerical instabilities
0 UNSTABLE DIVISION(S)
0 UNSTABLE POWER FUNCTION(S)
0 UNSTABLE MULTIPLICATION(S)
0 UNSTABLE BRANCHING(S)
0 UNSTABLE MATHEMATICAL FUNCTION(S)
0 UNSTABLE INTRINSIC FUNCTION(S)
38 UNSTABLE CANCELLATION(S)