Hidden WordScanner
Private scans · No account required

DuckieDai Reference Angles

Find the quadrant and the reference angle of any angle, in degrees or as a fraction of pi, including the coterminal angle between 0 and 2pi.

trigonometry · MIT License

Overview

Find the quadrant and the reference angle of any angle, in degrees or as a fraction of pi, including the coterminal angle between 0 and 2pi.

  • Owner-tested on a TI calculator
  • Version 1.0.0
  • 1894 bytes
  • No imports

Before you run it

  • TI-84 Plus CE Python · No calculator OS or Python App version has been verified.
  • TI Connect CE .py transfer to the Python App; the owner's transfer details were not recorded
  • An angle in degrees can be any number, such as -150 or 37.5.
  • A pi angle is typed as a whole-number numerator and denominator, such as 17 and 12 for 17pi/12.
  • Whole numbers only for a pi numerator and denominator; the denominator cannot be 0.

Try the DuckieDai calculator screen

Follow the program's prompts and result flow before downloading.

JavaScript is required for the optional browser simulation. Source viewing and downloading remain available without it.

Simulation boundary: This preview uses a reviewed browser adapter. It does not execute the downloaded Python and does not prove TI-Python or calculator compatibility.

Learn the math

How to find the quadrant and reference angle of any angle

The idea

Every angle, however large or negative, ends in one of the four quadrants or on an axis. Adding or taking away full turns does not change where it ends, so the first step is to bring the angle between 0 and 360 degrees, or 0 and 2pi.

The reference angle is the acute angle between where the angle ends and the x-axis. It is the angle you look up in the special triangles; the quadrant then tells you each sign.

The formula

coterminal: add or take away 360 degrees, or 2pi, until 0 <= angle < 360

reference angle: Q I t, Q II 180 - t, Q III t - 180, Q IV 360 - t

in pi: Q I t, Q II pi - t, Q III t - pi, Q IV 2pi - t

Q I to Q IV
the four quadrants, numbered counterclockwise from the top right
coterminal angle
an angle that ends in the same place after whole turns
ON AXIS
an angle that ends on an axis, such as 90 or pi, which is in no quadrant

Using the program

Worked example

Find the reference angle of -150 degrees. Choose 1 and type -150. Adding 360 gives 210, which is in Quadrant 3.

210 - 180 = 30

The program shows Q III REF: 30 deg.

Find the reference angle of 17pi/12. Choose 2 and type 17, then 12. 17pi/12 is between pi and 3pi/2, so it is in Quadrant 3, and 17pi/12 - pi = 5pi/12. The program shows COTERM: 17pi/12 and Q III REF: 5pi/12.

Try -7pi/4: type -7 and 4. Adding 2pi gives pi/4, in Quadrant 1. The program shows COTERM: pi/4 and Q I REF: pi/4.

Tips and common mistakes

Where this comes up

Reference angles open the unit circle unit of precalculus and trigonometry, and every later exact-value and graphing question relies on them.

Exact reviewed bytes

Source code

Download .py

