Hidden WordScanner
Private scans · No account required

DuckieDai Coulomb's Law

Solve electric force, either charge magnitude, or separation distance using Coulomb's law and identify attraction or repulsion when charge signs are known.

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.

physics · MIT License

Overview

Solve electric force, either charge magnitude, or separation distance using Coulomb's law and identify attraction or repulsion when charge signs are known.

Usage

Inputs

  • Requested unknown: electric force, charge 1, charge 2, or distance
  • Known charges in coulombs and distance in metres

Outputs

  • Requested value and, when both charge signs are supplied, attractive or repulsive force type

Units: Charges use coulombs, distance uses metres, and force uses newtons.

Assumptions and limitations

Assumptions

  • Charges are treated as point charges and ke is 8.988E9.

Constraints

  • Distance and force magnitudes must be positive; divisor values cannot be zero.

Known failures

  • Force magnitude alone cannot determine an unknown charge's sign.
  • Inconsistent units produce an incorrect result.

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 paginated .py transferred through TI Connect CE into RAM and tested individually
What happened
Passed: branded intro, paginated menu, Coulomb law workflow, force type output, and answer screen ran on the physical calculator
Dependencies
math
Suggested calculator name
COULOMB — 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 the DuckieDai calculator screen

Follow the reviewed program's real menu, prompts, validation, calculation, and result flow before downloading.

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 Coulomb's Law for TI-84 Plus CE Python."""
  2. from math import sqrt
  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 or negative finite numbers."""
  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 nonzero_number(prompt):
  33. """Require a number other than zero."""
  34. while True:
  35. value = number(prompt)
  36. if value != 0:
  37. return value
  38. print("Value cannot be zero.")
  39. def positive_number(prompt):
  40. """Require a number greater than zero."""
  41. while True:
  42. try:
  43. value = float(input(prompt))
  44. if value > 0 and value < 1e100:
  45. return value
  46. except ValueError:
  47. pass
  48. print("Enter a number above 0.")
  49. def show_answer(name, value, unit):
  50. input("Press enter for answer ")
  51. print("\n" * 6)
  52. print("ANSWER")
  53. print(name + " = " + str(value))
  54. print(unit)
  55. def force_type(q1, q2):
  56. """Tell whether two charges attract or repel."""
  57. if q1 * q2 < 0:
  58. return "ATTRACTIVE"
  59. else:
  60. return "REPULSIVE"
  61. def main():
  62. duckiedai_intro("COULOMBS LAW")
  63. ke = 8.988e9
  64. print("COULOMB'S LAW")
  65. print()
  66. print("Formula:")
  67. print("Fe = ke*|q1*q2|/r^2")
  68. print()
  69. print("ke = 8.988E9")
  70. input("Press enter for menu ")
  71. print("\n" * 6)
  72. print()
  73. print("What do you need?")
  74. print()
  75. print("1. Electric force")
  76. print("2. Charge 1")
  77. print("3. Charge 2")
  78. print("4. Distance")
  79. print()
  80. choice = input("Choose 1-4: ")
  81. print()
  82. # ==========================================
  83. # 1. SOLVE ELECTRIC FORCE
  84. #
  85. # Fe = ke*|q1*q2|/r^2
  86. # ==========================================
  87. if choice == "1":
  88. q1 = nonzero_number("Charge 1 (C): ")
  89. q2 = nonzero_number("Charge 2 (C): ")
  90. r = positive_number("Distance (m): ")
  91. force = (
  92. ke * abs(q1 * q2) /
  93. (r ** 2)
  94. )
  95. print()
  96. print("Using:")
  97. print("Fe = ke*|q1*q2|/r^2")
  98. show_answer(
  99. "Fe",
  100. force,
  101. "newtons"
  102. )
  103. print()
  104. print("Force type:")
  105. print(force_type(q1, q2))
  106. # ==========================================
  107. # 2. SOLVE MAGNITUDE OF CHARGE 1
  108. #
  109. # |q1| = Fe*r^2 / (ke*|q2|)
  110. # ==========================================
  111. elif choice == "2":
  112. force = positive_number("Force (N): ")
  113. q2 = nonzero_number("Charge 2 (C): ")
  114. r = positive_number("Distance (m): ")
  115. q1 = (
  116. force * r ** 2 /
  117. (ke * abs(q2))
  118. )
  119. print()
  120. print("Using:")
  121. print("Fe = ke*|q1*q2|/r^2")
  122. print()
  123. print("Rearranged:")
  124. print("|q1| = Fe*r^2")
  125. print(" /(ke*|q2|)")
  126. show_answer(
  127. "|q1|",
  128. q1,
  129. "coulombs"
  130. )
  131. print()
  132. print("Note:")
  133. print("Force alone cannot")
  134. print("determine q1 sign.")
  135. # ==========================================
  136. # 3. SOLVE MAGNITUDE OF CHARGE 2
  137. #
  138. # |q2| = Fe*r^2 / (ke*|q1|)
  139. # ==========================================
  140. elif choice == "3":
  141. force = positive_number("Force (N): ")
  142. q1 = nonzero_number("Charge 1 (C): ")
  143. r = positive_number("Distance (m): ")
  144. q2 = (
  145. force * r ** 2 /
  146. (ke * abs(q1))
  147. )
  148. print()
  149. print("Using:")
  150. print("Fe = ke*|q1*q2|/r^2")
  151. print()
  152. print("Rearranged:")
  153. print("|q2| = Fe*r^2")
  154. print(" /(ke*|q1|)")
  155. show_answer(
  156. "|q2|",
  157. q2,
  158. "coulombs"
  159. )
  160. print()
  161. print("Note:")
  162. print("Force alone cannot")
  163. print("determine q2 sign.")
  164. # ==========================================
  165. # 4. SOLVE DISTANCE
  166. #
  167. # r = sqrt(ke*|q1*q2|/Fe)
  168. # ==========================================
  169. elif choice == "4":
  170. force = positive_number("Force (N): ")
  171. q1 = nonzero_number("Charge 1 (C): ")
  172. q2 = nonzero_number("Charge 2 (C): ")
  173. r = sqrt(
  174. ke * abs(q1 * q2) /
  175. force
  176. )
  177. print()
  178. print("Using:")
  179. print("Fe = ke*|q1*q2|/r^2")
  180. print()
  181. print("Rearranged:")
  182. print("r = sqrt(")
  183. print("ke*|q1*q2|/Fe)")
  184. show_answer(
  185. "r",
  186. r,
  187. "meters"
  188. )
  189. print()
  190. print("Force type:")
  191. print(force_type(q1, q2))
  192. else:
  193. print("Invalid choice.")
  194. print()
  195. print("DuckieDai says: done!")
  196. # TI-Python imports the selected AppVar rather than
  197. # setting __name__ to main.
  198. main()
Filename
COULOMB.py
Size
5856 bytes
SHA-256
b569e112c44626a91e96f49630b52a1821bb5f1f996fc577b7c7a3e76eb47c2c

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. COULOMB 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.