- #1
jinro
- 4
- 0
Homework Statement
well, my assignment was to make a gauss elimination, so now i need to compute the determinant of an n by n diagonal matrix
variable rows = number of equations
variable i = random integer
matrix A[100][100]
dummy matrix A2[100][100]
Homework Equations
det[A] = A[0][0]*A[1][1]*A[2][2]*...*A[n][n]
The Attempt at a Solution
i made the code for pivoting and forward elimination, but i spent 2 hours or so and i couldn't figure out how to make a code for this using for loop
for (i=0;i<rows;i++){
A2 = A*A[i+1][i+1]
}
(this will only ever give me a product of 2 numbers in the diagonal though)
i thought it was going to be easy but i need to find a formula so it stores the products of all the elements in the diagonal of the matrix
PS; there is only so much attempts i can show, since i have no clue whatsoever to go about this.
@borek
thanks a lot i got the answer u helped a lot, i also realized my back elimination formula was wrong and your method helped me a lot once again
Last edited: