physics · MIT License
Overview
Solve near-Earth gravitational potential energy, mass, or height from PE = m*g*h using g = 9.8 m/s^2.
- Tested on a TI calculator
- Downloaded 39 times
- Version 1.0.0
- 3916 bytes
- No imports
Tried it? Did this program work on your calculator?
Before you run it
- TI-84 Plus CE Python · tested on OS 5.8.3, Python App 5.8.3.0048
- TI Connect CE .py conversion to a Python AppVar in RAM; physically verified one program at a time
- Gravitational field strength is fixed at 9.8 m/s^2 and height is measured from the chosen zero level.
- Mass and divisors must be positive; height and potential energy may be zero where offered.
- The fixed value of g is not suitable when local gravitational field strength differs materially.
Try the DuckieDai calculator screen
Follow the reviewed program's real menu, prompts, validation, calculation, and result flow before downloading.
TI-84 Plus CE Python · screen preview
Learn the math
How gravitational potential energy works
The idea
Lifting an object stores energy in it. Near the Earth's surface that stored energy is the object's mass times the strength of gravity times its height.
The height is measured from whatever level you call zero, usually the floor or the lowest point in the problem.
The formula
PE = m*g*h
PE- gravitational potential energy in joules (J)
m- mass (kg)
g- 9.8 m/s^2, built into the program
h- height above the zero level (m)
Using the program
- Choose what to solve for: 1 potential energy, 2 mass, or 3 height.
- Enter the two values you know. Press Enter to move from the working screen to the answer.
Worked example
A 2 kg book sits on a shelf 10 m above the floor. Choose 1 and enter mass 2 and height 10.
PE = 2.0 x 9.8 x 10.0
The program shows PE = 196.0 joules.
Tips and common mistakes
- The program always uses g = 9.8. If your class uses 9.81 or 10, expect a slightly different answer.
- Only the change in height matters, so choose a zero level and stay with it.
- This formula is for heights small compared with the Earth. For planets and satellites use Universal Gravitation.
Where this comes up
You meet it in the energy unit of high school and college physics, most often in conservation of energy problems: roller coasters, pendulums, falling objects, and anything on a ramp.
Exact reviewed bytes
Source code
"""DuckieDai Potential Energy for TI-84 Plus CE Python."""def duckiedai_intro(program_name, wait=True):"""Show the reusable DuckieDai program opening."""title = program_name[:16]empty = 16 - len(title)left = empty // 2right = empty - leftprint("+----------------------+")print("| " + " " * left + title + " " * right + " |")print("| |")print("| __ |")print("| ___(o )> quack! |")print("| \\ <_. ) |")print("| `---' |")print("| by DuckieDai |")print("+----------------------+")print("Loading...")if wait:input("Press enter to start ")print("\n" * 6)def positive_number(prompt):"""Ask until a positive finite number is entered."""while True:try:value = float(input(prompt))if value > 0 and value < 1e100:return valueexcept ValueError:passprint("Enter a number above 0.")def nonnegative_number(prompt):"""Allow zero or positive values."""while True:try:value = float(input(prompt))if value >= 0 and value < 1e100:return valueexcept ValueError:passprint("Enter 0 or greater.")def show_answer(name, value, unit):input("Press enter for answer ")print("\n" * 6)print("ANSWER")print(name + " = " + str(value))print(unit)def main():duckiedai_intro("POTENTIAL ENERGY")g = 9.8print("GRAVITATIONAL PE")print()print("Formula: PE = m*g*h")print("Using g = 9.8 m/s^2")input("Press enter for menu ")print("\n" * 6)print()print("What do you need?")print()print("1. Potential Energy")print("2. Mass")print("3. Height")print()choice = input("Choose 1-3: ")print()# ==========================================# 1. SOLVE POTENTIAL ENERGY# PE = m*g*h# ==========================================if choice == "1":mass = positive_number("Mass (kg): ")height = nonnegative_number("Height (m): ")pe = mass * g * heightprint()print("Using:")print("PE = m*g*h")print()print("PE = " + str(mass))print("x " + str(g))print("x " + str(height))show_answer("PE",pe,"joules")# ==========================================# 2. SOLVE MASS# m = PE / (g*h)# ==========================================elif choice == "2":pe = nonnegative_number("PE (J): ")height = positive_number("Height (m): ")mass = pe / (g * height)print()print("Using:")print("PE = m*g*h")print()print("Rearranged:")print("m = PE/(g*h)")show_answer("m",mass,"kg")# ==========================================# 3. SOLVE HEIGHT# h = PE / (m*g)# ==========================================elif choice == "3":pe = nonnegative_number("PE (J): ")mass = positive_number("Mass (kg): ")height = pe / (mass * g)print()print("Using:")print("PE = m*g*h")print()print("Rearranged:")print("h = PE/(m*g)")show_answer("h",height,"meters")else:print("Invalid choice.")print()print("DuckieDai says: done!")# TI-Python imports the selected AppVar rather than# setting __name__ to main.main()
- Filename
GRAVPE.py- Size
- 3916 bytes
- SHA-256
ae1c282439e58780c9af76733d080f0e862b09e898755dfb0311fd3022518ba6
Usage
Inputs
- Requested unknown: potential energy, mass, or height
- Two known values using kilograms, metres, and joules
Outputs
- Requested quantity using PE = m*g*h
Units: Mass uses kilograms, height uses metres, and energy uses joules.
Assumptions and limitations
Assumptions
- Gravitational field strength is fixed at 9.8 m/s^2 and height is measured from the chosen zero level.
Constraints
- Mass and divisors must be positive; height and potential energy may be zero where offered.
Known failures
- The fixed value of g is not suitable when local gravitational field strength differs materially.
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 potential energy menu, calculation workflow, and answer screen ran on the physical calculator
- Dependencies
- No imports
- Suggested calculator name
GRAVPE— 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 GRAVPE or another name, then open the Python App and try the worked example on this page first.
Full installation and troubleshooting guide. Check your teacher's or exam's rules before using any program.
Version history
- 1.0.0 — current version, published . Download this reviewed version
Related learning
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.