Hidden WordScanner
Private scans · No account required

DuckieDai Exact Trig Values

Give the exact value of one trig function or all six for a standard angle, find an angle's reference and coterminal angles, and review the special right triangles.

trigonometry · MIT License

Overview

Give the exact value of one trig function or all six for a standard angle, find an angle's reference and coterminal angles, and review the special right triangles.

  • Owner-tested on a TI calculator
  • Version 1.0.0
  • 2562 bytes
  • Uses math

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 without pi is read as degrees.
  • Exact values are given for multiples of 30 and 45 degrees, the angles of the special triangles.
  • Other angles show Not standard angle.

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 exact trig values with reference angles

The idea

Every angle can be traced back to an acute angle between it and the x-axis, called the reference angle. The six trig values of an angle are the same as those of its reference angle, except that some signs change, depending on the quadrant the angle ends in.

So to know the exact values of every multiple of 30 and 45 degrees, you only need the special right triangles: the 30-60-90 triangle with sides 1, sqrt(3), and 2, and the 45-45-90 triangle with sides 1, 1, and sqrt(2).

The formula

reference angle: Q1 t, Q2 180 - t, Q3 t - 180, Q4 360 - t

sin 30 = 1/2, sin 45 = sqrt(2)/2, sin 60 = sqrt(3)/2

csc = 1/sin, sec = 1/cos, cot = 1/tan

Q1 to Q4
the four quadrants, numbered counterclockwise from the top right
coterminal
the same angle after whole turns are added or taken away; the program uses the one from 0 up to 360 degrees
undef
a value with 0 on the bottom, such as tan 90

Using the program

Worked example

Find cos 135. Choose 1, then 2 for cos, and type 135. The angle is in Quadrant 2, its reference angle is 45 degrees, and cosine is negative there.

cos 135 = -cos 45 = -sqrt(2)/2

The program shows cos(135 deg) = and then -sqrt(2)/2.

Find all six values for 5pi/3. Choose 2 and type 5pi/3. The program shows Angle = 300 deg, then sin = -sqrt(3)/2, cos = 1/2, tan = -sqrt(3), and after Enter csc = -2sqrt(3)/3, sec = 2, and cot = -sqrt(3)/3.

Where does -150 degrees end? Choose 3 and type -150. Adding a full turn gives 210, so the program shows Coterminal: 210 = 7pi/6, In: Q3, and Ref angle: 30 = pi/6.

Tips and common mistakes

Where this comes up

Reference angles and exact values are taught early in the trigonometry unit of precalculus and algebra 2, and they are expected without a calculator on many tests.

Exact reviewed bytes

Source code

