diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /75/CH8/EX8.10 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '75/CH8/EX8.10')
-rwxr-xr-x | 75/CH8/EX8.10/ex_10.sce | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/75/CH8/EX8.10/ex_10.sce b/75/CH8/EX8.10/ex_10.sce new file mode 100755 index 000000000..e360f6d20 --- /dev/null +++ b/75/CH8/EX8.10/ex_10.sce @@ -0,0 +1,29 @@ + // EXAMPLE (PG 547) + + // Gauss Jacobi Method + +A = [10 3 1;2 -10 3;1 3 10] // Coefficient Matrix +b = [14 -5 14]' // Right hand matrix + +x = [0 0 0]' // Initial Gauss +d = diag(A) // Diagonal elements of matrix A +a11 = d(1,1) +a22 = d(2,1) +a33 = d(3,1) +D = [a11 0 0;0 a22 0;0 0 a33] // Diagonal matrix of A +[L,U] = lu(A) // L is lower triangular matrix, U is upper triangular matrix +H = -inv(D)*(L+U) +C = inv(D)*b + +for(m=0:6) // Initialising 'for' loop for setting no of iterations to 6 + x = H*x+C; + disp(x) + m=m+1; + x; // Solution + // Rounding off to 4 decimal places + x = x*10^4; + x = int(x); + x = x*10^(-4); + disp(x) // Final Solution + +end
\ No newline at end of file |