chemistry · MIT License
Overview
Calculate Delta G from Delta H, Delta S, and T or relate standard Gibbs energy to a dimensionless equilibrium constant.
- Not calculator tested
- Downloaded 33 times
- Version 1.0.0
- 1808 bytes
- Uses math
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 is the intended path; calculator OS, Python App, transfer, and execution have not yet been tested for this release
- Delta H and Delta S are treated as temperature-independent for Delta G = Delta H - T*Delta S.
- The K relation uses standard-state Delta G and a thermodynamic, dimensionless equilibrium constant.
- Temperature and K must be positive; signed thermodynamic changes are accepted.
Try the DuckieDai calculator screen
Follow the same opening, solve menu, prompts, validation, and result flow as the downloadable program.
TI-84 Plus CE Python · screen preview
Learn the math
How Gibbs free energy works
The idea
Gibbs free energy combines the heat change of a reaction with its change in disorder to tell you whether the reaction can happen without outside help.
A negative value means spontaneous. A positive value means the reverse direction is favored.
The formula
DG = DH - T*DS
DG0 = -R*T*ln(K)
DG- Gibbs free energy change (kJ/mol)
DH- enthalpy change (kJ/mol)
DS- entropy change (J/mol K)
T- temperature in kelvin
K- equilibrium constant
Using the program
- 1 finds DG from DH, DS, and T, and labels the result SPONTANEOUS or NONSPONTANEOUS.
- 2 finds the standard DG from an equilibrium constant. 3 finds K from a standard DG.
- Press Enter at the end for a quick reference screen.
Worked example
For the formation of ammonia, DH = -92.2 kJ/mol and DS = -198.7 J/mol K. At 298 K, choose 1 and enter -92.2, -198.7, and 298.
DG = -92.2 - 298 x (-0.1987)
The program shows DG kJ/mol = -32.9874 and SPONTANEOUS.
Tips and common mistakes
- Enter DS in J/mol K exactly as tables list it. The program converts it to kJ.
- Temperature must be in kelvin: add 273.15 to degrees Celsius.
- Spontaneous says nothing about speed. A spontaneous reaction can still be very slow.
Where this comes up
It is the center of the thermodynamics unit in general chemistry and AP Chemistry, and it links to equilibrium and electrochemistry. Biochemistry uses it to decide whether a metabolic step can proceed.
Exact reviewed bytes
Source code
from math import log,expR=.008314def duckiedai_intro(program_name,wait=True):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 num(s):while 1:try:return float(input(s))except:print("Enter a number")def pos(s):while 1:x=num(s)if x>0:return xprint("Must be positive")def menu():while 1:try:x=int(input("Choose 1-3: "))if x>0 and x<4:return xexcept:passprint("Choose 1 to 3")def dg_type(g):if abs(g)<1e-7:print("AT EQUILIBRIUM")elif g<0:print("SPONTANEOUS")else:print("NONSPONTANEOUS")def k_type(k):if abs(k-1)<1e-7:print("K=1 equilibrium")elif k>1:print("Products favored")else:print("Reactants favored")duckiedai_intro("GIBBS ENERGY")print("GIBBS FREE ENERGY")print("1 DG from H,S,T")print("2 DG from K")print("3 K from DG")c=menu()if c==1:h=num("DH kJ/mol: ")s=num("DS J/mol K: ")t=pos("Temp K: ")g=h-t*s/1000print("DG kJ/mol =",g)dg_type(g)elif c==2:k=pos("K: ")t=pos("Temp K: ")g=-R*t*log(k)print("DG kJ/mol =",g)dg_type(g)k_type(k)else:g=num("DG kJ/mol: ")t=pos("Temp K: ")try:k=exp(-g/(R*t))print("K =",k)k_type(k)except:print("K too large")input("ENTER for guide: ")print("QUICK GUIDE")print("DG<0: spontaneous")print("DG>0: nonspontaneous")print("K>1: products")print("K<1: reactants")print("DuckieDai: done!")input("ENTER to exit: ")
- Filename
gibbs.py- Size
- 1808 bytes
- SHA-256
f769c7eb1f0f7d39975b4219deccf44dd5da9ed62f0d99a831b3fcd0675813c7
Usage
Inputs
- Delta H in kJ/mol, Delta S in J/(mol*K), and temperature in K
- Dimensionless equilibrium constant K or standard Delta G in kJ/mol
Outputs
- Delta G in kJ/mol or equilibrium constant K
- A sign or equilibrium-position interpretation with stated boundaries
Units: Temperature is kelvin; energy is kJ/mol; entropy input is J/(mol*K); R is 0.008314 kJ/(mol*K); K is dimensionless.
Assumptions and limitations
Assumptions
- Delta H and Delta S are treated as temperature-independent for Delta G = Delta H - T*Delta S.
- The K relation uses standard-state Delta G and a thermodynamic, dimensionless equilibrium constant.
Constraints
- Temperature and K must be positive; signed thermodynamic changes are accepted.
Known failures
- The sign of Delta G describes thermodynamic direction under stated conditions, not reaction rate.
- Very large positive Delta G can underflow K to zero at display precision.
Compatibility and review
- Review status
- Not calculator tested
- Tested on
- The owner reports personally testing the supplied archive programs on a calculator; exact model, OS, and Python App versions were not recorded
- What happened
- Owner reported interactive testing is disclosed, but the published bytes are not labeled independently calculator tested because the environment is unrecorded and Arrhenius received a narrow intake correction
- Dependencies
- math
- Suggested calculator name
GIBBS— 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 GIBBS 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.