Function Repository Resource:

ReferenceAngleDegree

Source Notebook

Compute the reference angle to a given input angle using degrees

Contributed by: Paco Jain (Wolfram Research)

ResourceFunction["ReferenceAngleDegree"][θ]

gives the reference angle to the angle θ in degrees.

Details and Options

ResourceFunction["ReferenceAngleDegree"] takes all angles to be measured in degrees.
The reference angle to a given input angle θ is defined geometrically as follows:
First, start with a ray having its tail at the origin and pointing along the positive x-axis.
Next, rotate this ray counterclockwise about the origin by the angle θ.
Finally, the reference angle to θ is then the smallest positive angle that this ray makes with the x-axis (either positive or negative).
The reference angle of θ in terms of θ can be found via the formula .

Examples

Basic Examples (3) 

Compute a reference angle:

In[1]:=
ResourceFunction["ReferenceAngleDegree"][30]
Out[1]=

Compute the reference angle for angles lying in each of the four quadrants:

In[2]:=
angleList = Table[30 + n 90, {n, 0, 3}]
Out[2]=
In[3]:=
ResourceFunction["ReferenceAngleDegree"] /@ angleList
Out[3]=

Plot the reference angle function for all angles between 0 and 360 degrees:

In[4]:=
Plot[ResourceFunction["ReferenceAngleDegree"][theta], {theta, 0, 360}]
Out[4]=

Scope (3) 

ReferenceAngleDegree works directly on Quantity expressions with units of "Radians":

In[5]:=
ResourceFunction["ReferenceAngleDegree"][
  Quantity[110, "AngularDegree"]] // N
Out[5]=

ReferenceAngleDegree works directly on DMS lists of the type returned by DMSList:

In[6]:=
dmsList = DMSList[120.42]
Out[6]=
In[7]:=
ResourceFunction["ReferenceAngleDegree"][dmsList]
Out[7]=

ReferenceAngleDegree works directly on DMS strings of the type returned by DMSString:

In[8]:=
dmsString = DMSString[120.42]
Out[8]=
In[9]:=
ResourceFunction["ReferenceAngleDegree"][dmsString]
Out[9]=

Properties and Relations (2) 

ReferenceAngleDegree will remain unevaluated for non-numeric input:

In[10]:=
ResourceFunction["ReferenceAngleDegree"][a]
Out[10]=

ReferenceAngleDegree throws away the sign of its input:

In[11]:=
r = RandomReal[{-2 Pi, 2 Pi}];
ResourceFunction["ReferenceAngleDegree"][-r] === ResourceFunction["ReferenceAngleDegree"][r]
Out[12]=

Version History

  • 1.0.0 – 05 July 2019

Related Resources

License Information