[sage-support] Re: Handling Axiom crashes in Sage

2009-07-25 Thread MaxTheMouse


 On Jul 24, 3:10 pm, MaxTheMouse maxthemo...@googlemail.com wrote:

  I gave it a quick trial and got a syntax error.

 Can you tell me which polynomial it crashed on (i.e., what D is after
 the crash)?

 I had been getting syntax errors on that statement before, but I
 realized it was because Axiom sticks extra spaces into very long
 strings when it outputs in FORTRAN mode, which is what
 unparsed_input_form() uses, I believe (thus the .replace(' ', '')
 command).  That doesn't seem to be what's wrong here though.

Just for information.

D = x^4 - 10*x^3 + 3*x^2 - 10*x + 1
D = x^4 + 10*x^3 + 3*x^2 + 10*x + 1

give a syntax error.

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



[sage-support] Re: Handling Axiom crashes in Sage

2009-07-24 Thread Martin Rubey

If you are running longer jobs with fricas, you should consider
switching to a faster lisp implementation.  For FriCAS, clisp is
aboutthe slowest.  

from the INSTALL file of FriCAS:

  All Lisp impementations should give essentially the same
  functionality, however performance (speed) may differ quite a lot.
  On 64-bit AMD64 on average sbcl is the fastest one (7 times faster
  than clisp), Closure CL the second (about 2.5 times slower than sbcl),
  than gcl and ECL (about 3 times slower than sbcl) and clisp is the slowest
  one.  Note: older versions of ECL were much (about 4 times) slower,
  you should use newest version if you care about speed.

Martin

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



[sage-support] Re: Handling Axiom crashes in Sage

2009-07-24 Thread David D.

Thanks all.

On Jul 23, 10:06 pm, William Stein wst...@gmail.com wrote:
 Do you know about Python's try/except construction?  Does the above
 raise a RuntimeError?  Maybe you can do something sort of like:

No, it doesn't crash in the same way that it would if, say, I tried to
evaluate 1/0, which I think is what you're talking about.  It simply
displays the Axiom Crashed... message exactly as if I'd done a print
() statement, and seems to keep running (green bar on the left),
though nothing actually happens.  After I Interrupt, Axiom is working,
but all variables are cleared.

I know only the basics of Python at the moment, and learn parts of it
on an as-needed basis.  That's how I learn programming languages best.

On Jul 24, 12:20 am, Bill Page bill.p...@newsynthesis.org wrote:
 I am very interested in your use of Axiom in Sage. I was beginning to
 think I was the only one doing this sort of thing. :-(

To be honest, this is the first time I've used Axiom.  It was the only
CAS I could find that can do the calculations I needed.  It seems like
an extremely powerful and useful system, though the 17,000+ page
reference manual is a bit intimidating. Plus as a stubborn windows
user, it annoys me that there's not a tidy way to run it in Windows
except through Sage. ;)

 I have been running a slightly modified version of your code (modified
 for compatibility with an older version of Sage 3.2 and Mike Hansen's
 patches for Axiom) on a fairly fast processor for more than 3 hours.
 Output from a 'print a,b,c' debugging statement currently shows:
...
 -8 2 2

Is that the last output you got before you posted?  Mine gets a
litttle farther than that in 90 minutes, though I'm sure hundreds of
extra print statements are slowing yours down as well.  I only have a
cheap Dell desktop.

 I realize that you are more interested in a work-a-round than in
 finding the cause of the problem but as both a Sage user and an Axiom
 developer I am motivated to look into this problem a little further.

Well that would be nice, too.

 By running on Windows Vista, I presume that you mean you are running
 Sage (and FriCAS) on a virtual machine under Windows. Can you be more
 precise about exactly what versions you are running? What Sage source
 code or binary file did you download and build or install? How did you
 install Fricas 1.0.3? Was it built using clisp or ecl? How much memory
 is allocated for the virtual machine?

Yes, I just downloaded the sage-vmware-4.0.1.zip file from
sagemath.org, installed VMWare Player (2.5.2 build-156735), and opened
sage_vmx.vmx.  I would've either installed fricas simply through an
install_package('fricas-1.0.3.p0') command in the Firefox session, or
with a sage -i -fricas-1.0.3.p0 from the command line.

As for the last two questions, I don't even know how to check, but I
didn't mess with anything, so things should still be set at the
defaults..

On Jul 24, 3:36 am, Martin Rubey martin.ru...@math.uni-hannover.de
wrote:
 If you are running longer jobs with fricas, you should consider
 switching to a faster lisp implementation.  For FriCAS, clisp is
 aboutthe slowest.

Well, the speed it runs at now is servicable for me at this point.
I'm a bit Linux-illiterate, so I think it would probably take me more
time to figure out how to upgrade than I'd save.
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Handling Axiom crashes in Sage

2009-07-24 Thread Martin Rubey

David D. antler...@yahoo.com writes:

 To be honest, this is the first time I've used Axiom.  It was the only
 CAS I could find that can do the calculations I needed.  It seems like
 an extremely powerful and useful system, though the 17,000+ page
 reference manual is a bit intimidating. Plus as a stubborn windows
 user, it annoys me that there's not a tidy way to run it in Windows
 except through Sage. ;)

But that's not true at all.  There are even binaries available (that
need cygwin), but it *should* be very easy to set it up.  If you are
interested, please write to the fricas-devel mailing list, so you get
help quickly.

 On Jul 24, 3:36 am, Martin Rubey martin.ru...@math.uni-hannover.de
 wrote:

 If you are running longer jobs with fricas, you should consider
 switching to a faster lisp implementation.  For FriCAS, clisp is
 aboutthe slowest.

 Well, the speed it runs at now is servicable for me at this point.
 I'm a bit Linux-illiterate, so I think it would probably take me more
 time to figure out how to upgrade than I'd save.

Although I do not have Windows available, I try to keep INSTALL.CYGWIN
updated.  PLEASE tell me if it doesn't work smoothly.


Martin

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



[sage-support] Re: Handling Axiom crashes in Sage

2009-07-24 Thread William Stein

On Fri, Jul 24, 2009 at 1:36 AM, Martin
Rubeymartin.ru...@math.uni-hannover.de wrote:

 If you are running longer jobs with fricas, you should consider
 switching to a faster lisp implementation.  For FriCAS, clisp is
 aboutthe slowest.

We don't use clisp for Sage anymore.  We dumped clisp for ECL a couple
of months ago.

William


 from the INSTALL file of FriCAS:

  All Lisp impementations should give essentially the same
  functionality, however performance (speed) may differ quite a lot.
  On 64-bit AMD64 on average sbcl is the fastest one (7 times faster
  than clisp), Closure CL the second (about 2.5 times slower than sbcl),
  than gcl and ECL (about 3 times slower than sbcl) and clisp is the slowest
  one.  Note: older versions of ECL were much (about 4 times) slower,
  you should use newest version if you care about speed.

 Martin

 




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

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



[sage-support] Re: Handling Axiom crashes in Sage

2009-07-24 Thread Bill Page

But

On Fri, Jul 24, 2009 at 6:08 AM, David D. wrote:

 Yes, I just downloaded the sage-vmware-4.0.1.zip file from
 sagemath.org, installed VMWare Player (2.5.2 build-156735), and opened
 sage_vmx.vmx.  I would've either installed fricas simply through an
 install_package('fricas-1.0.3.p0') command in the Firefox session, or
 with a sage -i -fricas-1.0.3.p0 from the command line.

So as far as I can tell he is using FriCAS built with clisp.

Perhaps someone should try David's example with FriCAS built with ECL.
 It will probably take me a couple of days to be able to be in a
position to do that.

Regards,
Bill Page.


