On Thu, Jul 23, 2009 at 7:25 PM, David D.<[email protected]> wrote:
>
> Hi, I'm trying to run a simple script that basically loops through a
> long list of polynomials, does some things with them in Axiom, and
> imports the results back to Sage.  After running for a while (60-90
> minutes) it will hang with the message "Axiom crashed -- automatically
> restarting."  At this point I have to Interrupt and manually restart
> the loop at the point where it failed.

Do you know about Python's "try/except" construction?  Does the above
raise a RuntimeError?  Maybe you can do something sort of like:

try:
    do stuff
except RuntimeError:
     restart stuff and start argain

William

> Is there any way to catch this error automatically so I can continue
> processing without having to manually restart?   I'd like to be able
> to leave it running overnight or for days at a time, and manually
> restarting it every hour is at best annoying.
>
> I've tested and the crash doesn't happen at any specific point in the
> input or even on a specific axiom command, but it does seem to occur
> after the same amount of time roughly (1-1.5 hours) even with
> different input, so I don't believe it's a coding flaw (even though
> that would probably be the easiest thing to fix).  I'm more interested
> in finding a way to handle this error, though, than preventing it from
> happening.
>
> Running Sage 4.0.1 and Fricas 1.0.3 on Windows Vista.
>
> Here's the actual code I'm running, if it helps:
>
>
> var('x,y')
>
> axiom.set('Q',   'FRAC INT')
> axiom.set('Qx',  'UnivariatePolynomial(x,Q)')
> axiom.set('Qxy', 'UnivariatePolynomial(y,FRAC Qx)')
>
> def find_generator(D) :
>
>    if (gcd(D,diff(D,x)) != 1): return [0,0]
>
>    axiom.set('F', D)
>    axiom.set('R', 'RadicalFunctionField(Q, Qx, Qxy, F :: Qx, 2)')
>    axiom.set('V', 'FiniteDivisor(Q,Qx,Qxy,R)')
>    axiom.set('S', 'PointsOfFiniteOrderRational(Qx, Qxy, R)')
>    axiom.set('G', 'torsionIfCan(divisor(0,1)$V - divisor(0,-1)$V)$S')
>
>    n = axiom('(G case "failed" => 0; G.order)').sage()
>    if (n == 0) : return [0,0]
>
>    # Needs .replace(' ','') since strings longer than 244 characters
> get extra spaces put into
>    #   them for some reason, which messes things up.
>    f = sage_eval(axiom('lift(G.function) :: EXPR FRAC
> INT').unparsed_input_form().replace(' ',''), locals={'x':x, 'y':y})
>
>    return([n,f])
>
> #----------------------------------------------------------
>
> for a in range(-10,11) :
>    for b in range(-10,11) :
>        for c in range(-10,11) :
>            D = x^4+a*x^3+b*x^2+c*x+1
>            G = find_generator(D)
>            if (G != [0,0]): print(D,G)
>
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to