added invcheck feature
This commit is contained in:
parent
f1c93f2302
commit
3e1d95d470
@ -28,6 +28,14 @@ def detcheck(a, b, rowcol, intmax):
|
|||||||
# return bool based on if input equals determinant
|
# return bool based on if input equals determinant
|
||||||
return (det == sp.nsimplify(input("What is the determinant of this matrix?: ")))
|
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
|
# practice function
|
||||||
def practice(t) :
|
def practice(t) :
|
||||||
count = 0
|
count = 0
|
||||||
@ -40,6 +48,8 @@ def practice(t) :
|
|||||||
f = multcheck
|
f = multcheck
|
||||||
elif t == "det" :
|
elif t == "det" :
|
||||||
f = detcheck
|
f = detcheck
|
||||||
|
elif t == "inv" :
|
||||||
|
f = invcheck
|
||||||
else :
|
else :
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user