On Feb 8, 9:22 am, Dana Ernst <[email protected]> wrote:
> >>  I'd like to show the graph of y=1/t from say 0 to 8 and have the area 
> >> under the graph shaded from say 1/2 to 1.  Doing the following seemed 
> >> natural to me:
>
> >> plot(1/t,.1,8)+plot(1/t,1/2,1,fill=true).show()
>
> >> However, this doesn't work.  (Of course, I declared t as a variable 
> >> earlier.)  I'm sure I could figure this out, but I teach in an hour and 
> >> I'm sure someone here could quickly tell me:)
>
> >> Also, if someone wouldn't mind telling when to use ".show" that would be 
> >> great.
>
> > var('t')
> > plot(1/t,(t,.1,8))+plot(1/t,(t,1/2,1),fill=True,ymin=0)
>
> Awesome, that works (and so does Rob's suggestion).  What is ymin=0 doing in 
> this context?  I'm guessing that in the context of what I'm trying to do, I 
> don't need it.  Also, is "var('t')" redundant if you include t in (t,.1,8) 
> for example?
>

I think he is doing it from scratch, so you need to declare 't' at
that point.

The ymin=0 could be necessary if your original function didn't get
close enough to the x-axis for the axes to actually cross.

Finally, plot passes all options (like fill) to show() if you just
type plot(stuff), as opposed to P=plot(stuff), which doesn't
automatically show it.  So since you only needed the fill for the
second thing, putting that option directly in "its" plot did what you
wanted.  The original thing threw an error because you tried to add a
plot object and a "show", which are not the same type of object.

Incidentally, Dana, I encourage you to put future questions of this
sort on sage-support, where more people will benefit from them!  This
list is primarily for discussing more abstract educational issues, but
on sage-support many people can learn about basic syntax issues like
this.  But thanks for asking, either way :)

- kcrisman

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

Reply via email to