Re: [sage-support] complex parts

2011-09-15 Thread Anton Sherwood
On 2011-9-14 23:35, Robert Bradshaw wrote: ... Otherwise, z.real, z.imag is probably going to be as fast as you can get, and there's no need to define a function, you could just write sage: a = complex(3,4) sage: x, y = a.real, a.imag For trivial cases, yeah, but consider parametric_p

Re: [sage-support] complex parts

2011-09-14 Thread Robert Bradshaw
On Wed, Sep 14, 2011 at 7:57 PM, Anton Sherwood wrote: > Is there a function inverse to complex(x,y), > such that (x,y) == ReIm(complex(x,y)) ? > > I could obviously write one -- def ReIm(z): return (z.real,z.imag) -- but > presumably a library function if it exists would be speedier. For Sage's

[sage-support] complex parts

2011-09-14 Thread Anton Sherwood
Is there a function inverse to complex(x,y), such that (x,y) == ReIm(complex(x,y)) ? I could obviously write one -- def ReIm(z): return (z.real,z.imag) -- but presumably a library function if it exists would be speedier. -- Anton Sherwood *\\* www.bendwavy.org *\\* www.zazzle.com/tamfang -- T