You are on page 1of 2

Jonathan P.

LaGrone Problem Statement (Determinant)

Final Project

Aero 220-500

Another matrix function is the determinant. This matrix function reduces a square matrix (nxn) down to a single number, when dealing with integers and decimals. The determinant provides important information when the matrix is that of the coefficients of a system of equation as well. One important rule about the determinant of a matrix is that it has to be square, meaning a nxn matrix, otherwise it cannot have a determinant.

Test Case Matrix 1= 1 5 9 5 2 6 8 4 3 7 7 3 4 8 6 2

Determinant of Matrix 1= 0

Algorithm 1) double Matrixclass::Determinant() //The function from the header file a. double deter=0 // defining what determinate is b. if (height==1) i. deter=matrix[0][0] c. else if (height==2) i. deter=(matrix[0][0]*matrix[1][1]) - (matrix[1][0]*matrix[0][1]) d. else{ i. deter=0 e. Matrixclass z(height-1, width-1) //matrixclass with z, must de-increment because the matrix must be reduced to a single term i. for (int p=0; p<width; p++) //for loops to be used in relation to equation of the determinant ii. for (int i=0; i<z.height; i++) 1. int H=0 iii. for (int j=0; j<width; j++) f. if (j==p){continue;} i. z.matrix[i][H]= matrix[i+1][j] 1. H++ g. deter+=pow(-1.0,1.0+p+1.0)*matrix[0][p]*z.Determinant() //the determinant formula h. return deter //returning the function deter

Jonathan P. LaGrone

Final Project

Aero 220-500

You might also like