Ask Your Question
0

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

asked 2012-08-19 15:44:48 +0100

anonymous user

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-08-19 18:01:02 +0100

achrzesz gravatar image

updated 2012-08-20 02:34:46 +0100

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
edit flag offensive delete link more

Comments

Thanks for the help.

strangelove1221 gravatar imagestrangelove1221 ( 2012-08-19 21:19:49 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-08-19 15:44:48 +0100

Seen: 1,818 times

Last updated: Aug 20 '12