[sage-support] Re: plot3d with adaptive=True fails

2011-09-15 Thread kcrisman


On Sep 15, 9:08 am, Dan Drake dr...@kaist.edu wrote:
 This is strange:

 x, y =var('x y')
 plot3d(sqrt(x^2+y^2)*sin(1/sqrt(x^2+y^2)), (x,-1/2, 1/2), (y, -1/2, 1/2), 
 adaptive=True)

 fails with ValueError: cannot convert float NaN to integer. Something
 goes wrong when it partitions up the domain, probably when it looks at
 the origin. Is there a way to avoid this? Is this a bug?

Or rather, very very close to the origin.  I don't have time right
now, but can you confirm that there is not a depth of recursion
keyword like there is in 2d plotting?  I would call this a bug.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: plot3d with adaptive=True fails

2011-09-15 Thread Rajeev Singh
On Thu, Sep 15, 2011 at 7:10 PM, kcrisman kcris...@gmail.com wrote:


 On Sep 15, 9:08 am, Dan Drake dr...@kaist.edu wrote:
 This is strange:

 x, y =var('x y')
 plot3d(sqrt(x^2+y^2)*sin(1/sqrt(x^2+y^2)), (x,-1/2, 1/2), (y, -1/2, 1/2), 
 adaptive=True)

 fails with ValueError: cannot convert float NaN to integer. Something
 goes wrong when it partitions up the domain, probably when it looks at
 the origin. Is there a way to avoid this? Is this a bug?

 Or rather, very very close to the origin.  I don't have time right
 now, but can you confirm that there is not a depth of recursion
 keyword like there is in 2d plotting?  I would call this a bug.

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to 
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org


For the time being there is a hack -

x, y, x1, y1 =var('x y x1 y1')

plot3d(lambda x,y: limit(
limit(sqrt(x1^2+y1^2)*sin(1/sqrt(x1^2+y1^2)), x1=x), y1=y), (x,-1/2,
1/2), (y, -1/2, 1/2), adaptive=True) #slow

or

plot3d(lambda x,y: limit(
limit(sqrt(x1^2+y1^2)*sin(1/sqrt(x1^2+y1^2)), x1=x), y1=y) if
x^2+y^21e-4 else sqrt(x^2+y^2)*sin(1/sqrt(x^2+y^2)), (x,-1/2, 1/2),
(y, -1/2, 1/2), adaptive=True)  # dirty but fast

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: plot3d with adaptive=True fails

2011-09-15 Thread achrzesz
Also:

sage:  T = Cylindrical('height', ['radius', 'azimuth'])
sage: r, theta, z = var('r theta z')
sage: plot3d(r*sin(1/r), (r, 0.0, 0.2), (theta, 0, 2*pi),
transformation=T,adaptive=True)

Andrzej Chrzeszczyk

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: plot3d with adaptive=True fails

2011-09-15 Thread Dan Drake
On Thu, 15 Sep 2011 at 06:40AM -0700, kcrisman wrote:
 On Sep 15, 9:08 am, Dan Drake dr...@kaist.edu wrote:
  This is strange:
 
  x, y =var('x y')
  plot3d(sqrt(x^2+y^2)*sin(1/sqrt(x^2+y^2)), (x,-1/2, 1/2), (y, -1/2, 1/2), 
  adaptive=True)
 
  fails with ValueError: cannot convert float NaN to integer. Something
  goes wrong when it partitions up the domain, probably when it looks at
  the origin. Is there a way to avoid this? Is this a bug?
 
 Or rather, very very close to the origin.  I don't have time right
 now, but can you confirm that there is not a depth of recursion
 keyword like there is in 2d plotting?  I would call this a bug.

The docstring for plot3d has an (undocumented!) use of initial_depth,
but that didn't solve my problem. I just set plot_points=200 and that
gave me something good enough; switching to cylindrical coordinates also
worked, although I didn't like the look as much.



Dan

--
---  Dan Drake
-  http://mathsci.kaist.ac.kr/~drake
---


signature.asc
Description: Digital signature