(plot(1/t,.1,8)+plot(1/t,1/2,1,fill=true)).show()
Rob
> Email: dcer...@plymouth.edu
var('t')
plot(1/t,(t,.1,8))+plot(1/t,(t,1/2,1),fill=True,ymin=0)
(sorry; I'd explain more, but I have to run)
Thanks,
Jason
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)
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