Hidden WordScanner
Private scans · No account required

DuckieDai Quick Trig Values

Type a function and an angle, such as sin pi/4, and get its exact value, or type just an angle to see all six exact values.

trigonometry · MIT License

Overview

Type a function and an angle, such as sin pi/4, and get its exact value, or type just an angle to see all six exact values.

  • Owner-tested on a TI calculator
  • Version 1.0.0
  • 1628 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.
  • Function names are sin, cos, tan, csc, sec, and cot.

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 look up exact trig values quickly

The idea

Trig values of the standard angles, the multiples of 30 and 45 degrees, come up so often that it pays to know them by sight. Each one is built from a special right triangle and a sign that depends on where the angle ends.

This program is the quick version: type the function and the angle on one line, the way you would read it aloud, and the exact value appears. Type just an angle to see all six values at once.

The formula

sin^2 + cos^2 = 1

tan = sin/cos

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

pi
a half turn, 180 degrees
undefined
a value with 0 on the bottom, such as tan 90
exact value
a fraction with square roots, such as sqrt(3)/2, in place of a rounded decimal

Using the program

Worked example

Type sin 5pi/6. The angle is 150 degrees, in Quadrant 2, with a reference angle of 30 degrees, where sine is positive.

sin 150 = sin 30 = 1/2

The program shows Angle = 150 deg and sin = 1/2.

Type pi/4 for all six values. The program shows sin = sqrt(2)/2, cos = sqrt(2)/2, and tan = 1, then csc = sqrt(2), sec = sqrt(2), and cot = 1.

Type tan 90. Cosine is 0 at 90 degrees, so the program shows tan = undefined. Type 20, which is not a standard angle, and the program shows sin = 0.342, cos = 0.9397, and tan = 0.364.

Tips and common mistakes

Where this comes up

Exact values of the standard angles are used throughout precalculus, physics vector problems, and calculus, wherever a sine or cosine of 30, 45, or 60 degrees appears.

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. def clr():print("\n"*11)
  3. def pg():input("[enter]");clr()
  4. def fmt(x):
  5. r=round(x)
  6. return str(int(r)) if abs(x-r)<1e-9 else str(round(x,4))
  7. def gcd(a,b):
  8. while b:a,b=b,a%b
  9. return a
  10. def ex(p,q):
  11. g=gcd(p,q);p//=g;q//=g;n=p*q;k=1;d=2
  12. while d*d<=n:
  13. if n%(d*d):d+=1
  14. else:n//=d*d;k*=d
  15. g=gcd(k,q);k//=g;q//=g
  16. s=str(k) if n==1 else ("" if k==1 else str(k))+"sqrt("+str(n)+")"
  17. return s if q==1 else s+"/"+str(q)
  18. def sg(x):return (x>1e-9)-(x<-1e-9)
  19. def e(p,q,s):
  20. if q==0:return "undefined"
  21. if s==0:return "0"
  22. return ("-" if s<0 else "")+ex(p,q)
  23. def go(s):
  24. s=s.replace("π","pi").replace("*","").replace(" ","");f=""
  25. for n in N:
  26. if s.startswith(n):f=n;s=s[3:].strip("()")
  27. try:
  28. if "pi" in s:
  29. a,b=(s+"/1").split("/")[:2];a=a.replace("pi","")
  30. t=float(a+"1" if a in("","-") else a)*180/float(b)
  31. else:t=float(s)
  32. if t-t:raise ValueError
  33. except (ValueError,ZeroDivisionError):print("Bad angle");return
  34. t%=360;x=t*pi/180;r=t%180;r=min(r,180-r);clr()
  35. print("Angle =",fmt(t),"deg");S=sg(sin(x));C=sg(cos(x))
  36. v=None
  37. if abs(r-round(r))<1e-6:v={0:(0,1),30:(1,4),45:(1,2),60:(3,4),90:(1,1)}.get(round(r))
  38. if not v:print("sin =",fmt(sin(x)));print("cos =",fmt(cos(x)));print("tan =",fmt(sin(x)/cos(x)));pg();return
  39. p,q=v;c=q-p
  40. L=[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)]
  41. for i in range(6):
  42. if f in("",N[i]):print(N[i],"=",L[i])
  43. if i==2 and not f:pg()
  44. pg()
  45. N=["sin","cos","tan","csc","sec","cot"]
  46. clr();print("TRIG VALUES - DuckieDai\nhiddenwordscanner.com\nType: sin pi/4 or pi/6\nBlank entry = quit")
  47. while 1:
  48. s=input("Angle? ").strip()
  49. if not s:break
  50. go(s)
Filename
TRIGV.py
Size
1628 bytes
SHA-256
eb5cca5052305e5734caa793ddf05dadae319e533768067862562eeb9d259d83

Usage

Inputs

  • An angle, such as 30 or pi/6, optionally after a function name, such as sin pi/4 or tan(pi/2)
  • Enter with nothing typed to quit

Outputs

  • The angle in degrees from 0 up to 360
  • The exact value of the function asked for, or all six, such as sqrt(3)/2 or undefined
  • For other angles, sin, cos, and tan as decimals to four places

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.

Constraints

  • Function names are sin, cos, tan, csc, sec, and cot.
  • A pi angle is typed as a fraction such as 5pi/6; inf and nan show Bad angle.

Known failures

  • For an angle that is not standard, the program shows sin, cos, and tan as decimals even when one function was asked for.

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 two changes: the website line was added to the opening screen, and inf or nan typed as an angle now shows Bad angle, 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
TRIGV — 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 TRIGV 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.