On Jun 26, 10:53 am, kcrisman <kcris...@gmail.com> wrote:
> > ipdb> print ex
> > arctan2(real_part(y) + imag_part(x), real_part(x) - imag_part(y))
>
> > Both of these fail because Sage doesn't define a symbolic arctan2
> > function. There is instead a simple wrapper around arctan in
> > sage/functions/trig.py:
>
> > sage: arctan2(x,y)
> > arctan(x/y)
>
> > It's possible that this worked on 4.0, and I broke it with #6244.
>
> > I opened a ticket:
>
> >http://trac.sagemath.org/sage_trac/ticket/6421
>
> > I don't think I will have time to fix this in the next few days. Feel
> > free to replicate one of the Function_* classes in
> > sage/functions/trig.py to define a new symbolic function called
> > arctan2, with ginac conversion atan2.
>
> Just FYI, in 4.0.1 neither of the original plots work (something about
> calling float()...).
>
> Anyway:
>
> sage: arctan2(1,-1)
> -1/4*pi
> sage: atan2(1,-1)
> -1/4*pi
> sage: maxima.atan2(1,-1)
> 3*%pi/4
> sage: math.atan2(1,-1)
> 2.3561944901923448
> sage: SR(1).arctan2(-1)
> 3/4*pi
>
> Question: Sage's current arctan2/atan2 seems to be the only such thing
> that does NOT go from -pi to pi (because it is arctan(y/x), quadrant
> is ignored).  Is this a problem, either for fixing #6421 or for other
> reasons?  My inclination would be to have Sage's arctan2 simply call
> math.atan2 or something else, but at any rate to be consistent.

Just about have this ready.

But it does not fix the OP's problem - the messages about floats come
back.  By the way,
The following quits with a less than clear error message; it
would be nice if there was some input checking.
{{{
sage: complex_plot((x^2 + I).sqrt(), (-2, 2), (-2, 2)) # I forgot
the
real_part
}}}
should also (eventually) work fine; the original one got hung up
before the float question because of the real_part.

For whatever reason, fast_float and some other things used in plotting
don't play well with all expressions like this.  David rightly points
out that some symbolic expressions do, others need to be lambdas, and
even some don't work then:

sage: var('y')
y
sage: abs(3+2*I)
sqrt(13)
sage: f(x,y) = abs(x+I*y)
sage: plot3d(f, (x,-2,2), (y,-2,2))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call
last)

/Users/.../sage/symbolic/expression_conversions.pyc in __call__(self,
ex)
    202         except TypeError, err:
    203             if 'self must be a numeric expression' not in err:
--> 204                 raise err
    205
    206         operator = ex.operator()

TypeError: float() argument must be a string or a number

Something is going on with the fast_callable etc. that won't take
expressions like this.

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

Reply via email to