View source below, copy it when JavaScript is available, or download the exact .py bytes.

  1. # DuckieDai(TM) Reference Angles
  2. # TI-84 Plus CE Python
  3. def gcd(a,b):
  4. a=abs(a);b=abs(b)
  5. while b:a,b=b,a%b
  6. return a
  7. def fmt(x):
  8. r=round(x,6)
  9. return str(int(r)) if r==int(r) else str(r)
  10. def inp(p):
  11. while 1:
  12. try:return int(input(p))
  13. except ValueError:print('Whole number please')
  14. def show(n,d):
  15. if n==0:return '0'
  16. g=gcd(n,d);n//=g;d//=g
  17. if d==1:return 'pi' if n==1 else str(n)+'pi'
  18. return ('pi' if n==1 else str(n)+'pi')+'/'+str(d)
  19. def ref(a,full,half):
  20. # a is normalized to one revolution
  21. if a==0 or a==half or a==full//2 or a==full-half:
  22. return 0,'AXIS'
  23. if a<half:return a,'I'
  24. if a<full//2:return full//2-a,'II'
  25. if a<full-half:return a-full//2,'III'
  26. return full-a,'IV'
  27. def main():
  28. print('DuckieDai(TM)')
  29. print('REFERENCE ANGLES')
  30. print(' __(o )>')
  31. print('hiddenwordscanner.com')
  32. while 1:
  33. print('1 Degrees 2 Pi fraction')
  34. print('3 Exit')
  35. c=input('Choice? ').strip()
  36. if c=='3':break
  37. if c=='1':
  38. while 1:
  39. try:
  40. v=float(input('Angle degrees? '))
  41. if v-v==0:break
  42. except ValueError:pass
  43. print('Number please')
  44. a=v%360
  45. if a in (0,90,180,270):print('ON AXIS')
  46. elif a<90:print('Q I REF:',fmt(a),'deg')
  47. elif a<180:print('Q II REF:',fmt(180-a),'deg')
  48. elif a<270:print('Q III REF:',fmt(a-180),'deg')
  49. else:print('Q IV REF:',fmt(360-a),'deg')
  50. elif c=='2':
  51. n=inp('Pi numerator? ')
  52. d=inp('Pi denominator? ')
  53. if d==0:print('Denominator cannot be 0')
  54. else:
  55. if d<0:n=-n;d=-d
  56. a=n%(2*d)
  57. print('COTERM:',show(a,d))
  58. # Avoid floats: work in half-pi units with doubled numerator
  59. x=2*a
  60. if x in (0,d,2*d,3*d):print('ON AXIS')
  61. elif x<d:print('Q I REF:',show(a,d))
  62. elif x<2*d:print('Q II REF:',show(d-a,d))
  63. elif x<3*d:print('Q III REF:',show(a-d,d))
  64. else:print('Q IV REF:',show(2*d-a,d))
  65. else:print('Choose 1, 2, or 3')
  66. input('Enter to continue ')
  67. print('\n'*5)
  68. main()
Filename
REFANGLE.py
Size
1894 bytes
SHA-256
ba824348a34543bc762fc1f532d781560d3d06fd62b74458ba07a1665bad2d79

Usage

Inputs

  • A menu choice: 1 degrees, 2 pi fraction, 3 exit
  • An angle in degrees, or a pi numerator and denominator

Outputs

  • The quadrant, Q I to Q IV, and the reference angle, or ON AXIS
  • For a pi angle, the coterminal angle between 0 and 2pi first

Units: Degrees, or multiples of pi.

Assumptions and limitations

Assumptions

  • An angle in degrees can be any number, such as -150 or 37.5.
  • A pi angle is typed as a whole-number numerator and denominator, such as 17 and 12 for 17pi/12.

Constraints

  • Whole numbers only for a pi numerator and denominator; the denominator cannot be 0.
  • inf and nan are asked for again.

Known failures

  • Degree answers are rounded to 6 decimal places.
  • An angle that ends on an axis shows ON AXIS, with no reference angle.

Compatibility and review

Review status
Owner-tested on a TI calculator
Tested on
Owner reports personally running this program on a TI-84 Plus CE Python calculator; the test date, OS version, and Python App version were not recorded
What happened
Owner reported pass on the calculator for the owner's original. For publication the opening screen adds hiddenwordscanner.com, inf and nan are asked for again instead of giving nan, a degree answer such as 30.0 shows as 30, and a menu choice may have spaces around it. This exact file has not yet been rerun on a calculator.
Dependencies
No imports
Suggested calculator name
REFANGLE — you can give it another valid, unique name when you transfer it
Desktop test cases
Not available for this interactive-only source

This exact source auto-launches an interactive calculator session, so compatibility evidence comes from the recorded physical-device review rather than an importable desktop fixture.

Transfer and launch

Download the .py file, send it to your calculator with TI Connect CE as REFANGLE or another name, then open the Python App and try the worked example on this page first. This release has no verified calculator OS or Python App version; treat transfer and execution as unverified until independently tested.

Full installation and troubleshooting guide. Check your teacher's or exam's rules before using any program.

Version history

Did a DuckieDai program help with your homework? Every program here is free. If you would like to say thanks, you can leave a tip on Cash App ($duckiedai214) or read what tips pay for.

Independent compatibility resource: Hidden Word Scanner is independent and is not affiliated with or endorsed by Texas Instruments. TI product names describe compatibility only.

Action-count privacy: Successful downloads, preview starts, and preview completions increment same-origin aggregate counters, and so does a Yes or No answer about whether the program worked. Your browser notes that you answered; that note is never sent to the site. No entered values, source text, IP address, account, cookie, device identifier, or fingerprint is stored with these counts.