[Numpy-discussion] arctan2 with complex args
Mon Apr 30 02:06:17 CDT 2007
I have two cases.
1. I need that arctan2(1+0.00000001j,1-0.000001j) gives something
close to arctan2(1,1): any decent analytic prolungation will do!
2. if someone of you is familiar with electromagnetic problems, in
particular with Snell's law, will recognize that in case of total
wavevector tangential to the interface is real, while the normal one
purely imaginary: hence the angle of diffraction is still given by
arctan2(k_tangent, k_normal), that, as in Matlab or Octave, should give pi/2
(that physically means no propagation -- total internal reflection, as
On 4/30/07, Anne Archibald <firstname.lastname@example.org> wrote:
> On 29/04/07, David Goldsmith <David.L.Goldsmith@noaa.gov> wrote:
> > Far be it from me to challenge the mighty Wolfram, but I'm not sure that
> > using the *formula* for calculating the arctan of a *single* complex
> > argument from its real and imaginary parts makes any sense if x and/or y
> > are themselves complex (in particular, does Lim(formula), as the
> > imaginary part of complex x and/or y approaches zero, approach
> > arctan2(realpart(x), realpart(y)?) - without going to the trouble to
> > determine it one way or another, I'd be surprised if "their"
> > continuation of the arctan2 function from RxR to CxC is (a. e.)
> > continuous (not that I know for sure that "mine" is...).
> Well, yes, in fact, theirs is continuous, and in fact analytic, except
> along the branch cuts (which they describe). Formulas almost always
> yield continuous functions apart from easy-to-recognize cases. (This
> can be made into a specific theorem if you're determined.)
> Their formula is a pretty reasonable choice, given that it's not at
> all clear what arctan2 should mean for complex arguments. But for
> numpy it's tempting to simply throw an exception (which would catch
> quite a few programmer errors that would otherwise manifest as
> nonsense numbers). Still, I suppose defining it on the complex numbers
> in a way that is continuous close to the real plane allows people to
> put in almost-real complex numbers and get out pretty much the answer
> they expect. Does anyone have an application for which they need
> arctan2 of, say, (1+i,1-i)?
> Numpy-discussion mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion