#10268: adding GiNaC method to simplify_rational
----------------------------+-----------------------------------------------
   Reporter:  bgoodri       |       Owner:  burcin    
       Type:  enhancement   |      Status:  needs_work
   Priority:  minor         |   Milestone:  sage-4.6.2
  Component:  symbolics     |    Keywords:            
     Author:  Ben Goodrich  |    Upstream:  N/A       
   Reviewer:                |      Merged:            
Work_issues:                |  
----------------------------+-----------------------------------------------

Comment(by bgoodri):

 Replying to [comment:5 burcin]:

 > Replying to [comment:4 bgoodri]:
 > > And then a related question is why does gcd seem to hang?
 > The `numeric::gcd()` method calls `sage.symbolic.pynac.py_gcd()`. See
 here:
 http://pynac.sagemath.org/hg/file/b233d9dadcfa/ginac/numeric.cpp#l2526 It
 could be that our gcd() function doesn't work exactly like CLN's `gcd()`
 function which is used originally by ginac. This would effect the
 termination criteria used in the multivariate gcd code in ginac/pynac.
 [[BR]]

 Okay, I've been contributing to the confusion. Now I see what you meant:
 When sage calls Pynac's normal() function, Pynac calls "its" gcd()
 function, which is actually sage's gcd() function. So, all the calls to
 gcd() are expected behavior, and the question becomes why doesn't Pynac
 get them over with and terminate in 30 seconds like GiNaC does with the
 CLN implementation of gcd()?

 For reference when I switch on the statistics bookkeeping in the (latest)
 GiNaC source:

 {{{
 goodr...@y560:/tmp$ time ginsh test.ginsh
 ginsh - GiNaC Interactive Shell (ginac V1.5.8)
   __,  _______  Copyright (C) 1999-2010 Johannes Gutenberg University
 Mainz,
  (__) *       | Germany.  This is free software with ABSOLUTELY NO
 WARRANTY.
   ._) i N a C | You are welcome to redistribute it under certain
 conditions.
 <-------------' For details type `warranty;'.

 Type ?? for a list of help topics.
 gcd() called 56331 times
 sr_gcd() called 0 times
 heur_gcd() called 1612 times
 heur_gcd() failed 1 times

 real    0m34.025s
 user    0m33.245s
 sys     0m0.602s

 }}}
 Okay, that is what is supposed to happen. With the current Pynac, I
 interrupt after an hour and

 {{{
 sage: quit;
 Exiting Sage (CPU time 62m29.29s, Wall time 64m3.75s).
 gcd() called 57537 times
 sr_gcd() called 19 times
 heur_gcd() called 1936 times
 heur_gcd() failed 19 times

 }}}
 So, it looks as if Pynac is hanging at or toward the end, and it
 experiences many more failures in the heur_gcd() routine. I guess I should
 be looking at the gcd heuristics then. Any ideas come to mind?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10268#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
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-trac?hl=en.

Reply via email to