Hidden WordScanner
Private scans · No account required

DuckieDai Right Triangle Applications

Solve a right triangle from an angle and a side or from two sides, find a height from an angle of elevation and a distance, or find the angle of elevation from a height and a distance.

trigonometry · MIT License

Overview

Solve a right triangle from an angle and a side or from two sides, find a height from an angle of elevation and a distance, or find the angle of elevation from a height and a distance.

  • Owner-tested on a TI calculator
  • Version 1.0.0
  • 2201 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
  • C is the right angle; side a is across from angle A, side b is next to A, and c is the hypotenuse.
  • Angles are in degrees, and the angle of elevation is measured from the ground.
  • Lengths must be positive numbers, typed as decimals or fractions such as 1/2.

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 solve right triangles and angle of elevation problems

The idea

Many real problems hide a right triangle: a ladder against a wall, a kite string, the height of a tree from where you stand. Once you sketch the triangle and label it, two facts are enough to find everything else, either an angle and a side or two sides.

An angle of elevation is measured up from the ground to your line of sight. With the distance along the ground as the adjacent side and the height as the opposite side, tangent links the two, so you can find the height from the angle, or the angle from the height.

The formula

sin A = a/c, cos A = b/c, tan A = a/b

a^2 + b^2 = c^2, B = 90 - A

height h = d * tan(A), angle A = tan^-1(h/d)

A, B, C
the angles, with C the right angle
a, b, c
the sides across from A, B, and C, so c is the hypotenuse
angle of elevation
the angle up from the horizontal ground to the top of the object
d
the distance along the ground to the object

Using the program

Worked example

A right triangle has A = 30 degrees and hypotenuse 10. Choose 1, type 30, choose 3 for c, and type 10.

a = 10 sin 30 = 5, b = 10 cos 30 = 8.66025, B = 90 - 30 = 60

The program shows A = 30 deg, B = 60 deg, a (opp A) = 5, b (adj A) = 8.66025, and c (hyp) = 10.

Legs 3 and 4: choose 2, then 1, and type 3 and 4. The program shows A = 36.8699 deg and B = 53.1301 deg with c (hyp) = 5.

From 120 feet away, the top of a building is at a 35 degree angle of elevation. Choose 3, type 35, then 120. The program shows = 120 * tan(35) and = 84.0249, so the building is about 84 feet above eye level.

You stand 200 feet from a 50 foot pole. Choose 4, type 50 for the height, then 200. The program shows = tan^-1(50/200) and = 14.0362 deg.

Tips and common mistakes

Where this comes up

