← 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 spring force, spring constant, displacement, or elastic potential energy with Hooke's law and PE = 0.5*k*x^2.
Usage
Inputs
- Requested spring quantity
- Known force, displacement, spring constant, or elastic energy as required
Outputs
- Requested spring value, including both possible displacement signs when solving from energy
Units: Use newtons, metres, newtons per metre, and joules consistently.
Assumptions and limitations
Assumptions
- The spring behaves linearly within its elastic range.
Constraints
- Spring constant must be positive and divisor values cannot be zero.
Known failures
- Hooke's law is inaccurate beyond the spring's elastic limit.
- Force and displacement signs must follow one consistent direction convention.
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, multi page spring menu, Hooke law and elastic energy workflows, and answer screens ran on the physical calculator
- Dependencies
- math
- Suggested calculator name
HOOKELAW— 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.
TI-84 Plus CE Python · screen preview
JavaScript is required for the optional browser simulation. Source viewing and downloading remain available without it.
Exact reviewed bytes
Source code
"""DuckieDai Springs for TI-84 Plus CE Python."""from math import sqrtdef 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 number(prompt):"""Allow positive, negative, or zero values."""while True:try:value = float(input(prompt))if value > -1e100 and value < 1e100:return valueexcept ValueError:passprint("Enter a valid number.")def nonzero_number(prompt):"""Require a number other than zero."""while True:value = number(prompt)if value != 0:return valueprint("Value cannot be zero.")def positive_number(prompt):"""Require a value greater than zero."""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("SPRING ENERGY")print("HOOKE'S LAW")print("& ELASTIC ENERGY")print()print("Fs = -k*x")print("PE = 0.5*k*x^2")input("Press enter for menu ")print("\n" * 6)print()print("What do you need?")print()print("1. Spring force")print("2. Spring constant")print(" from force")print("3. Displacement")print(" from force")input("Press enter for more ")print("\n" * 6)print("4. Elastic PE")print("5. Spring constant")print(" from PE")print("6. Displacement")print(" from PE")print()choice = input("Choose 1-6: ")print()# ==========================================# 1. SPRING FORCE## Fs = -k*x# ==========================================if choice == "1":k = positive_number("k (N/m): ")x = number("Displacement (m): ")force = -k * xprint()print("Using:")print("Fs = -k*x")print()print("Fs = -" + str(k))print("x " + str(x))show_answer("Fs",force,"newtons")print()print("Minus sign means")print("restoring force is")print("opposite displacement.")# ==========================================# 2. SPRING CONSTANT FROM FORCE## k = -Fs/x# ==========================================elif choice == "2":force = number("Spring force (N): ")x = nonzero_number("Displacement (m): ")k = -force / xprint()print("Using:")print("Fs = -k*x")print()print("Rearranged:")print("k = -Fs/x")if k <= 0:print()print("Result gives k <= 0.")print("Check force and")print("direction signs.")else:show_answer("k",k,"N/m")# ==========================================# 3. DISPLACEMENT FROM FORCE## x = -Fs/k# ==========================================elif choice == "3":force = number("Spring force (N): ")k = positive_number("k (N/m): ")x = -force / kprint()print("Using:")print("Fs = -k*x")print()print("Rearranged:")print("x = -Fs/k")show_answer("x",x,"meters")# ==========================================# 4. ELASTIC POTENTIAL ENERGY## PE = 0.5*k*x^2# ==========================================elif choice == "4":k = positive_number("k (N/m): ")x = number("Displacement (m): ")pe = (0.5 *k *x ** 2)print()print("Using:")print("PE = 0.5*k*x^2")print()print("PE = 0.5 x")print(str(k) + " x")print(str(x) + "^2")show_answer("PE",pe,"joules")# ==========================================# 5. SPRING CONSTANT FROM ENERGY## k = 2*PE/x^2# ==========================================elif choice == "5":pe = nonnegative_number("Elastic PE (J): ")x = nonzero_number("Displacement (m): ")k = (2 * pe /(x ** 2))print()print("Using:")print("PE = 0.5*k*x^2")print()print("Rearranged:")print("k = 2*PE/x^2")show_answer("k",k,"N/m")# ==========================================# 6. DISPLACEMENT FROM ENERGY## x = +/- sqrt(2*PE/k)# ==========================================elif choice == "6":pe = nonnegative_number("Elastic PE (J): ")k = positive_number("k (N/m): ")x = sqrt((2 * pe) / k)print()print("Using:")print("PE = 0.5*k*x^2")print()print("Rearranged:")print("x = +/-sqrt(2*PE/k)")print()input("Press enter for answer ")print("\n" * 6)print("ANSWER")print("|x| = " + str(x))print("meters")print()print("Possible positions:")print("x = " + str(x))print("or")print("x = -" + str(x))else:print("Invalid choice.")print()print("DuckieDai says: done!")# TI-Python imports the selected AppVar rather than# setting __name__ to main.main()
- Filename
HOOKELAW.py- Size
- 7070 bytes
- SHA-256
12c4705772c67397d3761f1be5252249edfc811ffd6f11985993b7b9e1473a48
Transfer and launch
- Confirm that your calculator is the Python-capable model named above. Check that its OS and Python App versions match the reviewed record.
- Download the
.pysource above and verify its SHA-256 digest if your computer provides that option. - Use TI Connect CE to send the Python file to a compatible calculator.
HOOKELAWis a suggested name; you may choose another valid, unique calculator name. - 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
- 1.0.0 — current version, published . Download this reviewed version
Any source change requires a new immutable version and digest. Historical downloads remain available only while their review records remain valid.