From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 1332/CH11/EX11.4/11_4.sce | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 1332/CH11/EX11.4/11_4.sce (limited to '1332/CH11/EX11.4/11_4.sce') diff --git a/1332/CH11/EX11.4/11_4.sce b/1332/CH11/EX11.4/11_4.sce new file mode 100755 index 000000000..6e787e59a --- /dev/null +++ b/1332/CH11/EX11.4/11_4.sce @@ -0,0 +1,19 @@ +//Example 11.4 +//Power Method +//Page no. 345 +clc;close;clear; + +A=[1,2;3,4]; +e=0.001; +q0=[1;1]; +for i=1:5 + q1=A*q0; + a=max(q1) + for j=1:2 + q2(j)=q1(j)/a; + end + printf('\nq(%i) = %.4f a = %.4f Scaled q(%i) = %.4f\n %.4f %i\n\n',i,q1(1),a,i,q2(1),q1(2),q2(2)) + q1=q2; + q0=q1; +end +printf('Hence the largest eigenvalue is %.4f with the corresponding eigenvector as %.4f\n %i',a,q0(1),q0(2)) \ No newline at end of file -- cgit