Advertisement
Flaxy

Untitled

Dec 8th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. double deter(double A[6][6], int n)
  2. {
  3. double b[6][6],d = 0;
  4. int k = 1;
  5. if(n==1) d = A[1][1];
  6. else if(n==2) d = A[1][1]*A[2][2]-A[1][2]*A[2][1];
  7. else if(n==3) d = A[1][1]*A[2][2]*A[3][3]+A[2][1]*A[3][2]*A[1][3]+A[1][2]*A[2][3]*A[3][1]-A[3][1]*A[2][2]*A[1][3]-A[2][1]*A[1][2]*A[3][3]-A[1][1]*A[2][3]*A[3][2];
  8. else {
  9. for(int g = 1; g<=n;g++){
  10. for(int i = 2; i<=n; i++){
  11. for(int j = 1; j<=n-1;j++){
  12. if(k==j) continue;
  13. else{
  14. b[i][j] = A[i][j];
  15.  
  16. }
  17. }
  18. }
  19. d += pow(-1,k-1)*A[1][g]*deter(b,n-1);
  20. k++;
  21. }
  22. }
  23. return d;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement