# filling in an area under a function or curve in 3 dimensions

Anonymous

I am new to Sage, and I couldn't find an answer to two question in the documentation. First, how do I get sage to plot a parametric curve in 3 dimensions, and then fill in the area between the curve and the xy-plane (i.e., I want sage to drop down a "sheet" from the curve to the xy-plane)? Similarly, how do I get Sage to plot a function in 3 dimensions (say, $f(x,y)=x^2y+10)$), and tell sage to fill in the volume under the graph between the function and the xy-plane? So for the function $f$ just mentioned, I would like the volume under the curve filled in over the rectangle $1 \leq x \leq 3$, $0 \leq y \leq 5$. How do I do that? Thanks!

edit retag close merge delete

Sort by ยป oldest newest most voted

In the case of 3d curve you can try something like:

var('t u')
p1=parametric_plot3d([cos(u),sin(u),u^2],(u,-1,1),thickness=10)
p2=sum([line([(cos(t),sin(t),0),(cos(t),sin(t),t^2)]) for t in srange(-1,1,0.02)])
p1+p2


In the case of 3d surface:

var('x y')
f(x,y)=x^2*y+10
p0=plot3d(f(x,y),(x,1,3),(y,0,5),opacity=0.2)+plot3d(0,(x,1,3),(y,0,5),opacity=0.2)
p1=sum([line([(t,0,0),(t,0,f(t,0))]) for t in srange(1,3,0.02)])
p2=sum([line([(3,u,0),(3,u,f(3,u))]) for u in srange(0,5,0.1)])
p0+p1+p2

more

Thanks for the help.

( 2012-08-19 21:19:49 +0200 )edit