Limiting Range on plot()

378 views
Skip to first unread message

Brad Burkman

unread,
Jan 14, 2013, 10:07:44 AM1/14/13
to sage...@googlegroups.com
I'm using Sage in my Calc I course.  To get students comfortable with it, I'm starting with aleph.sagemath.org, the single-cell server.  I want the students to start by using Sage to graph.  Here's a sample question from their text:

"Graph y = sin x and y = csc x together for -pi <= x <= 2*pi.  Comment on the behavior of csc x in relation to the signs and values of sin x."

When they enter

    A = plot( csc(x), -pi, 2*pi )
    show(A)

the y values go from zero down to -8e15. 

How can they limit the range of the graph so they can see the pertinent behavior?

Thanks,

Brad

--
J. Bradford Burkman
Instructor in Mathematics, Louisiana School for Math, Science, and the Arts
XSEDE Campus Champion, Louisiana Scholars' College
bbur...@lsmsa.edu

kcrisman

unread,
Jan 14, 2013, 10:43:50 AM1/14/13
to sage...@googlegroups.com
Hi Brad!  Good to hear from you.



When they enter

    A = plot( csc(x), -pi, 2*pi )
    show(A)

the y values go from zero down to -8e15. 


This is pretty typical for anything with asymptotes. 
 
How can they limit the range of the graph so they can see the pertinent behavior?
 
Have them try using plot(..., ymin=-5,ymax=5) or whatever is relevant.  In fact, this is a good exercise, to see how such functions behave... but of course maybe by default they would want to try having a set standard for such asymptotic functions to always put in.  We haven't yet come up with a (good) way to automatically detect such things, as "detect_poles" doesn't always do this.  See also http://trac.sagemath.org/sage_trac/ticket/3985 and http://trac.sagemath.org/sage_trac/ticket/8341

- kcrisman

kcrisman

unread,
Jan 14, 2013, 10:44:58 AM1/14/13
to sage...@googlegroups.com
Since we're on sage-edu and not sage-support, I'd add that pedagogically you might want to try just making an interact that already limits the y-values for them.  I think that the authors of the MAA calculus text are essentially trying this (Lang or David, if you see this, feel free to respond).

Brad Burkman

unread,
Jan 15, 2013, 6:45:51 PM1/15/13
to sage...@googlegroups.com
Karl-Dieter,

Now that I know to look for "ymax," I see it in the documentation, but I might suggest that it be one of the listed "PLOT OPTIONS," along with "xmax" and "xmin." 

Also, if
    plot ( x^2, (x,1,2) )
works to limit the domain, should
    plot ( x^2, (y,1,2) )
work to limit the range?

Thanks,

Brad

Jason Grout

unread,
Jan 15, 2013, 7:00:35 PM1/15/13
to sage...@googlegroups.com
But what about plot(y^2, (y,1,3))?

Which is why I don't think it should be ymin/ymax; it should be
something like plotmin/plotmax or something.

Thanks,

Jason

kcrisman

unread,
Jan 15, 2013, 8:09:00 PM1/15/13
to sage...@googlegroups.com


On Tuesday, January 15, 2013 6:45:51 PM UTC-5, Brad Burkman wrote:
Karl-Dieter,

Now that I know to look for "ymax," I see it in the documentation, but I might suggest that it be one of the listed "PLOT OPTIONS," along with "xmax" and "xmin." 


Well, it's one of the "show options", most likely... which are now even further apart from plot options since Jeroen moved them to graphics.py or something.  We probably need to find a way to unify that documentation.  What do you think would help the most with http://sagemath.org/doc/reference/sage/plot/plot.html

Brad Burkman

unread,
Jan 17, 2013, 4:38:27 PM1/17/13
to sage...@googlegroups.com
To reply to Jason's post about whether "xmax", "xmin," "ymax," and "ymin" are too limiting, rather than "x" or "y," what about "domain" and "range," or "horizontal" and "vertical"?

To reply to Karl-Dieter's question about what I would like to see in the documentation, it would help if "ymin" and "ymax" were given right under the introduction of "xmin" and "xmax." 

kcrisman

unread,
Jan 17, 2013, 4:57:59 PM1/17/13
to sage...@googlegroups.com


On Thursday, January 17, 2013 4:38:27 PM UTC-5, Brad Burkman wrote:
To reply to Jason's post about whether "xmax", "xmin," "ymax," and "ymin" are too limiting, rather than "x" or "y," what about "domain" and "range," or "horizontal" and "vertical"?

To reply to Karl-Dieter's question about what I would like to see in the documentation, it would help if "ymin" and "ymax" were given right under the introduction of "xmin" and "xmax." 

Do you mean like in the doc for 


Jason Grout

unread,
Jan 18, 2013, 12:34:08 AM1/18/13
to sage...@googlegroups.com
On 1/17/13 3:38 PM, Brad Burkman wrote:
> To reply to Jason's post about whether "xmax", "xmin," "ymax," and
> "ymin" are too limiting, rather than "x" or "y," what about "domain" and
> "range," or "horizontal" and "vertical"?

FYI, Mathematica uses PlotRange for this idea.

http://reference.wolfram.com/mathematica/ref/PlotRange.html

Jason



michel paul

unread,
Jan 18, 2013, 1:06:42 AM1/18/13
to sage...@googlegroups.com
Aside from the specific range issue, I just want to say thanks very much for brining this up, as it made me take a closer look at the single cell server. This really is a great way to introduce students to Sage. The fact that you can provide a simple URL without having to worry about managing accounts in any way opens up lots of possibilities for easily providing examples to students and for having them share their ideas. It's very simple, just one cell. But even in just one cell, you can still do a lot.

- Michel


--
You received this message because you are subscribed to the Google Groups "sage-edu" group.
To post to this group, send email to sage...@googlegroups.com.
To unsubscribe from this group, send email to sage-edu+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sage-edu?hl=en.



--
===================================
"What I cannot create, I do not understand."

- Richard Feynman
===================================
"Computer science is the new mathematics."

- Dr. Christos Papadimitriou
===================================

Brad Burkman

unread,
Jan 18, 2013, 10:24:35 AM1/18/13
to sage...@googlegroups.com
Karl-Dieter,

Yes, exactly in

    http://sagemath.org/doc/reference/sage/plot/plot.html#sage.plot.plot.plot

because when I Google

    sagemath plot

I naturally choose the hit for "reference" over "tour," which is

    http://www.sagemath.org/doc/reference/sage/plot/plot.html

and then click on "plot."

It's where someone looking for this information will naturally go. 

Brad

kcrisman

unread,
Jan 27, 2013, 10:13:36 PM1/27/13
to sage-edu


On Jan 18, 10:24 am, Brad Burkman <bburk...@lsmsa.edu> wrote:
> Karl-Dieter,
>
> Yes, exactly in
>
> http://sagemath.org/doc/reference/sage/plot/plot.html#sage.plot.plot....<http://sagemath.org/doc/reference/sage/plot/plot.html#sage.plot.plot....>
>
> because when I Google
>
>     sagemath plot
>
> I naturally choose the hit for "reference" over "tour," which is
>
>    http://www.sagemath.org/doc/reference/sage/plot/plot.html
>
> and then click on "plot."
>
> It's where someone looking for this information will naturally go.
>

I've opened http://trac.sagemath.org/sage_trac/ticket/14021 for this.
Reply all
Reply to author
Forward
0 new messages