On Nov 10, 2009, at 12:34 PM, kcrisman wrote:

> In 4.2.1.alpha0:
>
> sage: f(x,y)=ln(x)
> sage: P=plot3d(f,(x,0,1),(y,0,1))
> sage: P
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (16, 0))
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call
> last)
> <snip a lot>
> ValueError: math domain error
>
> Switch to (x,0.1,1), and all is well.  I am pretty sure the problem is
> that line 404 in plot/plot3d/parametric_surface.pyx doesn't have an
> exception handler for log(0) or other such nan type values:
>
> sage: math.log(0)
> <snip>
> ValueError: math domain error
>
> But in the plotting context, it's silly not to just ignore this; we
> check for things like this all the time:
> sage: plot(log,0,1)
> <works fine>
>
> Unfortunately, I don't know enough about C/Cython to fix this.  For
> now it would probably be enough to fix it for the z variable.  This is
> now #7423.  Any takers, or hints as to how to fix this?  Thanks!

As a first pass, just surround the evaluation with a try/except, as  
you would in Python. Perhaps you could set the value in the except  
clause to nan.

- Robert



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to