Skip to content

Instantly share code, notes, and snippets.

@gforsyth
Created November 3, 2014 17:10
Show Gist options
  • Save gforsyth/ef8c60c74d4cba55a79f to your computer and use it in GitHub Desktop.
Save gforsyth/ef8c60c74d4cba55a79f to your computer and use it in GitHub Desktop.
Checking if SymPy has a bug when calculating determinant of very big integers
import sympy
for i in range(100):
basicMatrix = sympy.randMatrix(14,14,-99,99)
powersMatrix = sympy.diag(10**123, 10**152, 10**185, 10**220, 10**397, 10**449, 10**503, 10**563, 10**979, 10**1059, 10**1143, 10**1229, 10**1319, 10**1412)
smallMatrix = sympy.randMatrix(14,14,-999,999)
bigMatrix = basicMatrix*powersMatrix + smallMatrix
a = bigMatrix.det()
b = bigMatrix.det()
if a!=b:
print "uh oh"
break
else:
print "no worries for round {}".format(i)
@gforsyth
Copy link
Author

gforsyth commented Nov 3, 2014

After 3 runs of 100 check each, I'm going to go ahead and say that SymPy is cleared for duty

@labarba
Copy link

labarba commented Nov 3, 2014

We should write a blog post about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment