Hidden WordScanner
Private scans · No account required

DuckieDai Inverse Trig

Find the angle for sin^-1, cos^-1, or tan^-1 of a value such as sqrt3/2, in radians as a multiple of pi and in degrees, and work out compositions such as cos(sin^-1(3/5)) exactly with the reference triangle.

trigonometry · MIT License

Overview

Find the angle for sin^-1, cos^-1, or tan^-1 of a value such as sqrt3/2, in radians as a multiple of pi and in degrees, and work out compositions such as cos(sin^-1(3/5)) exactly with the reference triangle.

  • Owner-tested on a TI calculator
  • Version 1.0.0
  • 2723 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
  • Values are typed as numbers, fractions, or square roots, such as 1/2, -sqrt3/2, or sqrt(2)/2.
  • Answers use the principal ranges: sin^-1 and tan^-1 from -pi/2 to pi/2, and cos^-1 from 0 to pi.
  • sin^-1 and cos^-1 need a value from -1 to 1.

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 inverse trig values and evaluate expressions like cos(sin^-1(3/5))

The idea

An inverse trig function runs a trig function backwards: sin^-1(x) is the angle whose sine is x. Many angles share the same sine, so each inverse gives just one answer, from its principal range. sin^-1 and tan^-1 answer between -pi/2 and pi/2, and cos^-1 between 0 and pi.

For an expression such as cos(sin^-1(3/5)), you do not need the angle at all. sin^-1(3/5) is an angle whose opposite side is 3 and hypotenuse 5, so draw that right triangle, find the third side with the Pythagorean theorem, and read the outer function off the triangle.

The formula

sin^-1: -pi/2 to pi/2, cos^-1: 0 to pi, tan^-1: -pi/2 to pi/2

sin^-1(x): opp = x, hyp = 1, adj = sqrt(1 - x^2)

tan^-1(x): opp = x, adj = 1, hyp = sqrt(1 + x^2)

principal range
the one interval of angles an inverse function answers in
reference triangle
the right triangle built from the value, with its sides scaled to whole numbers when they can be
QII, QIV
where a negative value's angle ends: cos^-1 of a negative is in Quadrant II, sin^-1 and tan^-1 of a negative in Quadrant IV

Using the program

Worked example

Find sin^-1(sqrt(3)/2). Choose 1, then 1 for sin^-1, and type sqrt3/2. The sine of 60 degrees is sqrt(3)/2, and 60 degrees is in the range.

The program shows sin^-1(sqrt(3)/2), = pi/3 rad, and = 60 deg.

cos(sin^-1(3/5)): opp = 3, hyp = 5, adj = sqrt(5^2 - 3^2) = 4, cos = adj/hyp = 4/5

Choose 2, then 1 for sin^-1, type 3/5, and choose 2 for cos. The program shows Triangle: opp 3, adj 4, hyp 5, then cos(sin^-1(3/5)), = 4/5, and = 0.8.

For sec(tan^-1(5/12)), choose 2, then 3 for tan^-1, type 5/12, and choose 5 for sec. The triangle is 5, 12, 13, so the program shows = 13/12, and = 1.08333 as a decimal.

Tips and common mistakes

Where this comes up

