added invcheck feature

This commit is contained in:
Lukasz M 2022-03-24 18:43:36 +01:00
parent f1c93f2302
commit 3e1d95d470

View File

@ -28,6 +28,14 @@ def detcheck(a, b, rowcol, intmax):
# return bool based on if input equals determinant
return (det == sp.nsimplify(input("What is the determinant of this matrix?: ")))
# invcheck function to check if the inverse of the matrix is correct
def invcheck(a, b, rowcol, intmax):
det = a.det()
if det != 0 :
# return bool based on if input equals inverse of matrix
print("What is the inverse of this matrix?")
return (sp.Matrix(inmat(rowcol)) == a.inv())
# practice function
def practice(t) :
count = 0
@ -40,6 +48,8 @@ def practice(t) :
f = multcheck
elif t == "det" :
f = detcheck
elif t == "inv" :
f = invcheck
else :
exit()