Created
November 3, 2014 17:10
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
After 3 runs of 100 check each, I'm going to go ahead and say that SymPy is cleared for duty
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
As per issues with Mathematica mentioned in
http://www.ams.org/notices/201410/rnoti-p1249.pdf