summaryrefslogtreecommitdiff
path: root/260/CH5/EX5.6/5_6.sce
blob: 8d2b9167711ffbf63e6d5db4abc057ccae2fed20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//Eg-5.6
//pg-225

clear
clc

A=[1 2 4;3 1 2;4 2 5];
 z=[1;1;1];
for i=1:7
    printf('iteration number=%f\n',i);
    a=A*z;
    b=(sum(a.^2))^.5;
    printf('dominant eigen value=%f\n',b);
      z=a/b;
    printf('z=%f\n',z);
end

disp("from iterations dominant eigen value converged to ")
disp(b)
disp("after 7 iterations")
disp("its value is positive from equation 30");