Download .py

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

  1. from math import sin,cos,pi
  2. N=("sin","cos","tan","csc","sec","cot")
  3. def pg():input("[enter]");print("\n"*11)
  4. def gcd(a,b):
  5. while b:a,b=b,a%b
  6. return a
  7. def ex(p,q):
  8. g=gcd(p,q);p//=g;q//=g;n=p*q;k=1;d=2
  9. while d*d<=n:
  10. if n%(d*d):d+=1
  11. else:n//=d*d;k*=d
  12. g=gcd(k,q);k//=g;q//=g
  13. s=str(k) if n==1 else ("" if k==1 else str(k))+"sqrt("+str(n)+")"
  14. return s if q==1 else s+"/"+str(q)
  15. def ang():
  16. while 1:
  17. s=input("Angle (30 or 5pi/6)? ").lower().replace(" ","").replace("*","")
  18. try:
  19. if "pi" in s:
  20. a,b=(s+"/1").split("/")[:2];a=a.replace("pi","")
  21. v=float(a+"1" if a in("","-") else a)*180/float(b)
  22. else:v=float(s)
  23. if v-v:raise ValueError
  24. return v
  25. except (ValueError,ZeroDivisionError):print("Like 30 or 5pi/6")
  26. def f(x):return str(int(round(x))) if abs(x-round(x))<1e-7 else str(round(x,4))
  27. def pf(z):
  28. d=1
  29. while abs(z*d/180-round(z*d/180))>1e-7 and d<360:d+=1
  30. n=int(round(z*d/180))
  31. if d==360:return "?"
  32. if n==0:return "0"
  33. return {1:"",-1:"-"}.get(n,str(n))+"pi"+("/"+str(d) if d>1 else "")
  34. def vals(t):
  35. x=t*pi/180;r=t%180;r=min(r,180-r)
  36. S=(sin(x)>1e-9)-(sin(x)<-1e-9);C=(cos(x)>1e-9)-(cos(x)<-1e-9)
  37. if abs(r-round(r))>1e-7:return None
  38. v={0:(0,1),30:(1,4),45:(1,2),60:(3,4),90:(1,1)}.get(int(round(r)))
  39. if not v:return None
  40. p,q=v;c=q-p
  41. def e(a,b,s):
  42. if b==0:return "undef"
  43. if s==0:return "0"
  44. return ("-" if s<0 else "")+ex(a,b)
  45. return [e(p,q,S),e(c,q,C),e(p,c,S*C),e(q,p,S),e(q,c,C),e(c,p,S*C)]
  46. def one():
  47. for i in range(6):print(i+1,N[i])
  48. n=""
  49. while len(n)!=1 or n not in "123456":n=input("Function 1-6? ").strip()
  50. n=int(n)-1;t=ang()%360;V=vals(t);print("\n"*11)
  51. print(N[n]+"("+f(t)+" deg) =");print(V[n] if V else "Not standard angle");pg()
  52. def six():
  53. t=ang()%360;V=vals(t);print("\n"*11);print("Angle =",f(t),"deg")
  54. if not V:print("Not standard angle");pg();return
  55. for i in range(6):
  56. print(N[i],"=",V[i])
  57. if i==2:pg()
  58. pg()
  59. def ref():
  60. t=ang()%360;r=t%180;r=min(r,180-r)
  61. q="axis" if t%90<1e-9 else "Q"+str(int(t//90)+1)
  62. print("\n"*11);print("Coterminal:",f(t),"=",pf(t));print("In:",q);print("Ref angle:",f(r),"=",pf(r));pg()
  63. def tri():
  64. print("30-60-90: 1, sqrt(3), 2\n 1 is across from 30\n 2 is the hypotenuse\n45-45-90: 1, 1, sqrt(2)\n sqrt(2) is the hyp");pg()
  65. print("EXACT TRIG VALUES\n __\n ___(o )> quack!\n \\ <_. )\n `---'\nDuckieDai (TM)\nhiddenwordscanner.com");pg()
  66. while 1:
  67. print("1 One value\n2 All 6 values\n3 Ref + coterminal\n4 Special triangles\n5 Exit")
  68. c=input("Choice? ").strip();print("\n"*11)
  69. if c=="5":break
  70. if c in("1","2","3","4"):(one,six,ref,tri)[int(c)-1]()
Filename
TRIGEXCT.py
Size
2562 bytes
SHA-256
66d9ce7ffa7933676b83d4782e352a2aaccef6e208faf0e44c8e00f4880925d9

Usage

Inputs

  • A menu choice: 1 one value, 2 all six values, 3 reference and coterminal angle, 4 special triangles, 5 exit
  • For one value, the function: 1 sin, 2 cos, 3 tan, 4 csc, 5 sec, 6 cot
  • An angle in degrees, such as 30, or with pi, such as 5pi/6

Outputs

  • Exact values such as sqrt(3)/2, -1, or undef
  • The coterminal angle from 0 up to 360 degrees in degrees and in pi, its quadrant or axis, and its reference angle
  • The side ratios of the 30-60-90 and 45-45-90 triangles

Units: Angles in degrees or as a multiple of pi.

Assumptions and limitations

Assumptions

  • An angle without pi is read as degrees.
  • Exact values are given for multiples of 30 and 45 degrees, the angles of the special triangles.

Constraints

  • Other angles show Not standard angle.
  • A pi angle is typed as a fraction such as 5pi/6 or -pi/4; inf and nan are asked for again.

Known failures

  • A reference angle that is not a whole fraction of pi within 360 parts shows ? for its pi form.
  • Angles are reduced to 0 up to 360 degrees first, so the program shows 330 deg for -30.

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 before the angle prompt was changed to ask again when inf or nan is typed, where the original stopped with an error. Every other step is unchanged; this exact file has not yet been rerun on a calculator.
Dependencies
math
Suggested calculator name
TRIGEXCT — 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 TRIGEXCT 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.