added detcheck feature

This commit is contained in:
Lukasz M 2022-03-24 18:42:52 +01:00
parent 4210f632d7
commit f1c93f2302

View File

@ -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()