On Thu, Sep 15, 2011 at 7:10 PM, kcrisman <[email protected]> wrote:
>
>
> On Sep 15, 9:08 am, Dan Drake <[email protected]> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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^2<1e-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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org