|
The following function is an implementation of a naive algorithm proposed by J. Achter.
It is designed to calculate the rank of an elliptic curve of the form $y^2=x^3+ax^2+bx$.
|
Let's run a test with the curve $y^2=x^3+x^2+x$.
0 0 |
25 loops, best of 3: 14.3 ms per loop 25 loops, best of 3: 14.3 ms per loop |
0 0 |
So, we obtained the correct rank in this case.
Now, let's try a curve with a higher rank, say $y^2=x^3+x^2+3x$.
625 loops, best of 3: 4.45 µs per loop 625 loops, best of 3: 4.45 µs per loop |
So, we obtain the correct rank in this case.
Now, let's try a curve with a higher rank, say $y^2=x^3+x^2+2x$.
1 1 |
This took somewhere around 20 minutes to complete.
1 1 |
At least we got the right answer.
625 loops, best of 3: 4.47 µs per loop 625 loops, best of 3: 4.47 µs per loop |
Why is this so fast?
There are efficient ways of computing lower and upper bounds, and when they match, SAGE returns this as the rank.
Upper Bound: 1 Lower Bound: 1 Upper Bound: 1 Lower Bound: 1 |
Now, lets compare some of the algorithms that SAGE has built in to compute the rank.
RANK 0
|
*** Warning: new stack size = 1001568 (0.955 Mbytes). *** Warning: new stack size = 1001568 (0.955 Mbytes). *** Warning: new stack size = 1001568 (0.955 Mbytes). 1 loops, best of 3: 18.7 ms per loop *** Warning: new stack size = 1001568 (0.955 Mbytes). *** Warning: new stack size = 1001568 (0.955 Mbytes). *** Warning: new stack size = 1001568 (0.955 Mbytes). 1 loops, best of 3: 18.7 ms per loop |
1 loops, best of 3: 34.2 ms per loop 1 loops, best of 3: 34.2 ms per loop |
1 loops, best of 3: 274 µs per loop 1 loops, best of 3: 274 µs per loop |
625 loops, best of 3: 4.15 µs per loop 625 loops, best of 3: 4.15 µs per loop |
RANK 1
|
*** Warning: new stack size = 1002672 (0.956 Mbytes). *** Warning: new stack size = 1002672 (0.956 Mbytes). *** Warning: new stack size = 1002672 (0.956 Mbytes). 1 loops, best of 3: 19.5 ms per loop *** Warning: new stack size = 1002672 (0.956 Mbytes). *** Warning: new stack size = 1002672 (0.956 Mbytes). *** Warning: new stack size = 1002672 (0.956 Mbytes). 1 loops, best of 3: 19.5 ms per loop |
1 loops, best of 3: 34.2 ms per loop 1 loops, best of 3: 34.2 ms per loop |
1 loops, best of 3: 2.59 ms per loop 1 loops, best of 3: 2.59 ms per loop |
625 loops, best of 3: 4.17 µs per loop 625 loops, best of 3: 4.17 µs per loop |
RANK 2
|
*** Warning: new stack size = 1003360 (0.957 Mbytes). *** Warning: new stack size = 1003360 (0.957 Mbytes). *** Warning: new stack size = 1003360 (0.957 Mbytes). 1 loops, best of 3: 21.3 ms per loop *** Warning: new stack size = 1003360 (0.957 Mbytes). *** Warning: new stack size = 1003360 (0.957 Mbytes). *** Warning: new stack size = 1003360 (0.957 Mbytes). 1 loops, best of 3: 21.3 ms per loop |
1 loops, best of 3: 42.3 ms per loop 1 loops, best of 3: 42.3 ms per loop |
1 loops, best of 3: 6.5 ms per loop 1 loops, best of 3: 6.5 ms per loop |
1 loops, best of 3: 9.06 µs per loop 1 loops, best of 3: 9.06 µs per loop |
RANK 3
|
*** Warning: new stack size = 1010496 (0.964 Mbytes). *** Warning: new stack size = 1010496 (0.964 Mbytes). *** Warning: new stack size = 1010496 (0.964 Mbytes). 1 loops, best of 3: 24.3 ms per loop *** Warning: new stack size = 1010496 (0.964 Mbytes). *** Warning: new stack size = 1010496 (0.964 Mbytes). *** Warning: new stack size = 1010496 (0.964 Mbytes). 1 loops, best of 3: 24.3 ms per loop |
1 loops, best of 3: 40.5 ms per loop 1 loops, best of 3: 40.5 ms per loop |
1 loops, best of 3: 23.6 ms per loop 1 loops, best of 3: 23.6 ms per loop |
1 loops, best of 3: 9.06 µs per loop 1 loops, best of 3: 9.06 µs per loop |
RANK 4
|
*** Warning: new stack size = 1067712 (1.018 Mbytes). *** Warning: new stack size = 1067712 (1.018 Mbytes). *** Warning: new stack size = 1067712 (1.018 Mbytes). 1 loops, best of 3: 57.3 ms per loop *** Warning: new stack size = 1067712 (1.018 Mbytes). *** Warning: new stack size = 1067712 (1.018 Mbytes). *** Warning: new stack size = 1067712 (1.018 Mbytes). 1 loops, best of 3: 57.3 ms per loop |
1 loops, best of 3: 47.1 ms per loop 1 loops, best of 3: 47.1 ms per loop |
1 loops, best of 3: 171 ms per loop 1 loops, best of 3: 171 ms per loop |
1 loops, best of 3: 7.87 µs per loop 1 loops, best of 3: 7.87 µs per loop |
RANK 5
|
*** Warning: new stack size = 1786816 (1.704 Mbytes). *** Warning: new stack size = 1786816 (1.704 Mbytes). *** Warning: new stack size = 1786816 (1.704 Mbytes). 1 loops, best of 3: 561 ms per loop *** Warning: new stack size = 1786816 (1.704 Mbytes). *** Warning: new stack size = 1786816 (1.704 Mbytes). *** Warning: new stack size = 1786816 (1.704 Mbytes). 1 loops, best of 3: 561 ms per loop |
/usr/local/sage/local/bin/sympow: line 3: 46927 Segmentation fault (core dumped) ./sympow $* Traceback (click to the left of this block for traceback) ... RuntimeError: failed to compute analytic rank /usr/local/sage/local/bin/sympow: line 3: 46927 Segmentation fault (core dumped) ./sympow $* Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_60.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("dGltZWl0KCJFLmFuYWx5dGljX3JhbmsoYWxnb3JpdGhtPSdzeW1wb3cnKSIsbnVtYmVyPTEp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/tmp/tmpXrbeP9/___code___.py", line 3, in <module> exec compile(u'timeit("E.analytic_rank(algorithm=\'sympow\')",number=_sage_const_1 ) File "", line 1, in <module> File "sage_timeit_class.pyx", line 82, in sage.misc.sage_timeit_class.SageTimeit.__call__ (sage/misc/sage_timeit_class.c:744) File "sage_timeit_class.pyx", line 59, in sage.misc.sage_timeit_class.SageTimeit.eval (sage/misc/sage_timeit_class.c:605) File "/usr/local/sage/local/lib/python2.6/site-packages/sage/misc/sage_timeit.py", line 184, in sage_timeit best = min(timer.repeat(repeat, number)) / number File "/usr/local/sage/local/lib/python/timeit.py", line 220, in repeat t = self.timeit(number) File "/usr/local/sage/local/lib/python/timeit.py", line 193, in timeit timing = self.inner(it, self.timer) File "<magic-timeit>", line 6, in inner File "/usr/local/sage/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_rational_field.py", line 1373, in analytic_rank return sympow.analytic_rank(self)[0] File "/usr/local/sage/local/lib/python2.6/site-packages/sage/lfunctions/sympow.py", line 287, in analytic_rank raise RuntimeError, "failed to compute analytic rank" RuntimeError: failed to compute analytic rank |
1 loops, best of 3: 1.77 s per loop 1 loops, best of 3: 1.77 s per loop |
1 loops, best of 3: 9.06 µs per loop 1 loops, best of 3: 9.06 µs per loop |
RANK 6
|
*** Warning: new stack size = 13975616 (13.328 Mbytes). *** Warning: new stack size = 13975616 (13.328 Mbytes). *** Warning: new stack size = 13975616 (13.328 Mbytes). 1 loops, best of 3: 9.03 s per loop *** Warning: new stack size = 13975616 (13.328 Mbytes). *** Warning: new stack size = 13975616 (13.328 Mbytes). *** Warning: new stack size = 13975616 (13.328 Mbytes). 1 loops, best of 3: 9.03 s per loop |
1 loops, best of 3: 35.1 s per loop 1 loops, best of 3: 35.1 s per loop |
1 loops, best of 3: 8.82 µs per loop 1 loops, best of 3: 8.82 µs per loop |
RANK 7
|
*** Warning: new stack size = 112433152 (107.225 Mbytes). *** Warning: new stack size = 112433152 (107.225 Mbytes). *** Warning: new stack size = 112433152 (107.225 Mbytes). 1 loops, best of 3: 57.2 s per loop *** Warning: new stack size = 112433152 (107.225 Mbytes). *** Warning: new stack size = 112433152 (107.225 Mbytes). *** Warning: new stack size = 112433152 (107.225 Mbytes). 1 loops, best of 3: 57.2 s per loop |
1 loops, best of 3: 186 s per loop 1 loops, best of 3: 186 s per loop |
1 loops, best of 3: 11 µs per loop 1 loops, best of 3: 11 µs per loop |
RANK 8
|
*** Warning: not enough memory, new stack 18446744073268923520. *** Warning: not enough memory, new stack 9223372036634461760. *** Warning: not enough memory, new stack 4611686018317230880. *** Warning: not enough memory, new stack 2305843009158615440. *** Warning: not enough memory, new stack 1152921504579307720. *** Warning: not enough memory, new stack 576460752289653860. *** Warning: not enough memory, new stack 288230376144826930. *** Warning: not enough memory, new stack 144115188072413465. *** Warning: not enough memory, new stack 72057594036206732. *** Warning: not enough memory, new stack 36028797018103366. *** Warning: not enough memory, new stack 18014398509051683. *** Warning: not enough memory, new stack 9007199254525841. *** Warning: not enough memory, new stack 4503599627262920. *** Warning: not enough memory, new stack 2251799813631460. *** Warning: not enough memory, new stack 1125899906815730. *** Warning: not enough memory, new stack 562949953407865. *** Warning: not enough memory, new stack 281474976703932. *** Warning: not enough memory, new stack 140737488351966. *** Warning: not enough memory, new stack 70368744175983. *** Warning: not enough memory, new stack 35184372087991. *** Warning: not enough memory, new stack 17592186043995. *** Warning: not enough memory, new stack 8796093021997. *** Warning: not enough memory, new stack 4398046510998. *** Warning: not enough memory, new stack 2199023255499. *** Warning: not enough memory, new stack 1099511627749. *** Warning: not enough memory, new stack 549755813874. *** Warning: not enough memory, new stack 274877906937. *** Warning: not enough memory, new stack 137438953468. *** Warning: not enough memory, new stack 68719476734. *** Warning: new stack size = 34359738367 (32768.000 Mbytes). *** bug in PARI/GP (Segmentation Fault), please report Traceback (click to the left of this block for traceback) ... __SAGE__ *** Warning: not enough memory, new stack 18446744073268923520. *** Warning: not enough memory, new stack 9223372036634461760. *** Warning: not enough memory, new stack 4611686018317230880. *** Warning: not enough memory, new stack 2305843009158615440. *** Warning: not enough memory, new stack 1152921504579307720. *** Warning: not enough memory, new stack 576460752289653860. *** Warning: not enough memory, new stack 288230376144826930. *** Warning: not enough memory, new stack 144115188072413465. *** Warning: not enough memory, new stack 72057594036206732. *** Warning: not enough memory, new stack 36028797018103366. *** Warning: not enough memory, new stack 18014398509051683. *** Warning: not enough memory, new stack 9007199254525841. *** Warning: not enough memory, new stack 4503599627262920. *** Warning: not enough memory, new stack 2251799813631460. *** Warning: not enough memory, new stack 1125899906815730. *** Warning: not enough memory, new stack 562949953407865. *** Warning: not enough memory, new stack 281474976703932. *** Warning: not enough memory, new stack 140737488351966. *** Warning: not enough memory, new stack 70368744175983. *** Warning: not enough memory, new stack 35184372087991. *** Warning: not enough memory, new stack 17592186043995. *** Warning: not enough memory, new stack 8796093021997. *** Warning: not enough memory, new stack 4398046510998. *** Warning: not enough memory, new stack 2199023255499. *** Warning: not enough memory, new stack 1099511627749. *** Warning: not enough memory, new stack 549755813874. *** Warning: not enough memory, new stack 274877906937. *** Warning: not enough memory, new stack 137438953468. *** Warning: not enough memory, new stack 68719476734. *** Warning: new stack size = 34359738367 (32768.000 Mbytes). *** bug in PARI/GP (Segmentation Fault), please report ^CTraceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_99.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("dGltZWl0KCJFLmFuYWx5dGljX3JhbmsoYWxnb3JpdGhtPSdydWJpbnN0ZWluJykiLG51bWJlcj0xKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/tmp/tmpGVvD8B/___code___.py", line 3, in <module> exec compile(u'timeit("E.analytic_rank(algorithm=\'rubinstein\')",number=_sage_const_1 ) File "", line 1, in <module> File "sage_timeit_class.pyx", line 82, in sage.misc.sage_timeit_class.SageTimeit.__call__ (sage/misc/sage_timeit_class.c:744) File "sage_timeit_class.pyx", line 59, in sage.misc.sage_timeit_class.SageTimeit.eval (sage/misc/sage_timeit_class.c:605) File "/usr/local/sage/local/lib/python2.6/site-packages/sage/misc/sage_timeit.py", line 184, in sage_timeit best = min(timer.repeat(repeat, number)) / number File "/usr/local/sage/local/lib/python/timeit.py", line 220, in repeat t = self.timeit(number) File "/usr/local/sage/local/lib/python/timeit.py", line 193, in timeit timing = self.inner(it, self.timer) File "<magic-timeit>", line 6, in inner File "/usr/local/sage/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_rational_field.py", line 1366, in analytic_rank return lcalc.analytic_rank(L=self) File "/usr/local/sage/local/lib/python2.6/site-packages/sage/lfunctions/lcalc.py", line 379, in analytic_rank s = self('--rank-compute %s'%L) File "/usr/local/sage/local/lib/python2.6/site-packages/sage/lfunctions/lcalc.py", line 65, in __call__ return os.popen(cmd).read().strip() KeyboardInterrupt __SAGE__ |
1 loops, best of 3: 10 µs per loop 1 loops, best of 3: 10 µs per loop |
|
|
What about some cases when the upper and lower bound do not match?
RANK 0
Unable to compute the rank with certainty (lower bound=0). This could be because Sha(E/Q)[2] is nontrivial. Try calling something like two_descent(second_limit=13) on the curve then trying this command again. You could also try rank with only_use_mwrank=False. Traceback (click to the left of this block for traceback) ... RuntimeError: Rank not provably correct. Unable to compute the rank with certainty (lower bound=0). This could be because Sha(E/Q)[2] is nontrivial. Try calling something like two_descent(second_limit=13) on the curve then trying this command again. You could also try rank with only_use_mwrank=False. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_43.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("RT1FbGxpcHRpY0N1cnZlKFstMSwtMSwtMSwzLDddKQpFLnJhbmsoKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/tmp/tmp75FKMW/___code___.py", line 4, in <module> exec compile(u'E.rank() File "", line 1, in <module> File "/usr/local/sage/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_rational_field.py", line 1695, in rank raise RuntimeError, 'Rank not provably correct.' RuntimeError: Rank not provably correct. |
*** Warning: new stack size = 1024848 (0.977 Mbytes). *** Warning: new stack size = 1024848 (0.977 Mbytes). *** Warning: new stack size = 1024848 (0.977 Mbytes). 1 loops, best of 3: 24.7 ms per loop *** Warning: new stack size = 1024848 (0.977 Mbytes). *** Warning: new stack size = 1024848 (0.977 Mbytes). *** Warning: new stack size = 1024848 (0.977 Mbytes). 1 loops, best of 3: 24.7 ms per loop |
1 loops, best of 3: 31.4 ms per loop 1 loops, best of 3: 31.4 ms per loop |
1 loops, best of 3: 6.74 ms per loop 1 loops, best of 3: 6.74 ms per loop |
RANK 1
|
*** Warning: new stack size = 1028800 (0.981 Mbytes). *** Warning: new stack size = 1028800 (0.981 Mbytes). *** Warning: new stack size = 1028800 (0.981 Mbytes). 1 loops, best of 3: 29.2 ms per loop *** Warning: new stack size = 1028800 (0.981 Mbytes). *** Warning: new stack size = 1028800 (0.981 Mbytes). *** Warning: new stack size = 1028800 (0.981 Mbytes). 1 loops, best of 3: 29.2 ms per loop |
1 loops, best of 3: 31.8 ms per loop 1 loops, best of 3: 31.8 ms per loop |
1 loops, best of 3: 32.2 ms per loop 1 loops, best of 3: 32.2 ms per loop |
RANK 3
|
*** Warning: new stack size = 13804640 (13.165 Mbytes). *** Warning: new stack size = 13804640 (13.165 Mbytes). *** Warning: new stack size = 13804640 (13.165 Mbytes). 1 loops, best of 3: 4.66 s per loop *** Warning: new stack size = 13804640 (13.165 Mbytes). *** Warning: new stack size = 13804640 (13.165 Mbytes). *** Warning: new stack size = 13804640 (13.165 Mbytes). 1 loops, best of 3: 4.66 s per loop |
1 loops, best of 3: 291 ms per loop 1 loops, best of 3: 291 ms per loop |
1 loops, best of 3: 14.3 s per loop 1 loops, best of 3: 14.3 s per loop |
|
|