Inverse trig functions finish the trigonometric functions unit of precalculus and trigonometry, and calculus uses them again for derivatives, integrals, and trig substitution.

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,asin,acos,atan,pi,sqrt
  2. def clr():print("\n"*11)
  3. def pg():input("[enter]");clr()
  4. def one(t):
  5. t=t.replace("(","").replace(")","")
  6. if "sqrt" in t:k,r=t.split("sqrt");return (float(k) if k else 1)*sqrt(float(r))
  7. return float(t)
  8. def val(s):
  9. s=s.lower().replace(" ","").replace("*","");g=1
  10. if s[:1]=="-":g=-1;s=s[1:]
  11. if "/" in s:n,d=s.split("/",1);return g*one(n)/one(d)
  12. return g*one(s)
  13. def ex(v):
  14. if abs(v)<1e-9:return "0"
  15. if abs(v)>9999:return "%.6g"%v
  16. g="-" if v<0 else "";q=v*v
  17. for r in range(1,201):
  18. p=round(q*r)
  19. if p and abs(q-p/r)<1e-8*r:
  20. n=p*r;k=1;i=2
  21. while i*i<=n:
  22. while n%(i*i)==0:n//=i*i;k*=i
  23. i+=1
  24. a,b=k,r
  25. while b:a,b=b,a%b
  26. k//=a;r//=a
  27. t=(str(k) if k>1 or n==1 else "")+("" if n==1 else "sqrt("+str(n)+")")
  28. return g+t+("/"+str(r) if r>1 else "")
  29. return "%.6g"%v
  30. def rad(v):
  31. for d in(1,2,3,4,6):
  32. k=round(v/pi*d)
  33. if abs(v/pi-k/d)<1e-8:
  34. if k==0:return "0"
  35. a=("-" if k<0 else "")+("" if abs(k)==1 else str(abs(k)))+"pi"
  36. return a if d==1 else a+"/"+str(d)
  37. return "%.6g"%v
  38. def pick(p,v):
  39. while 1:
  40. c=input(p).strip()
  41. if len(c)==1 and c in v:return c
  42. clr();print("4.7 INVERSE TRIG\n __\n ___(o )> quack!\n \\ <_. )\n `---'\nDuckieDai (TM)\nhiddenwordscanner.com");pg()
  43. N=("sin^-1","cos^-1","tan^-1")
  44. while 1:
  45. m=pick("4.7 INVERSE TRIG\n1 Find the angle\n2 Trig of inverse\n like cos(sin^-1(3/5))\n3 Ranges 0 Exit\n> ","0123")
  46. clr()
  47. if m=="0":break
  48. if m=="3":print("sin^-1: -pi/2 to pi/2\n (QI or QIV)\ncos^-1: 0 to pi\n (QI or QII)\ntan^-1: -pi/2 to pi/2\n (QI or QIV, no ends)\nsin^-1, cos^-1 need\n -1 <= x <= 1");pg();continue
  49. i=int(pick("Inverse:\n1 sin^-1\n2 cos^-1\n3 tan^-1\n> ","123"))
  50. try:
  51. x=val(input("Value (like sqrt3/2)? "))
  52. if i<3 and abs(x)>1 or not abs(x)<1e300:raise ValueError
  53. except (ValueError,ZeroDivisionError):print("Bad value. Examples:\n1/2 -sqrt3/2 sqrt(2)/2\n(-1 to 1 for sin/cos)");pg();continue
  54. t=(asin,acos,atan)[i-1](x);clr()
  55. if m=="1":print(N[i-1]+"("+ex(x)+")\n= "+rad(t)+" rad\n= "+"%.6g"%(t*180/pi)+" deg");pg();continue
  56. o=int(pick("Outer function:\n1 sin 2 cos 3 tan\n4 cot 5 sec 6 csc\n> ","123456"))
  57. s=sin(t);c=cos(t);n,d=((s,1),(c,1),(s,c),(c,s),(1,c),(1,s))[o-1]
  58. clr();y=sqrt(abs(1-x*x));a,b,h=((x,y,1),(y,x,1),(x,1,sqrt(1+x*x)))[i-1];sc=1
  59. for k in range(1,101):
  60. if abs(x*k-round(x*k))<1e-9:sc=k;break
  61. print("Triangle: opp "+ex(a*sc)+"\n adj "+ex(b*sc)+" hyp "+ex(h*sc))
  62. if x<0:print("(angle in Q"+("II" if i==2 else "IV")+")")
  63. L=("sin","cos","tan","cot","sec","csc")[o-1]+"("+N[i-1]+"("+ex(x)+"))"
  64. if abs(d)<1e-12:print(L+"\n= undefined")
  65. else:print(L+"\n= "+ex(n/d)+"\n= "+"%.6g"%(n/d))
  66. pg()
  67. print("Quack! DuckieDai (TM)\nhiddenwordscanner.com")
Filename
INV47.py
Size
2723 bytes
SHA-256
c9f4adaade55acdbf2393a917836a4defe1f9481dbbbb45c47a662c50747dcac

Usage

Inputs

  • A menu choice: 1 find the angle, 2 trig of an inverse, 3 ranges, 0 exit
  • The inverse: 1 sin^-1, 2 cos^-1, 3 tan^-1
  • The value, such as 3/5, -1/2, or sqrt3/2
  • For a composition, the outer function: 1 sin, 2 cos, 3 tan, 4 cot, 5 sec, 6 csc

Outputs

  • The angle in radians, as a multiple of pi when it is one, and in degrees
  • The reference triangle's opposite, adjacent, and hypotenuse, and the quadrant when the value is negative
  • The composition's exact value, such as 4/5 or 13/12, and its decimal, or undefined

Units: Angles in radians and degrees; ratios have no units.

Assumptions and limitations

Assumptions

  • Values are typed as numbers, fractions, or square roots, such as 1/2, -sqrt3/2, or sqrt(2)/2.
  • Answers use the principal ranges: sin^-1 and tan^-1 from -pi/2 to pi/2, and cos^-1 from 0 to pi.

Constraints

  • sin^-1 and cos^-1 need a value from -1 to 1.
  • inf, nan, and values of 1e300 or more in size are refused with Bad value.

Known failures

  • Exact forms are found for values that are a fraction or a fraction times a square root; other values, and any value larger than 9999, are shown as 6-digit decimals.
  • A radian answer that is not a multiple of pi over 1, 2, 3, 4, or 6, such as sin^-1(1/3), is shown as a decimal.

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, inf, nan, and values of 1e300 or more are refused with Bad value instead of stopping the program, and values larger than 9999 are shown as decimals so a large tan^ 1 value no longer takes minutes. Every other answer is unchanged; this exact file has not yet been rerun on a calculator.
Dependencies
math
Suggested calculator name
INV47 — 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 INV47 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.