On Fri, Jul 24, 2009 at 10:43 AM, William Steinwst...@gmail.com wrote:

 On Fri, Jul 24, 2009 at 1:36 AM, Martin
 Rubeymartin.ru...@math.uni-hannover.de wrote:

 If you are running longer jobs with fricas, you should consider
 switching to a faster lisp implementation.  For FriCAS, clisp is
 aboutthe slowest.

 We don't use clisp for Sage anymore.  We dumped clisp for ECL a couple
 of months ago.

 William


 from the INSTALL file of FriCAS:

  All Lisp impementations should give essentially the same
  functionality, however performance (speed) may differ quite a lot.
  On 64-bit AMD64 on average sbcl is the fastest one (7 times faster
  than clisp), Closure CL the second (about 2.5 times slower than sbcl),
  than gcl and ECL (about 3 times slower than sbcl) and clisp is the slowest
  one.  Note: older versions of ECL were much (about 4 times) slower,
  you should use newest version if you care about speed.

 Martin

 




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

 


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



[sage-support] Re: Handling Axiom crashes in Sage

2009-07-24 Thread MaxTheMouse



On Jul 24, 4:56 pm, Bill Page bill.p...@newsynthesis.org wrote:
 But

 On Fri, Jul 24, 2009 at 6:08 AM, David D. wrote:

  Yes, I just downloaded the sage-vmware-4.0.1.zip file from
  sagemath.org, installed VMWare Player (2.5.2 build-156735), and opened
  sage_vmx.vmx.  I would've either installed fricas simply through an
  install_package('fricas-1.0.3.p0') command in the Firefox session, or
  with a sage -i -fricas-1.0.3.p0 from the command line.

 So as far as I can tell he is using FriCAS built with clisp.

 Perhaps someone should try David's example with FriCAS built with ECL.
  It will probably take me a couple of days to be able to be in a
 position to do that.

 Regards,
 Bill Page.




I gave it a quick trial and got a syntax error. This is using
sage-4.1.1.alpha0 and fricas-1.0.7 compiled with ecl. It appears to
work for a bit before hitting an error. I have no idea why this
happens. Note that the same error happens if I use an axiom binary
that was installed globally.

cheers,
Adam

$ sage poly.sage
(x^4 - 10*x^3 - 9*x^2 + 2*x + 1, [2, 6/125*(5*x^2 - x + y - 1)/x^2])
(x^4 - 10*x^3 - x^2 + 4*x + 1, [2, 26/125*(5*x^2 - 4*x + 2*y - 2)/
x^2])
Traceback (most recent call last):
  File poly.py, line 56, in module
G = find_generator(D)
  File poly.py, line 46, in find_generator
