Hidden WordScanner
Private scans · No account required

DuckieDai Vector Dot Product and Angle

Calculate dot product, magnitudes, angle, and angle class for 2D or 3D vectors.

Version 1.0.0 · Tested on a TI calculator

← Back to Calculator Program Library

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. No entered values, source text, IP address, account, cookie, device identifier, or fingerprint is stored with these counts.

geometry · MIT License

Overview

Calculate dot product, magnitudes, angle, and angle class for 2D or 3D vectors.

Usage

Inputs

  • Two 2D or 3D vectors with finite components

Outputs

  • Dot product, magnitudes, angle in degrees, and perpendicular/acute/obtuse classification

Units: Both vectors must use compatible component units.

Assumptions and limitations

Assumptions

  • Neither vector is the zero vector when calculating an angle.

Constraints

  • Components must remain between -1e100 and 1e100; zero-vector angles are undefined.

Known failures

  • A zero vector cannot produce a direction or angle.

Compatibility and review

Review status
Tested on a TI calculator
Tested on
TI-84 Plus CE Python; OS 5.8.3; Python App 5.8.3.0048; exact source owner-tested through TI Connect CE
What happened
Owner confirmed the supplied vector dot product angle program runs on the physical calculator.
Dependencies
math
Suggested calculator name
VECDOT — 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.

Browser preview

Try a 2D vector angle

This browser preview calculates the dot product and angle for two 2D vectors. The TI program also supports 3D vectors.

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.

JavaScript is required for the optional browser simulation. Source viewing and downloading remain available without it.

Exact reviewed bytes

Source code

Download .py

View source below, copy it when JavaScript is available, or download the exact .py bytes.

  1. """DuckieDai Vector Angle for TI-84 Plus CE Python."""
  2. from math import sqrt, acos, degrees
  3. def duckiedai_intro(program_name, wait=True):
  4. """Show the reusable DuckieDai program opening."""
  5. title = program_name[:16]
  6. empty = 16 - len(title)
  7. left = empty // 2
  8. right = empty - left
  9. print("+----------------------+")
  10. print("| " + " " * left + title + " " * right + " |")
  11. print("| |")
  12. print("| __ |")
  13. print("| ___(o )> quack! |")
  14. print("| \\ <_. ) |")
  15. print("| `---' |")
  16. print("| by DuckieDai |")
  17. print("+----------------------+")
  18. print("Loading...")
  19. if wait:
  20. input("Press enter to start ")
  21. print("\n" * 6)
  22. def number(prompt):
  23. """Allow positive, negative, or zero values."""
  24. while True:
  25. try:
  26. value = float(input(prompt))
  27. if value > -1e100 and value < 1e100:
  28. return value
  29. except ValueError:
  30. pass
  31. print("Enter a valid number.")
  32. def safe_acos(value):
  33. """Protect acos from floating-point rounding."""
  34. if value > 1:
  35. value = 1
  36. if value < -1:
  37. value = -1
  38. return acos(value)
  39. def magnitude(x, y, z=0):
  40. """Return vector magnitude."""
  41. return sqrt(
  42. x ** 2 +
  43. y ** 2 +
  44. z ** 2
  45. )
  46. def main():
  47. duckiedai_intro("VECTOR ANGLE")
  48. print("VECTOR DOT PRODUCT")
  49. print("& ANGLE")
  50. print()
  51. print("1. 2D vectors")
  52. print("2. 3D vectors")
  53. print()
  54. choice = input("Choose 1 or 2: ")
  55. print()
  56. # ==========================================
  57. # 2D VECTOR INPUT
  58. # ==========================================
  59. if choice == "1":
  60. print("VECTOR u")
  61. ux = number("ux: ")
  62. uy = number("uy: ")
  63. uz = 0
  64. print()
  65. print("VECTOR v")
  66. vx = number("vx: ")
  67. vy = number("vy: ")
  68. vz = 0
  69. # ==========================================
  70. # 3D VECTOR INPUT
  71. # ==========================================
  72. elif choice == "2":
  73. print("VECTOR u")
  74. ux = number("ux: ")
  75. uy = number("uy: ")
  76. uz = number("uz: ")
  77. print()
  78. print("VECTOR v")
  79. vx = number("vx: ")
  80. vy = number("vy: ")
  81. vz = number("vz: ")
  82. else:
  83. print("Invalid choice.")
  84. print()
  85. print("DuckieDai says: done!")
  86. return
  87. # ==========================================
  88. # VECTOR MAGNITUDES
  89. # ==========================================
  90. mag_u = magnitude(
  91. ux, uy, uz
  92. )
  93. mag_v = magnitude(
  94. vx, vy, vz
  95. )
  96. # Angle is undefined if either vector
  97. # has zero magnitude.
  98. if mag_u == 0 or mag_v == 0:
  99. print()
  100. print("ANGLE UNDEFINED")
  101. print()
  102. print("A zero vector has")
  103. print("no direction.")
  104. print()
  105. print("DuckieDai says: done!")
  106. return
  107. # ==========================================
  108. # DOT PRODUCT
  109. #
  110. # u dot v =
  111. # ux*vx + uy*vy + uz*vz
  112. # ==========================================
  113. dot = (
  114. ux * vx +
  115. uy * vy +
  116. uz * vz
  117. )
  118. # ==========================================
  119. # ANGLE
  120. #
  121. # cos(theta) =
  122. # dot / (|u|*|v|)
  123. # ==========================================
  124. cos_theta = (
  125. dot /
  126. (mag_u * mag_v)
  127. )
  128. theta = degrees(
  129. safe_acos(cos_theta)
  130. )
  131. # ==========================================
  132. # RESULTS
  133. # ==========================================
  134. print()
  135. print("Using:")
  136. print("u dot v /")
  137. print("(|u|*|v|)")
  138. print()
  139. print("DOT PRODUCT")
  140. print("u dot v =")
  141. print(str(dot))
  142. print()
  143. print("MAGNITUDES")
  144. print("|u| = " + str(mag_u))
  145. print("|v| = " + str(mag_v))
  146. print()
  147. print("cos(theta) =")
  148. print(str(cos_theta))
  149. print()
  150. print("ANGLE")
  151. print("theta =")
  152. print(str(theta))
  153. print("degrees")
  154. print()
  155. # ==========================================
  156. # CLASSIFY ANGLE
  157. # ==========================================
  158. tolerance = 0.0000001
  159. if abs(dot) < tolerance:
  160. print("Vectors are")
  161. print("PERPENDICULAR.")
  162. elif dot > 0:
  163. print("Angle is ACUTE.")
  164. else:
  165. print("Angle is OBTUSE.")
  166. print()
  167. print("DuckieDai says: done!")
  168. # TI-Python imports the selected AppVar rather than
  169. # setting __name__ to main.
  170. main()
Filename
VECDOT.py
Size
4772 bytes
SHA-256
ce10c3625e3880468361fd5b292e2d982ecf2ee49a0fba89e9e6959eccb7dcc8

Transfer and launch

  1. Confirm that your calculator is the Python-capable model named above. Check that its OS and Python App versions match the reviewed record.
  2. Download the .py source above and verify its SHA-256 digest if your computer provides that option.
  3. Use TI Connect CE to send the Python file to a compatible calculator. VECDOT is a suggested name; you may choose another valid, unique calculator name.
  4. Open the Python App, select the program, and check sample inputs before relying on other results.

Read the complete installation, launch, troubleshooting, and removal guide.

Availability does not mean a teacher, school, or exam permits this program. Follow the applicable rules.

Version history

Any source change requires a new immutable version and digest. Historical downloads remain available only while their review records remain valid.