physics · MIT License
Overview
Convert physics units both ways across 10 categories, from length, speed, and temperature to force, energy, and pressure, with the work and the conversion factor shown.
- Owner-tested on a TI calculator
- Most requested
- Version 1.0.0
- 2590 bytes
- No imports
Tried it? Did this program work on your calculator?
Before you run it
- TI-84 Plus CE Python · No calculator OS or Python App version has been verified.
- TI Connect CE .py transfer to the Python App; the owner's transfer details were not recorded
- Each conversion uses the exact or standard factor shown on the result screen, such as 1 in = 2.54 cm or 1 cal = 4.184 J.
- Temperatures are converted with the Celsius, Fahrenheit, and kelvin formulas, not a single factor.
- A value may be a decimal or a fraction a/b; the bottom of a fraction cannot be 0.
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 to convert units in physics
The idea
A measurement is a number and a unit together. Converting changes the unit, so the number has to change the other way: a meter is 100 centimeters, so 3 m is 300 cm. The amount itself stays the same.
Most physics formulas expect SI units: meters, kilograms, seconds, m/s, kelvin, newtons, joules, and pascals. Converting a given value into SI before using a formula is one of the most common steps in a physics problem, and a skipped conversion is one of the most common lost points.
The formula
going to the second unit: value * factor
going back to the first unit: value / factor
C to F: x*9/5+32, F to C: (x-32)*5/9, C to K: x+273.15
factor- how many of the second unit make one of the first, such as 1 mph = 0.44704 m/s
x- the value you typed
SI units- the base units most physics formulas are written for
Using the program
- Pick a category from 1 Length to 10 Pressure, then a pair of units.
- Choose 1 to convert from the first unit to the second, or 2 for the other way.
- Type the value. A fraction such as 3/4 works too.
- The program shows the answer, the work as x * factor or x / factor, and the factor itself. A blank entry goes back one screen.
Worked example
A car drives at 60 mph. What is that in m/s? Choose 4 Speed, then 1 mph / m/s, then 1 for mph to m/s, and type 60.
60 * 0.44704 = 26.8224
The program shows 26.8224 m/s with Work: x * 0.44704.
A fever thermometer reads 98.6 F. Choose 5 Temp, then 1 C / F, then 2 for F to C, and type 98.6. The program shows 37 C with Work: (x-32)*5/9.
Room temperature, 25 C, is 298.15 K: choose 5 Temp, then 2 C / K, then 1, and type 25.
Tips and common mistakes
- Check the direction before you trust the answer: a smaller unit always needs a bigger number, so 2 km is 2000 m, not 0.002 m.
- Area and volume units are squared and cubed, so the factors are too: 1 m2 is 10,000 cm2, not 100 cm2.
- Temperatures do not scale by one factor. 0 C is 32 F, not 0 F, so use the formula, and never go below absolute zero, 0 K.
- Round only the final answer, using your class's significant figure rules; the program shows up to 6 significant digits.
Where this comes up
Unit conversion is the first skill in nearly every physics and chemistry course, and it comes back in every unit, from kinematics and forces to energy, gases, and pressure.
Exact reviewed bytes
Source code
N=("Length","Mass","Time","Speed","Temp","Area","Volume","Force","Energy","Pressure")P=((("m","cm",100),("km","m",1000),("ft","m",.3048),("in","cm",2.54)),(("kg","g",1000),("lb","kg",.45359237),("g","mg",1000)),(("hr","s",3600),("min","s",60),("day","hr",24)),(("mph","m/s",.44704),("km/h","m/s",1/3.6),("ft/s","m/s",.3048)),(("C","F",0),("C","K",1),("F","K",2)),(("m2","cm2",1e4),("km2","m2",1e6)),(("L","m3",.001),("mL","L",.001),("cm3","m3",1e-6)),(("lbf","N",4.4482216152605),("kgf","N",9.80665)),(("kJ","J",1000),("cal","J",4.184),("kcal","J",4184),("kWh","J",3.6e6)),(("atm","Pa",101325),("kPa","Pa",1000),("psi","Pa",6894.757293168)))def clr():print("\n"*11)def pg():input("[enter]");clr()def fmt(x):if abs(x)<1e15 and abs(x-round(x))<1e-9:return str(int(round(x)))return "%.6g"%xdef pick(t,L):while 1:clr();print(t)for i in range(0,len(L),2):print(" ".join(str(j+1)+" "+L[j] for j in range(i,min(i+2,len(L)))))s=input("Choice (blank=back)? ").strip()if not s:return -1try:n=int(s)-1if 0<=n<len(L):return nexcept ValueError:passdef num(p):while 1:s=input(p).strip()if not s:return Nonetry:if "/" in s:a,b=s.split("/");return float(a)/float(b)return float(s)except (ValueError,ZeroDivisionError):print("Number or a/b")def tmp(k,f,x):if k==0:return (x*9/5+32,"x*9/5+32",x+273.15) if f else ((x-32)*5/9,"(x-32)*5/9",(x-32)*5/9+273.15)if k==1:return (x+273.15,"x+273.15",x+273.15) if f else (x-273.15,"x-273.15",x)a=(x-32)*5/9+273.15return (a,"(x-32)*5/9+273.15",a) if f else ((x-273.15)*9/5+32,"(x-273.15)*9/5+32",x)def run(g,i):l,r,c=P[g][i]while 1:clr();print("1 "+l+" -> "+r+"\n2 "+r+" -> "+l)w=input("Direction (blank=back)? ").strip()if not w:returnif w not in("1","2"):continuef=w=="1";a,b=(l,r) if f else (r,l)v=num("Value in "+a+"? ")if v is None:continueif g==4:y,h,k=tmp(i,f,v)if k<-1e-9:clr();print("Below absolute zero!");pg();continueelse:y=v*c if f else v/c;h=("x * " if f else "x / ")+fmt(c)clr();print("DuckieDai RESULT\n"+fmt(v)+" "+a+" =\n"+fmt(y)+" "+b+"\nWork: "+h)if g!=4:print("(1 "+l+" = "+fmt(c)+" "+r+")")print("Round per class rules");pg()def main():clr();print("PHYS UNIT CONVERTER\n __\n ___(o )> quack!\n \\ <_. )\n `---'\nDuckieDai (TM)\nhiddenwordscanner.com\nBlank entry = back");pg()while 1:g=pick("PHYSUNIT - DuckieDai",N)if g<0:breakL=[l+" / "+r for l,r,c in P[g]]while 1:i=pick(N[g],L)if i<0:breakrun(g,i)clr();print("Quack! Goodbye\nDuckieDai (TM)\nhiddenwordscanner.com")main()
- Filename
PHYSUNIT.py- Size
- 2590 bytes
- SHA-256
6eadd5329608e01f94609385aed38913d224332e157ccc007f0f60953c5dfe24
Usage
Inputs
- A category: Length, Mass, Time, Speed, Temp, Area, Volume, Force, Energy, or Pressure
- A pair of units and a direction, such as 1 for mph to m/s or 2 for m/s to mph
- The value to convert; a blank entry goes back
Outputs
- The converted value with its unit, the work as x * factor or x / factor, and the conversion factor
- For temperature, the formula used, such as (x-32)*5/9
Units: Metric and US customary units in 10 categories, including m/s, kelvin, newtons, joules, and pascals.
Assumptions and limitations
Assumptions
- Each conversion uses the exact or standard factor shown on the result screen, such as 1 in = 2.54 cm or 1 cal = 4.184 J.
- Temperatures are converted with the Celsius, Fahrenheit, and kelvin formulas, not a single factor.
Constraints
- A value may be a decimal or a fraction a/b; the bottom of a fraction cannot be 0.
- A temperature below absolute zero is refused.
Known failures
- Answers that are not whole numbers show 6 significant digits, so round them as your class asks.
- Only the 30 unit pairs on the menus are included; chain two conversions for others, such as mi to m through km.
- inf and nan are accepted as values and shown as inf or nan.
Compatibility and review
- Review status
- Owner-tested on a TI calculator
- Tested on
- Owner reports personally running this program on a TI-84 Plus CE Python calculator; the test date, OS version, and Python App version were not recorded
- What happened
- Owner reported pass on the calculator for this exact file. It is published unchanged.
- Dependencies
- No imports
- Suggested calculator name
PHYSUNIT— 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 PHYSUNIT or another name, then open the Python App and try the worked example on this page first. This release has no verified calculator OS or Python App version; treat transfer and execution as unverified until independently tested.
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.