Hidden WordScanner
Private scans · No account required

DuckieDai Universal Gravitation

Solve gravitational force, either mass, or separation distance using Newton's law of universal gravitation.

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 gravitational force, either mass, or separation distance using Newton's law of universal gravitation.

Usage

Inputs

  • Requested unknown: gravitational force, mass 1, mass 2, or distance
  • Three known positive values in SI units

Outputs

  • Requested gravitational quantity with formula and labelled unit

Units: Masses use kilograms, distance uses metres, and force uses newtons.

Assumptions and limitations

Assumptions

  • Bodies are treated as point masses and G is 6.674E-11.

Constraints

  • All numeric inputs must be positive and below 1e100.

Known failures

  • Zero and negative inputs are rejected.
  • The point-mass model may be inappropriate at small separations for extended bodies.

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, universal gravitation workflow, formula display, and answer screen ran on the physical calculator
Dependencies
math
Suggested calculator name
GRAVLAW — 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 Universal Gravitation 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 positive_number(prompt):
  23. """Ask until a positive finite number is entered."""
  24. while True:
  25. try:
  26. value = float(input(prompt))
  27. if value > 0 and value < 1e100:
  28. return value
  29. except ValueError:
  30. pass
  31. print("Enter a number above 0.")
  32. def show_answer(name, value, unit):
  33. input("Press enter for answer ")
  34. print("\n" * 6)
  35. print("ANSWER")
  36. print(name + " = " + str(value))
  37. print(unit)
  38. def main():
  39. duckiedai_intro("UNIVERSAL GRAV")
  40. G = 6.674e-11
  41. print("UNIVERSAL GRAVITY")
  42. print()
  43. print("Formula:")
  44. print("Fg = G*m1*m2/r^2")
  45. print()
  46. print("G = 6.674E-11")
  47. input("Press enter for menu ")
  48. print("\n" * 6)
  49. print()
  50. print("What do you need?")
  51. print()
  52. print("1. Gravity force")
  53. print("2. Mass 1")
  54. print("3. Mass 2")
  55. print("4. Distance")
  56. print()
  57. choice = input("Choose 1-4: ")
  58. print()
  59. # ==========================================
  60. # 1. SOLVE GRAVITATIONAL FORCE
  61. #
  62. # Fg = G*m1*m2/r^2
  63. # ==========================================
  64. if choice == "1":
  65. m1 = positive_number("Mass 1 (kg): ")
  66. m2 = positive_number("Mass 2 (kg): ")
  67. r = positive_number("Distance (m): ")
  68. force = (
  69. G * m1 * m2 /
  70. (r ** 2)
  71. )
  72. print()
  73. print("Using:")
  74. print("Fg = G*m1*m2/r^2")
  75. print()
  76. print("Fg =")
  77. print(str(G) + " x")
  78. print(str(m1) + " x")
  79. print(str(m2))
  80. print("/ " + str(r) + "^2")
  81. show_answer(
  82. "Fg",
  83. force,
  84. "newtons"
  85. )
  86. # ==========================================
  87. # 2. SOLVE MASS 1
  88. #
  89. # m1 = Fg*r^2 / (G*m2)
  90. # ==========================================
  91. elif choice == "2":
  92. force = positive_number("Gravity force (N): ")
  93. m2 = positive_number("Mass 2 (kg): ")
  94. r = positive_number("Distance (m): ")
  95. m1 = (
  96. force * r ** 2 /
  97. (G * m2)
  98. )
  99. print()
  100. print("Using:")
  101. print("Fg = G*m1*m2/r^2")
  102. print()
  103. print("Rearranged:")
  104. print("m1 = Fg*r^2")
  105. print(" /(G*m2)")
  106. show_answer(
  107. "m1",
  108. m1,
  109. "kg"
  110. )
  111. # ==========================================
  112. # 3. SOLVE MASS 2
  113. #
  114. # m2 = Fg*r^2 / (G*m1)
  115. # ==========================================
  116. elif choice == "3":
  117. force = positive_number("Gravity force (N): ")
  118. m1 = positive_number("Mass 1 (kg): ")
  119. r = positive_number("Distance (m): ")
  120. m2 = (
  121. force * r ** 2 /
  122. (G * m1)
  123. )
  124. print()
  125. print("Using:")
  126. print("Fg = G*m1*m2/r^2")
  127. print()
  128. print("Rearranged:")
  129. print("m2 = Fg*r^2")
  130. print(" /(G*m1)")
  131. show_answer(
  132. "m2",
  133. m2,
  134. "kg"
  135. )
  136. # ==========================================
  137. # 4. SOLVE DISTANCE
  138. #
  139. # r = sqrt(G*m1*m2/Fg)
  140. # ==========================================
  141. elif choice == "4":
  142. force = positive_number("Gravity force (N): ")
  143. m1 = positive_number("Mass 1 (kg): ")
  144. m2 = positive_number("Mass 2 (kg): ")
  145. r = sqrt(
  146. G * m1 * m2 /
  147. force
  148. )
  149. print()
  150. print("Using:")
  151. print("Fg = G*m1*m2/r^2")
  152. print()
  153. print("Rearranged:")
  154. print("r = sqrt(")
  155. print("G*m1*m2/Fg)")
  156. show_answer(
  157. "r",
  158. r,
  159. "meters"
  160. )
  161. else:
  162. print("Invalid choice.")
  163. print()
  164. print("DuckieDai says: done!")
  165. # TI-Python imports the selected AppVar rather than
  166. # setting __name__ to main.
  167. main()
Filename
GRAVLAW.py
Size
4832 bytes
SHA-256
fe76a2435c9044e26b40e145a1cc5cdc6f3b2ec7bc16e529200ea5bd415f20b4

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