f = sage_eval(fricas('lift(G.function) :: EXPR FRAC
INT').unparsed_input_form().replace(' ',''), locals={'x':x, 'y':y})
  File /home/adamwebb/local/sage/local/lib/python2.6/site-packages/
sage/misc/sage_eval.py, line 199, in sage_eval
return eval(source, sage.all.__dict__, locals)
  File string, line 1
(((-Integer(6790426181)/Integer(5353409889000))*x**Integer(4)+
(Integer(3967999651)/Integer(2676704944500))*x**Integer(3)+(-Integer
(182627599)/Integer(356893992600))*x**Integer(2)+(Integer(182627599)/
Integer(2676704944500))*x+(-Integer(16602509)/Integer(5353409889000)))
*y+((Integer(16602509)/Integer(6365529000))*x**Integer(6)+(-Integer
(6790426181)/Integer(1784469963000))*x**Integer(5)+(Integer(Integer
(11412589)/Integer(5353409889000))*x**Integer(3)+(Integer(182627599)/
Integer(223058745375))*x**Integer(2)+(-Integer(49807527)/Integer
(594823321000))*x+(Integer(16602509)/Integer(5353409889000/
(x**Integer(6))
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Handling Axiom crashes in Sage

2009-07-24 Thread David D.

 But that's not true at all.  There are even binaries available (that
 need cygwin), but it *should* be very easy to set it up.  If you are
 interested, please write to the fricas-devel mailing list, so you get
 help quickly.

Hmm, I tried installing cygwin once and made a mess of things somehow
and nothing worked.  I'll have to try again.  Thanks.

On Jul 24, 3:10 pm, MaxTheMouse maxthemo...@googlemail.com wrote:
 I gave it a quick trial and got a syntax error.

Can you tell me which polynomial it crashed on (i.e., what D is after
the crash)?

I had been getting syntax errors on that statement before, but I
realized it was because Axiom sticks extra spaces into very long
strings when it outputs in FORTRAN mode, which is what
unparsed_input_form() uses, I believe (thus the .replace(' ', '')
command).  That doesn't seem to be what's wrong here though.
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Handling Axiom crashes in Sage

2009-07-23 Thread William Stein

On Thu, Jul 23, 2009 at 7:25 PM, David D.antler...@yahoo.com 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 sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Handling Axiom crashes in Sage

2009-07-23 Thread Bill Page

On Thu, Jul 23, 2009 at 10:25 PM, David D.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.

I am very interested in your use of Axiom in Sage. I was beginning to
think I was the only one doing this sort of thing. :-(

 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.

I am not so sure about the origin of the Axiom crashed ... message
but besides an actual program crash, I think it might also simply
indicate a communication failure between Sage and FriCAS. There have
been problems with that on some platforms in the past.

I have been running a slightly modified version of your code (modified
for compatibility with an older version of Sage 3.2 and Mike Hansen's
patches for Axiom) on a fairly fast processor for more than 3 hours.
Output from a 'print a,b,c' debugging statement currently shows:

...
-8 0 3
-8 0 4
(x^4 - 8*x^3 + 4*x + 1, [2, (3*y/4 + 3*x^2/2 - 3*x/2 - 3/4)/x^2])
-8 0 5
...
-8 2 0
-8 2 1
-8 2 2
...

With no failures so far.


 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.


I realize that you are more interested in a work-a-round than in
finding the cause of the problem but as both a Sage user and an Axiom
developer I am motivated to look into this problem a little further.

 Running Sage 4.0.1 and Fricas 1.0.3 on Windows Vista.


By running on Windows Vista, I presume that you mean you are running
Sage (and FriCAS) on a virtual machine under Windows. Can you be more
precise about exactly what versions you are running? What Sage source
code or binary file did you download and build or install? How did you
install Fricas 1.0.3? Was it built using clisp or ecl? How much memory
is allocated for the virtual machine?

 Here's the actual code I'm running, if it helps:
 ...

Thanks. I changed only two lines in your code:

# if (gcd(D,diff(D,x)) != 1): return [0,0]
if (axiom.gcd(D,diff(D,x)) != 1): return [0,0]

# axiom.set('F', D)
axiom('F:=%s'%axiom(D).name())

The first one calls the FriCAS version of gcd since the native gcd
in Sage-3.2 was not able to handle some of your polynomials.

The second change is just for compatibility with the older version of
the FriCAS/Axiom interface. It works around a bug that I think is
fixed in more recent versions of Sage.

As far as I can tell these changes should not prevent the problem you
are seeing. I expect that it is a deeper problem relating to memory
and/or lisp version. If you are using FriCAS with ecl that is one of
the first things I might suspect.

In my case I am running an older version of Sage but a somewhat newer
version of FriCAS. FriCAS is compiled with clisp under 32-bit Debian
5.0 on a 3.0 GHz processor with a large cache and 4 Gbytes memory.
Sage 3.2 was built from source plus Mike Hansen's patched for axiom.py
from trac (I believe these patches must have been included in Sage
4.0.1).

I installed FriCAS 1.0.5 from

http://sage.math.washington.edu/home/page/packages/fricas-1.0.5.spkg

which I assembled from the build machinery in the spkg for
fricas-1.0.3.p0 plus the newer FriCAS sources.

---

I will let the current test run to completion (if possible) and let
you know the result. If this succeeds, I will try building a new
version of Sage and FriCAS that is closer to what you are running and
try again to see if I am able to reproduce the problem.

Regards,
Bill Page.

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