implicit_plot3d question-problem

31 views
Skip to first unread message

LFS

unread,
Apr 16, 2012, 12:15:20 PM4/16/12
to sage-s...@googlegroups.com
Hiya. Probably I have either done something wrong or this is a precision issue I should know about if I programmed. Please excuse.
http://sagenb.org/home/pub/4706

I wanted to plot the level curves of a f(x,y,z)=sqrt(x^2-z) for C=0, 1, -1, 2, -2.
So I typed in
implicit_plot3d(sqrt(x^2-z)==0, (x,-2,2), (y,-5,5), (z,-4,4), opacity=.5)
and nothing was graphed.
I got no error message.

After trying several changes, I gave up and did:
implicit_plot3d(x^2-z==(0)^2, (x,-2,2), (y,-5,5), (z,-4,4), opacity=.5)
and got my "elongated parabola" (published and sent off the reply).

Now after experimenting I find that: C=1, C=2 are no problem.  (GRAPH 2)
In GRAPH 3, one can see: 
For C=0  no graph, C=.1 a tiny piece, C=.2 a couple of slivers, C=.3 a few more slivers and by C=.5 one gets the graph.

BTW: I tried changing the z values (to make the argument always positive) to no effect.

Question: Is there a way to know what graphs will plot and what won't? 
Thank-you for your help. Linda


kcrisman

unread,
Apr 17, 2012, 12:12:01 AM4/17/12
to sage-s...@googlegroups.com


On Monday, April 16, 2012 12:15:20 PM UTC-4, LFS wrote:
Hiya. Probably I have either done something wrong or this is a precision issue I should know about if I programmed. Please excuse.
http://sagenb.org/home/pub/4706

I wanted to plot the level curves of a f(x,y,z)=sqrt(x^2-z) for C=0, 1, -1, 2, -2.
So I typed in
implicit_plot3d(sqrt(x^2-z)==0, (x,-2,2), (y,-5,5), (z,-4,4), opacity=.5)
and nothing was graphed.
I got no error message.

After trying several changes, I gave up and did:
implicit_plot3d(x^2-z==(0)^2, (x,-2,2), (y,-5,5), (z,-4,4), opacity=.5)
and got my "elongated parabola" (published and sent off the reply).


What happens if you try more plot_points?  

sage: implicit_plot3d(sqrt(x^2-z)==.2, (x,-2,2), (y,-5,5), (z,-4,4), opacity=.5) 

sage: implicit_plot3d(sqrt(x^2-z)==.2, (x,-2,2), (y,-5,5), (z,-4,4), opacity=.5,plot_points=100)

sage: implicit_plot3d(sqrt(x^2-z)==.2, (x,-2,2), (y,-5,5), (z,-4,4), opacity=.5,plot_points=200)

sage: implicit_plot3d(sqrt(x^2-z)==.2, (x,-2,2), (y,-5,5), (z,-4,4), opacity=.5,plot_points=300)

the last one is pretty visible, though of course takes quite a while with calculating 27 million points (?).

I tried even plot_points=500 with the =0 one, though, no luck.  I imagine that the square root and getting close enough to EXACTLY zero with the (random?) points that this would choose is the problem there - some sort of precision issue?  
Reply all
Reply to author
Forward
0 new messages