I have a list of phase angles, all of which are less than 0. I want to apply some sort of transformation, to keep them in the range -180 to + 180 degrees, by adding 360 degrees where necessary. So for example, if these where the phase angles in degrees
phases = Table[-45 n , {n, 0, 6}]
{0, -45, -90, -135, -180, -225, -270}
I want the set
{0, -45, -90, -135, -180, 135, 90}
where 360 was added to -225 to get 135, and 360 was added to -270 to get 90.
I have two questions:
-
How do I solve the simple case where only 360 degrees may needs to be added - never more than 360? I’d appreciate an example, even though the next question would solve this problem too.
-
How, if the need arose, which I can’t see happening in the short term, could I add or subtract the appropriate number of 360’s, so that any angle in the range -Infinity to +Infinity would always be transformed to the range -180 to +180?
I have access to Mathematica 7, but nothing later.