Skip to content

This script can calculate a determiniant of nxn matrix given dimension n. This calculation is done using all possible permutations of array (1,2...,n)

License

Notifications You must be signed in to change notification settings

ttcpavle/Determinant-calculator-with-permutations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Determinant-calculator-with-permutations

Determinant

Determinant is a function that takes matrix and returns a real number. Geometrically speaking, it is a measure that shows us by which factor a vector space is warped with given matrix transformation. It quantifies how much the hyper-volume of multidimensional space has changed under the transformation.

Script description

This script can calculate a determiniant of nxn matrix given dimension n. This calculation is done using all possible permutations of array (1,2...,n). This is the definition:

Screenshot 2024-03-22 212829

This algorithm is very inefficient since number of permutations is very huge and is calculated recursivly but it shows a very interesing property of a determinant. Much faster way to calculate det would be using the Gaussian elimination method, which has the time complexity O(n^3). This algorithm has time complexity of O(n!) making it faster for smaller matrix, to be precise, it should be faster for matrix up to size of 5 since 5!<5^3. Recursion algorithm used for permutations in the script is not the most efficient one, the point was only to show interesting way of calculating determinant.

x! and x^3 graphs

blue: x! (permutations)

red: x^3 (gaussian elimination)

If implemented correctly, calculating smaller matrix determinant with this algorithm should be faster, as you can see in the graph. There is always room for improvement. Thank you for reading.

About

This script can calculate a determiniant of nxn matrix given dimension n. This calculation is done using all possible permutations of array (1,2...,n)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages