Hidden WordScanner
Private scans · No account required

DuckieDai Trig Identities

Review 19 basic trig identities, rewrite a function with its cofunction, and check any identity numerically at an angle you choose.

trigonometry · MIT License

Overview

Review 19 basic trig identities, rewrite a function with its cofunction, and check any identity numerically at an angle you choose.

  • Owner-tested on a TI calculator
  • Version 1.0.0
  • 3417 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, so the cofunction rules use 90-x.
  • A check passes when the two sides agree to about seven significant digits.
  • A pi angle is typed as a fraction such as 5pi/6; inf, nan, and angles beyond 1e300 degrees are asked for again.

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 the basic trig identities fit together

The idea

A trig identity is an equation that is true for every angle where both sides are defined. A small set of basic identities does most of the work in simplifying expressions and proving harder identities.

The basic ones come in five families: reciprocal identities, such as csc = 1/sin; quotient identities, such as tan = sin/cos; Pythagorean identities, from sin^2 + cos^2 = 1; even-odd identities, such as cos(-x) = cos x; and cofunction identities, such as sin(90 - x) = cos x.

The formula

sin(x)^2 + cos(x)^2 = 1

1 + tan(x)^2 = sec(x)^2

1 + cot(x)^2 = csc(x)^2

sin(90 - x) = cos(x)

reciprocal
csc, sec, and cot are 1 over sin, cos, and tan
cofunction
sine and cosine, tangent and cotangent, and secant and cosecant swap when the angle is replaced by 90 - x, which is pi/2 - x
MATCH
the two sides agree to about seven significant digits at the angle you chose

Using the program

Worked example

Rewrite sin(pi/6) with a cofunction. Choose 2, then 1 for sin, and type pi/6.

sin(pi/6) = cos(pi/2 - pi/6) = cos(pi/3)

The program shows sin(pi/6) = and cos(pi/3). With degrees, tan 20 becomes cot(70).

Check 1 + tan(x)^2 = sec(x)^2 at 60 degrees. Choose 3, type 7, then 60. tan 60 is sqrt(3), so the left side is 1 + 3, and sec 60 is 2, so the right side is 4. The program shows Left = 4, Right = 4, and MATCH.

Check 1/tan(x) = cot(x) at 90 degrees. tan 90 has 0 on the bottom, so the program shows Undefined.

Tips and common mistakes

Where this comes up