Right triangle applications and angles of elevation are a standard section of precalculus, trigonometry, and geometry, and they come up again in physics with ramps, vectors, and projectiles.

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,tan,atan,sqrt,pi
  2. def clr():print("\n"*11)
  3. def pg():input("[enter]");clr()
  4. def f(x):return "%.6g"%x
  5. def num(p):
  6. while 1:
  7. s=input(p).strip()
  8. try:
  9. if "/" in s:a,b=s.split("/");v=float(a)/float(b)
  10. else:v=float(s)
  11. if v>0:return v
  12. except (ValueError,ZeroDivisionError):pass
  13. print("Positive number please")
  14. def ang(p):
  15. while 1:
  16. v=num(p)
  17. if v<90:return v
  18. print("Must be between 0 and 90")
  19. def pick(p,v):
  20. while 1:
  21. c=input(p).strip()
  22. if len(c)==1 and c in v:return c
  23. def show(A,a,b,c):
  24. clr();print("A = "+f(A)+" deg\nB = "+f(90-A)+" deg\nC = 90 deg\na (opp A) = "+f(a)+"\nb (adj A) = "+f(b)+"\nc (hyp) = "+f(c));pg()
  25. clr();print("4.8 RIGHT TRIANGLES\n __\n ___(o )> quack!\n \\ <_. )\n `---'\nDuckieDai (TM)\nhiddenwordscanner.com");pg()
  26. while 1:
  27. k=pick("4.8 TRIANGLES\n1 Angle + side\n2 Two sides\n3 Height (elevation)\n4 Angle of elevation\n5 Labels picture\n0 Exit\n> ","012345")
  28. clr()
  29. if k=="0":break
  30. if k=="1":
  31. A=ang("Angle A (deg)? ");s=pick("Known side:\n1 a (opp A)\n2 b (adj A)\n3 c (hyp)\n> ","123");v=num("Length? ");r=A*pi/180
  32. if s=="1":a=v;c=v/sin(r);b=v/tan(r)
  33. elif s=="2":b=v;c=v/cos(r);a=v*tan(r)
  34. else:c=v;a=v*sin(r);b=v*cos(r)
  35. show(A,a,b,c)
  36. elif k=="2":
  37. s=pick("Known sides:\n1 a and b (legs)\n2 a and c\n3 b and c\n> ","123")
  38. if s=="1":a=num("a? ");b=num("b? ");c=sqrt(a*a+b*b)
  39. else:
  40. x=num(("a" if s=="2" else "b")+"? ");c=num("c (hyp)? ")
  41. if c<=x:print("Hyp c must be biggest");pg();continue
  42. y=sqrt(c*c-x*x)
  43. if s=="2":a=x;b=y
  44. else:a=y;b=x
  45. show(atan(a/b)*180/pi,a,b,c)
  46. elif k=="3":
  47. A=ang("Angle of elev (deg)? ");d=num("Distance along ground? ")
  48. h=d*tan(A*pi/180);clr()
  49. print("h = d * tan(A)\n = "+f(d)+" * tan("+f(A)+")\n = "+f(h)+"\n(above eye level -\n add eye height if given)");pg()
  50. elif k=="4":
  51. h=num("Height? ");d=num("Distance along ground? ")
  52. A=atan(h/d)*180/pi;clr()
  53. print("A = tan^-1(h/d)\n = tan^-1("+f(h)+"/"+f(d)+")\n = "+f(A)+" deg");pg()
  54. else:
  55. print(" B\n |\\\n | \\\n a | \\ c\n | \\\n |____\\\n C b A\nC = 90, a across from A\nSOH CAH TOA (from A)");pg()
  56. print("Quack! DuckieDai (TM)\nhiddenwordscanner.com")
Filename
RTRI48.py
Size
2201 bytes
SHA-256
559ab8bf72de7af6c1aa6c19ca2afdefa6c2a58d2f507c0a3f7581cdd4ae5c6f

Usage

Inputs

  • A menu choice: 1 angle and side, 2 two sides, 3 height, 4 angle of elevation, 5 labels picture, 0 exit
  • Angle A in degrees and one known side: a, b, or the hypotenuse c
  • Two known sides: both legs, a and c, or b and c
  • An angle of elevation and the distance along the ground, or a height and the distance

Outputs

  • Angles A, B, and C and sides a, b, and c, to 6 significant digits
  • The height h = d * tan(A), with a reminder to add eye height when a problem gives one
  • The angle of elevation A = tan^-1(h/d) in degrees
  • A labeled right-triangle picture with SOH CAH TOA

Units: Any one length unit for every side; angles in degrees.

Assumptions and limitations

Assumptions

  • C is the right angle; side a is across from angle A, side b is next to A, and c is the hypotenuse.
  • Angles are in degrees, and the angle of elevation is measured from the ground.

Constraints

  • Lengths must be positive numbers, typed as decimals or fractions such as 1/2.
  • Angle A must be between 0 and 90 degrees, and the hypotenuse must be longer than the other known side.

Known failures

  • Answers are decimals to 6 significant digits, not exact square roots.
  • Typing inf as a length is accepted and gives inf or nan in the answers.

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. The published file is the owner's tested source.
Dependencies
math
Suggested calculator name
RTRI48 — 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 RTRI48 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.