Chapter:
1.
TITLE:
TO FIND THE LARGEST OR DOMINANT EIGEN VALUE AND CORRESPONDING EIGEN VECTOR USING POWER METHOD
OBJECTIVES:
To be able to follow the algorithm of power method of finding largest or dominant Eigen value and corresponding Eigen vector.
To build some programming concepts by solving practical problems.
TOOLS REQUIRED:
Computer workstation
Program software (as necessary)
THEORY:
In many real world applications of science and engineering, it is required to find numerically the largest or dominant Eigen value and corresponding Eigen vector. Power Method follows iterative approach and is quite convenient and well suited for implementing on computer.
Let A be the square matrix of order n i.e `A_(n**n)`Then Power Method starts with one initial approximation to Eigen vector corresponding to largest Eigen value of size n**1. Let this initial approximation be Xn x 1.
After initial assumption, we calculate AX i.e. product of matrix A and X. From the product of AX we divide each element by largest element (by magnitude) and express them as λ1X1. Obtained value of λ1 and X1 are next better approximated value of largest Eigen value and corresponding Eigen vector.
Similarly, for the next step, we multiply A by X1. From the product of AX1 we divide each element by largest element (by magnitude) and express them as λ2X2. Obtained value of λ2 and X2 are next better approximated value of largest Eigen value and corresponding Eigen vector.
And then we repeat this process until largest or dominant Eigen value and corresponding Eigen vector are obtained within desired accuracy.
ALGORITHM:
Start
Read Order of Matrix (n) and Tolerable Error (e)
Read Matrix A of Size n x n
Read Initial Guess Vector X of Size n x 1
Initialize: Lambda_Old = 1
Multiply: X_NEW = A * X
Replace X by X_NEW
Find Largest Element (Lamda_New) by Magnitude from X_NEW
Normalize or Divide X by Lamda_New
Display Lamda_New and
If |Lambda_Old - Lamda_New| > e then set Lambda_Old = Lamda_New and goto step (6) otherwise goto step (12).
Stop
C-PROGRAM:
//Power Method #include#include #include #define SIZE 10 void main() { float a[SIZE][SIZE], x[SIZE],x_new[SIZE]; float temp, lambda_new, lambda_old, error; int i,j,n, step=1; clrscr(); printf("Enter Order of Matrix: "); scanf("%d", &n); printf("Enter Tolerable Error: "); scanf("%f", &error); printf("Enter Coefficient of Matrix:\n"); for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { printf("a[%d][%d]=",i,j); scanf("%f", &a[i][j]); } } printf("Enter Initial Guess Vector:\n"); for(i=1;i<=n;i++) { printf("x[%d]=",i); scanf("%f", &x[i]); } lambda_old = 1; do{ for(i=1;i<=n;i++) { temp = 0.0; for(j=1;j<=n;j++) { temp = temp + a[i][j]*x[j]; } x_new[i] = temp; } for(i=1;i<=n;i++) { x[i] = x_new[i]; } lambda_new = fabs(x[1]); for(i=2;i<=n;i++) { if(fabs(x[i])>lambda_new) { lambda_new = fabs(x[i]);
} } /* Normalization */ for(i=1;i<=n;i++) { x[i] = x[i]/lambda_new; } /* Display */ printf("\n\nSTEP-%d:\n", step); printf("Eigen Value = %f\n", lambda_new); printf("Eigen Vector:\n"); for(i=1;i<=n;i++) { printf("%f\t", x[i]); } lambda_old=lambda_new; step++; } while(fabs(lambda_new-lambda_old)>error); getch(); }
CONCLUSION:
Thus the largest or dominant Eigen value and corresponding Eigen vector was found using powerethod by using C Programming language.
Guest