Trig identities fill the analytic trigonometry unit of precalculus and are used again in calculus to simplify integrals and derivatives.

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 as _s,cos as _c,pi
  2. R=("1/sin(x)=csc(x)","1/cos(x)=sec(x)","1/tan(x)=cot(x)",
  3. "sin(x)/cos(x)=tan(x)","cos(x)/sin(x)=cot(x)",
  4. "sin(x)^2+cos(x)^2=1","1+tan(x)^2=sec(x)^2","1+cot(x)^2=csc(x)^2",
  5. "csc(x)^2-cot(x)^2=1","sec(x)^2-tan(x)^2=1",
  6. "sin(-x)=-sin(x)","cos(-x)=cos(x)","tan(-x)=-tan(x)",
  7. "sin(90-x)=cos(x)","cos(90-x)=sin(x)","tan(90-x)=cot(x)",
  8. "sec(90-x)=csc(x)","csc(90-x)=sec(x)","cot(90-x)=tan(x)")
  9. def clr():print("\n"*11)
  10. def pg():input("[enter]");clr()
  11. def ask(p):
  12. s=input(p).strip()
  13. if not s:raise KeyError
  14. return s
  15. def pick(p,n):
  16. while 1:
  17. try:
  18. x=int(ask(p))
  19. if 1<=x<=n:return x
  20. except ValueError:pass
  21. print("Pick 1-"+str(n))
  22. def fmt(x):
  23. r=round(x)
  24. return str(int(r)) if abs(x-r)<1e-9 else str(round(x,6))
  25. def ang(p):
  26. while 1:
  27. s=ask(p).replace("π","pi").replace(" ","").replace("*","")
  28. try:
  29. if "pi" in s:
  30. a,b=(s+"/1").split("/")[:2];a=a.replace("pi","")
  31. v=float(a+"1" if a in("","-") else a)*180/float(b),1
  32. else:v=float(s),0
  33. if v[0]-v[0] or abs(v[0])>1e300:raise ValueError
  34. return v
  35. except (ValueError,ZeroDivisionError):print("Bad angle")
  36. def T(f,d):
  37. v=f(d*pi/180);return 0 if abs(v)<1e-12 else v
  38. S=lambda d:T(_s,d)
  39. C=lambda d:T(_c,d)
  40. G={"sin":S,"cos":C,"tan":lambda d:S(d)/C(d),"csc":lambda d:1/S(d),
  41. "sec":lambda d:1/C(d),"cot":lambda d:C(d)/S(d)}
  42. sin,cos,tan,csc,sec,cot=(G[n] for n in ("sin","cos","tan","csc","sec","cot"))
  43. # Each rule in R as a pair of functions: the left side and the right side.
  44. Q=((lambda x:1/sin(x),lambda x:csc(x)),(lambda x:1/cos(x),lambda x:sec(x)),
  45. (lambda x:1/tan(x),lambda x:cot(x)),(lambda x:sin(x)/cos(x),lambda x:tan(x)),
  46. (lambda x:cos(x)/sin(x),lambda x:cot(x)),(lambda x:sin(x)**2+cos(x)**2,lambda x:1),
  47. (lambda x:1+tan(x)**2,lambda x:sec(x)**2),(lambda x:1+cot(x)**2,lambda x:csc(x)**2),
  48. (lambda x:csc(x)**2-cot(x)**2,lambda x:1),(lambda x:sec(x)**2-tan(x)**2,lambda x:1),
  49. (lambda x:sin(-x),lambda x:-sin(x)),(lambda x:cos(-x),lambda x:cos(x)),
  50. (lambda x:tan(-x),lambda x:-tan(x)),(lambda x:sin(90-x),lambda x:cos(x)),
  51. (lambda x:cos(90-x),lambda x:sin(x)),(lambda x:tan(90-x),lambda x:cot(x)),
  52. (lambda x:sec(90-x),lambda x:csc(x)),(lambda x:csc(90-x),lambda x:sec(x)),
  53. (lambda x:cot(90-x),lambda x:tan(x)))
  54. def show(i):print(i+1,R[i])
  55. def lib():
  56. for i in range(19):
  57. show(i)
  58. if i%8==7:pg()
  59. pg()
  60. def pf(z):
  61. d=1
  62. while abs(z*d/180-round(z*d/180))>1e-9 and d<360:d+=1
  63. n=round(z*d/180)
  64. if n==0:return "0"
  65. return {1:"",-1:"-"}.get(n,str(n))+"pi"+("/"+str(d) if d>1 else "")
  66. def cof():
  67. N=("sin","cos","tan","csc","sec","cot");O=("cos","sin","cot","sec","csc","tan")
  68. for i in range(6):print(i+1,N[i])
  69. f=pick("Function? ",6)-1;x,p=ang("Angle? ");clr()
  70. z=90-x;h=pf if p else fmt
  71. print(N[f]+"("+h(x)+") =");print(O[f]+"("+h(z)+")");pg()
  72. def chk():
  73. k=pick("Rule # (1-19)? ",19)-1;show(k);l,r=Q[k]
  74. x=ang("Angle? ")[0];clr();show(k)
  75. try:
  76. L=l(x);V=r(x)
  77. print("Left =",fmt(L));print("Right =",fmt(V))
  78. print("MATCH" if abs(L-V)<1e-7*max(1,abs(L)) else "NO MATCH")
  79. except ZeroDivisionError:print("Undefined")
  80. pg()
  81. def main():
  82. clr();print("TRIG IDENTITIES\n __\n ___(o )> quack!\n \\ <_. )\n `---'")
  83. print("DuckieDai (TM)\nhiddenwordscanner.com\nBlank entry = back");pg()
  84. while 1:
  85. print("TRIG IDENTITIES\n1 All 19 Rules\n2 Cofunction Angle\n3 Numeric Check\n4 Exit")
  86. try:
  87. c=pick("Choice? ",4);clr()
  88. if c==4:break
  89. (lib,cof,chk)[c-1]()
  90. except KeyError:clr()
  91. main()
Filename
TRIGID.py
Size
3417 bytes
SHA-256
0955b601b4f6fa149e2621188ddbc508726f80bc03f9e45906b6486dbd40076c

Usage

Inputs

  • A menu choice: 1 all 19 rules, 2 cofunction angle, 3 numeric check, 4 exit
  • For a cofunction, the function: 1 sin to 6 cot, and an angle
  • For a check, the rule number from 1 to 19 and an angle
  • Enter with nothing typed goes back to the menu

Outputs

  • The reciprocal, quotient, Pythagorean, even-odd, and cofunction identities, eight per screen
  • The cofunction form, such as sin(pi/6) = cos(pi/3)
  • The left and right side of an identity at your angle, and MATCH, NO MATCH, or Undefined

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

Assumptions and limitations

Assumptions

  • An angle without pi is read as degrees, so the cofunction rules use 90-x.
  • A check passes when the two sides agree to about seven significant digits.

Constraints

  • A pi angle is typed as a fraction such as 5pi/6; inf, nan, and angles beyond 1e300 degrees are asked for again.

Known failures

  • A numeric check tests one angle, so a MATCH shows the rule holds there, not that it is proved.

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 angle prompt now asks again when inf, nan, or an angle beyond 1e300 degrees is typed, where the original stopped with an error, and the numeric check now works each rule out with a fixed pair of functions instead of running its text through Python's eval. The results are the same. Every other step is unchanged; this exact file has not yet been rerun on a calculator.
Dependencies
math
Suggested calculator name
TRIGID — 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 TRIGID 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.