diff --git a/linalg-practice.py b/linalg-practice.py index 9066aca..49f0a94 100644 --- a/linalg-practice.py +++ b/linalg-practice.py @@ -22,6 +22,12 @@ def multcheck(a, b, rowcol, intmax) : # return bool based on if input equals the two matrices multiplied together return (sp.Matrix(inmat(rowcol)) == a*b) +# detcheck function to check if the determinant of the matrix is correct +def detcheck(a, b, rowcol, intmax): + det = sp.det(a) + # return bool based on if input equals determinant + return (det == sp.nsimplify(input("What is the determinant of this matrix?: "))) + # practice function def practice(t) : count = 0 @@ -32,6 +38,8 @@ def practice(t) : # choose the function of the program that you want if t == "mult" : f = multcheck + elif t == "det" : + f = detcheck else : exit()