[email protected] wrote:
> This does not produce error, but probably is not what you want.
> 
> y=var('y')
> b = plot(sqrt(3)*x,(0,4))
> f(z) = 4*log(z^3)-2*log(z^3-8)
> g = lambda x,y: imag(f(x+y*I)) if y < sqrt(3)*x else float('nan')
> a = contour_plot(g(x,y),(x,0,4),(y,0,4),fill=False,contours=30)
> c = a + b
> c
> 

g(x,y) isn't correct, as it is then getting the result from g before 
ever putting in numbers:

sage: g(x,y)
nan


Here is the problem, narrowed down a bit:


sage: log(SR(float(-7.0)))
Traceback (most recent call last):
...
ValueError: math domain error
sage: log(float(-7.0))
1.94591014906 + 3.14159265359*I
sage: log(RR(-7.0))
1.94591014905531 + 3.14159265358979*I
sage: log(SR(-7))
I*pi + log(7)
sage: log(SR(-7.0))
1.94591014905531 + 3.14159265358979*I


Note the first answer, a symbolic-wrapped float, gave a domain error. 
Is that version calling some C library that doesn't deal with complex 
numbers?  The floating point numbers in this problem appear because we 
use hardware floats in plotting for speed.

Burcin, do you see what is going on?  Do you know how to fix it?

Thanks,

Jason

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