On Sun, Dec 25, 2016 at 11:05 AM, Christian Testa <[email protected]> wrote: > I don't have enough karma on ask.sagemath, so I would like to ask this > question here: > > Hi sage-nt, I've tried a couple different methods for trying to limit the > amount of time sage takes to calculate the rank of an elliptic curve. This is > an example that takes a long time to compute for testing: > > E = EllipticCurve([ -1/36, -1/36, 0, -1, 1 ]) > E.rank() > > I've tried suggestions that are based on Python, using decorators, and > involve creating a wrapper function with the time-limit added, but none of my > attempts have been successful. > > - [ stackoverflow post 1 ]( http://stackoverflow.com/a/366763/3161979 ) > - [ stackoverflow post 2 ]( http://stackoverflow.com/a/601168/3161979 ) > - [ filosophy blog post ]( > https://www.filosophy.org/post/32/python_function_execution_deadlines__in_simple_examples/ > ) > > Each of these has seemed to work for trivial examples (like with timing out > on a long sleep function), but I haven't been able to get this to work with > rank calculations like the example above. > > Does anybody have any suggestions that might work for me?
Use either "alarm" or "fork", both of which are built into Sage. We've had to properly solve exactly the problems you've run into a decade ago already (with many iterations since), and make those solutions work in the context of the very complicated Sage library (which involves C libraries, external processes, etc.). Type "alarm?" or "fork?" or google the sagemath docs. > > My goal is to print details about an elliptic curve to a file, and if it > can't compute the rank quickly enough to write something like "difficult to > calculate" and move on to printing the rest of the information. > > Thank you, > Christian > > -- > You received this message because you are subscribed to the Google Groups > "sage-nt" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send an email to [email protected]. > Visit this group at https://groups.google.com/group/sage-nt. > For more options, visit https://groups.google.com/d/optout. -- William (http://wstein.org) -- You received this message because you are subscribed to the Google Groups "sage-nt" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send an email to [email protected]. Visit this group at https://groups.google.com/group/sage-nt. For more options, visit https://groups.google.com/d/optout.
