Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: Motion 10v2 released; and atan2



> From: John Pryce <j.d.pryce@xxxxxxxxxxxx>
> Subject: Re: Motion 10v2 released; and atan2
> Date: Wed, 4 Nov 2009 19:00:27 +0000
> To: stds-1788 <stds-1788@xxxxxxxxxxxxxxxxx>
> 
> Juergen and P1788
> 
> A couple of points about M0010.02.
> 
> First, if I vote Yes for M0010.10 (in George's notation) "List of  
> required functions" am I saying that I want the required functions to  
> include EXACTLY those on your list, or to include AT LEAST those on  
> the list and possibly some others?
> 
> Second, on atan2.
> On 3 Nov 2009, at 23:16, Dan Zuras Intervals wrote:
> > ...	in note 5, you say simply that atan2 is not defined
> > 	for y = 0.
> >
> > 	As atan2(x,y) is defined as the argument of the point (x,y)
> > 	in the range [-Pi,Pi] perhaps you meant to exclude x = 0
> > 	on the grounds that the call to atan(y/x) would fail in the
> > 	divide.
> and later
> > 	There is, therefore, no reason for atan2 to be undefined
> > 	anywhere except possibly at (0,0).  And it is not so much
> > 	that the argument theta is undefined at this one point as
> > 	it is ambiguous.
> 
> Two minor errors here. It's atan2(y,x) is defined as the argument  
> (=polar angle) of the point (x,y). (This is for historical reasons.)

	Oops.  I always mess that up.  Thank you, John.

> And the standard Principal Value of this multi-valued function is in  
> the range (-Pi,Pi] not [-Pi,Pi], that is, excluding x = -Pi. Thus,
>      atan2(0,-1) = Pi
> and
>      atan2(y,-1) ->  Pi (from below) as y -> 0 from above,
>      atan2(y,-1) -> -Pi (from above) as y -> 0 from below.
> Same if the -1 is replaced by any value x<0.
> 
> That is, the negative real axis is a branch cut for the Principal  
> Value, so -- obviously -- (0,0) is the end point of the branch cut.  
> Now, I am NOT sure of the wisdom of Dan's suggestion that
> > (*)	define
> > 	the interval atan2 function for intervals containing (0,0)
> > 	as [-Pi,Pi]
> Though [-Pi,Pi] is the value cset theory gives to atan2(0,0) (so as  
> cset-lover I should approve it), it has at least two nasty features  
> in a non-cset interval system.
> 
> First, as a POINT function, atan2 has no "natural" real value at  
> (0,0), so the only sensible thing is for atan2(0,0) to be undefined.  
> The "natural interval extension" (NIE) of any function f returns the  
> empty set when evaluated at a singleton interval where f is  
> undefined. Therefore, the NIE of atan2 has
>      atan2([0,0],[0,0]) = Empty.
> Thus, (*) is incompatible with the NIE of atan2.

	This is a subtlety with which I am unfamiliar.

	Do people actually try to derive point functions from
	interval valued functions by calling them with singleton
	intervals?

	If so, perhaps this notion is unwise, as you suggest.

	Perhaps returning the empty set IS the correct answer
	in this case.  Containment is maintained & one still
	gets [-Pi,Pi] for non-singleton intervals with the
	origin in their interior.

> 
> Second consider a box B = ([xlo,xhi] cross [ylo,yhi]) such that one  
> of its corners is at the origin. That means B is contained in one of  
> the four quadrants.
> If we use an atan2 based on the NIE, then
>     atan2([ylo,yhi],[xlo,xhi]) = [0,Pi/2]    if B is in the 1st  
> quadrant;
>                                  [Pi/2,Pi]   if B is in the 2nd  
> quadrant;
>                                  [-Pi,-Pi/2] if B is in the 3rd  
> quadrant;
>                                  [-Pi/2,0]   if B is in the 4th  
> quadrant;
> which I think is what we should prefer to happen.
> 
> But with Dan's suggestion, atan2([ylo,yhi],[xlo,xhi]) = [-Pi,Pi] in  
> all four cases, thus being totally uninformative.

	Now, this one I actually DID know but I was hoping not to
	have to explain it.
	
	Besides the 4 CORNER cases that John lists, there are also
	4 cases in which the origin appears on the SIDES of bounding
	box.  In 3 of these cases the answer is one of the Pi width
	intervals [-Pi,0], [-Pi/2,Pi/2], & [0,Pi].  The 4th case,
	for example for the input interval box ([-4,0],[-2,3]) wants
	to have the result interval [-Pi,-Pi/2] \union [Pi/2,Pi]
	because it crosses the branch cut but chances are that won't
	wash.  So the answer in that case probably will have to be
	[-Pi,Pi].

	Perhaps now you see why I was hoping no one would notice. :-)

	I should know better by now.

	Still, all these things are confined to the central case
	of intervals containing the origin which is the only case
	that needs to be treated as a special case.  And this will
	be true no matter how you choose to define your interval
	atan2.

> 
> I have a related query here. For any box B that straddles the branch  
> cut, peeking no matter how slightly into both the y<0 and y>=0  
> regions for some x<0, we get
>      atan2([ylo,yhi],[xlo,xhi]) = [-Pi,Pi].
> If what we REALLY want is "an interval extension of the point  
> function that is the Principal Value atan2 as above" then that is  
> fine. But for applications to do with "winding" (continuous change of  
> angle on a path that loops round the origin) one would like an atan2  
> that is about the incremental, continuous, change in angle across box  
> B -- and is not always limited to (-Pi,Pi].
> 
> Has anyone got a suitable definition? Arnold, it looks the sort of  
> thing for you. I also believe Bill Walster has published something on  
> this problem.
> 
> Best wishes
> 
> John

	This last suggestion is a good one, I think.

	It turns out you need not extend the range of results
	from (-Pi,Pi] all the way to ([-2Pi,2Pi].  Given that
	our boxes are convex rectangles aligned along the axes,
	it is sufficient to extend it to (-(3/2)Pi,(3/2)Pi].

	So, for example, that 4th case above, ([-4,0],[-2,3]),
	could be resolved as either [-(3/2)Pi,-Pi/2] or
	[Pi/2,(3/2)Pi].

	There is, of course, this sort of ambiguity in your choice
	of positive or negative branch as you begin to straddle
	the branch cut.  Which means that, whatever policy you
	adopt, there will be some point as you move an interval
	across the branch cut where you jump from one branch to
	the other.

	But I believe you'll find that is the nature of functions
	that live on more than one manifold & cannot be avoided.

	Thank you, John, for keeping me honest.

	I'll try to be more meticulous in the future. :-)

	Yours,

				Dan