Opened 10 years ago

Last modified 8 years ago

#12676 new defect

plot exclude sometimes just connects instead of excluding

Reported by: kcrisman Owned by: jason, was
Priority: major Milestone: sage-6.4
Component: graphics Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by kcrisman)

This email on sage-support pretty much says it all.

I am trying to understand the behaviour of the option exclude in plot() when a range of values is included. It looks to me that if a simple range like "exclude=[pi..2*pi]" is used and the function is defined and real-valued in that range then the end points and integer points between are excluded from the plot, whilst if the function is not real-valued in the range, e.g. "sin(x)cos(x)", then the whole range is excluded. However, if several ranges are specified then when the function is real-valued the behaviour is like that for a single range, whilst if the function is not real-valued then the graph *is* plotted, incorrectly, for ranges after the first. For example the graph of "plot(sin(x)cos(x),(x,0,4*pi),exclude=[pi..2*pi,3*pi..4*pi])" contains a straight line between 3*pi and 4*pi. Surely this cannot be the intended behaviour?

See also the relevant code in Sage 4.8.

Change History (7)

comment:1 Changed 10 years ago by kcrisman

  • Description modified (diff)

comment:2 Changed 10 years ago by kcrisman

Note

sage: [pi..2*pi,3*pi..4*pi]
[pi, pi + 1, pi + 2, pi + 3, 3*pi, 3*pi + 1, 3*pi + 2, 3*pi + 3]

So the following allows us to see more clearly what is going on.

Compare

sage: plot(sin(x)^cos(x),(x,0,4*pi),exclude=[pi..2*pi,3*pi..4*pi],ticks=[[pi..2*pi,3*pi..4*pi],None])

to

sage: plot(sin(x)^cos(x),(x,0,4*pi-.1),exclude=[pi..2*pi,3*pi..4*pi],ticks=[[pi..2*pi,3*pi..4*pi],None])

to

sage: plot(sin(x)^cos(x),(x,0,6*pi),exclude=[pi..2*pi,3*pi..4*pi,5*pi..6*pi],ticks=[[pi..2*pi,3*pi..4*pi,5*pi..6*pi],None])

Another couple to compare:

sage: plot(sin(pi*x)^cos(pi*x),(x,0,4),exclude=[3,4],ymax=20) 
sage: plot(sin(pi*x)^cos(pi*x),(x,0,4),exclude=[1,2,3,4],ymax=20) 

which really shows that there is something subtle about the points involved when we have parts that can't be plotted due to not being real.

comment:3 Changed 10 years ago by kcrisman

  • Description modified (diff)

comment:4 Changed 9 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:5 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:6 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:7 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.