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
Tried it? Did this program work on your calculator?
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.
TI-84 Plus CE Python · screen preview
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
- Choose 1 for one value: pick the function by number, 1 sin to 6 cot, then type the angle.
- Choose 2 for all six values; the program shows sin, cos, and tan, then after Enter csc, sec, and cot.
- Type angles in degrees, such as 135, or with pi, such as 5pi/3 or -pi/4. Other angles show Not standard angle.
- Choose 3 to see the coterminal angle in degrees and in pi, its quadrant or axis, and its reference angle.
- Choose 4 to review the special triangles.
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
- Find the reference angle first and the sign second. Mixing the two up is the most common mistake.
- Remember ASTC for the signs: All in Quadrant 1, Sine in 2, Tangent in 3, and Cosine in 4.
- A pi angle needs pi in it: 5pi/6 is 150 degrees, but 5/6 alone is read as 5/6 of a degree.
- Angles on an axis, such as 90 or 180, have no quadrant; the program shows axis.
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
from math import sin,cos,piN=("sin","cos","tan","csc","sec","cot")def pg():input("[enter]");print("\n"*11)def gcd(a,b):while b:a,b=b,a%breturn adef ex(p,q):g=gcd(p,q);p//=g;q//=g;n=p*q;k=1;d=2while d*d<=n:if n%(d*d):d+=1else:n//=d*d;k*=dg=gcd(k,q);k//=g;q//=gs=str(k) if n==1 else ("" if k==1 else str(k))+"sqrt("+str(n)+")"return s if q==1 else s+"/"+str(q)def ang():while 1:s=input("Angle (30 or 5pi/6)? ").lower().replace(" ","").replace("*","")try:if "pi" in s:a,b=(s+"/1").split("/")[:2];a=a.replace("pi","")v=float(a+"1" if a in("","-") else a)*180/float(b)else:v=float(s)if v-v:raise ValueErrorreturn vexcept (ValueError,ZeroDivisionError):print("Like 30 or 5pi/6")def f(x):return str(int(round(x))) if abs(x-round(x))<1e-7 else str(round(x,4))def pf(z):d=1while abs(z*d/180-round(z*d/180))>1e-7 and d<360:d+=1n=int(round(z*d/180))if d==360:return "?"if n==0:return "0"return {1:"",-1:"-"}.get(n,str(n))+"pi"+("/"+str(d) if d>1 else "")def vals(t):x=t*pi/180;r=t%180;r=min(r,180-r)S=(sin(x)>1e-9)-(sin(x)<-1e-9);C=(cos(x)>1e-9)-(cos(x)<-1e-9)if abs(r-round(r))>1e-7:return Nonev={0:(0,1),30:(1,4),45:(1,2),60:(3,4),90:(1,1)}.get(int(round(r)))if not v:return Nonep,q=v;c=q-pdef e(a,b,s):if b==0:return "undef"if s==0:return "0"return ("-" if s<0 else "")+ex(a,b)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)]def one():for i in range(6):print(i+1,N[i])n=""while len(n)!=1 or n not in "123456":n=input("Function 1-6? ").strip()n=int(n)-1;t=ang()%360;V=vals(t);print("\n"*11)print(N[n]+"("+f(t)+" deg) =");print(V[n] if V else "Not standard angle");pg()def six():t=ang()%360;V=vals(t);print("\n"*11);print("Angle =",f(t),"deg")if not V:print("Not standard angle");pg();returnfor i in range(6):print(N[i],"=",V[i])if i==2:pg()pg()def ref():t=ang()%360;r=t%180;r=min(r,180-r)q="axis" if t%90<1e-9 else "Q"+str(int(t//90)+1)print("\n"*11);print("Coterminal:",f(t),"=",pf(t));print("In:",q);print("Ref angle:",f(r),"=",pf(r));pg()def tri():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()print("EXACT TRIG VALUES\n __\n ___(o )> quack!\n \\ <_. )\n `---'\nDuckieDai (TM)\nhiddenwordscanner.com");pg()while 1:print("1 One value\n2 All 6 values\n3 Ref + coterminal\n4 Special triangles\n5 Exit")c=input("Choice? ").strip();print("\n"*11)if c=="5":breakif 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
- 1.0.0 — current version, published . Download this reviewed version
Related learning
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.