Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Semrush - keyword research tool

Linux Foundation Training and Certification

Teach Your Child To Read

Disclosure: My content contains affiliate links.

32,304 questions

42,479 answers

573 users

How to calculate the determinant of a 3X3 matrix in Dart

1 Answer

0 votes
/* 
 *       a b c
 * arr = d e f
 *       g h i
 * 
 * determinant = a*(e*i - f*h) - b*(d*i-f*g) + c*(d*h - e*g)
 * 
 */

void main() {
    List<List<int>> matrix = [[6, 1, 1], [4, -2, 5], [2, 8, 7]];
    
    var determinant = 
            matrix[0][0] * (matrix[1][1] * matrix[2][2] - matrix[1][2] * matrix[2][1]) - 
            matrix[0][1] * (matrix[1][0] * matrix[2][2] - matrix[1][2] * matrix[2][0]) + 
            matrix[0][2] * (matrix[1][0] * matrix[2][1] - matrix[1][1] * matrix[2][0]);
    
    print(determinant);
}




/*
run:
    
-306 
      
*/

 



Learn & Practice Python
with the most comprehensive set of 13 hands-on online Python courses
Start now


answered May 21, 2023 by avibootz

Related questions

1 answer 8 views
1 answer 5 views
1 answer 9 views
1 answer 59 views
...