#8341: detect_poles doesn't find a vertical asymptote where both sides go to
infinity
------------------------+---------------------------------------------------
   Reporter:  jason     |       Owner:  was       
       Type:  defect    |      Status:  new       
   Priority:  major     |   Milestone:  sage-4.3.4
  Component:  graphics  |    Keywords:            
     Author:            |    Upstream:  N/A       
   Reviewer:            |      Merged:            
Work_issues:            |  
------------------------+---------------------------------------------------
Changes (by robert.marik):

 * cc: robert.marik (added)


Comment:

 It would be nice to fix this. But current detect_poles simply skips the
 lines with slope close to pi/2 and draws the vertical asyptote, if the
 function changes sign (skips from -infinity to +infinity). I think that
 using this idea it is not possible to detect vertical asymptote.

 Just some attempts: If we drop the condition which requires change in
 sign,
 we get "interval of asymptotes" - the asymptote is too thick.
 Making epsilon smaller introduces problems with other graphs.

 This is the diff with my experiments, if someone is interested
 {{{
 diff -r a1d167a37d52 sage/plot/plot.py
 --- a/sage/plot/plot.py Thu Feb 25 13:42:16 2010 -0600
 +++ b/sage/plot/plot.py Sat Mar 06 15:23:11 2010 +0100
 @@ -2698,17 +2698,16 @@
              x0, y0 = exclude_data[i]
              x1, y1 = exclude_data[i+1]
              # detect poles
 -            if (not (polar or parametric)) and detect_poles != False \
 -               and ((y1 > 0 and y0 < 0) or (y1 < 0 and y0 > 0)):
 +            if (not (polar or parametric)) and detect_poles != False:
                  # calculate the slope of the line segment
                  dy = abs(y1-y0)
                  dx = x1 - x0
                  alpha = (RDF(dy)/RDF(dx)).arctan()
 -                if alpha >= RDF(pi/2) - epsilon:
 +                if alpha >= RDF(pi/2) - 0.00001:
                      G += line(data[start_index:i], **options)
                      if detect_poles == 'show':
                          # draw a vertical asymptote
 -                        G += line([(x0, y0), (x1, y1)], **pole_options)
 +                        G += line([(x0, -1e100), (x1, 1e100)],
 **pole_options)
                      start_index = i+2
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8341#comment:1>
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