Hidden WordScanner
Private scans · No account required

DuckieDai Gibbs Free Energy

Calculate Delta G from Delta H, Delta S, and T or relate standard Gibbs energy to a dimensionless equilibrium constant.

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

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.

JavaScript is required for the optional browser simulation. Source viewing and downloading remain available without it.

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.

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

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

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

Download .py

View source below, copy it when JavaScript is available, or download the exact .py bytes.

  1. from math import log,exp
  2. R=.008314
  3. def duckiedai_intro(program_name,wait=True):
  4. title=program_name[:16]
  5. empty=16-len(title)
  6. left=empty//2
  7. right=empty-left
  8. print("+----------------------+")
  9. print("| "+" "*left+title+" "*right+" |")
  10. print("| |")
  11. print("| __ |")
  12. print("| ___(o )> quack! |")
  13. print("| \\ <_. ) |")
  14. print("| `---' |")
  15. print("| by DuckieDai |")
  16. print("+----------------------+")
  17. print("Loading...")
  18. if wait:
  19. input("Press enter to start ")
  20. print("\n"*6)
  21. def num(s):
  22. while 1:
  23. try:return float(input(s))
  24. except:print("Enter a number")
  25. def pos(s):
  26. while 1:
  27. x=num(s)
  28. if x>0:return x
  29. print("Must be positive")
  30. def menu():
  31. while 1:
  32. try:
  33. x=int(input("Choose 1-3: "))
  34. if x>0 and x<4:return x
  35. except:pass
  36. print("Choose 1 to 3")
  37. def dg_type(g):
  38. if abs(g)<1e-7:print("AT EQUILIBRIUM")
  39. elif g<0:print("SPONTANEOUS")
  40. else:print("NONSPONTANEOUS")
  41. def k_type(k):
  42. if abs(k-1)<1e-7:print("K=1 equilibrium")
  43. elif k>1:print("Products favored")
  44. else:print("Reactants favored")
  45. duckiedai_intro("GIBBS ENERGY")
  46. print("GIBBS FREE ENERGY")
  47. print("1 DG from H,S,T")
  48. print("2 DG from K")
  49. print("3 K from DG")
  50. c=menu()
  51. if c==1:
  52. h=num("DH kJ/mol: ")
  53. s=num("DS J/mol K: ")
  54. t=pos("Temp K: ")
  55. g=h-t*s/1000
  56. print("DG kJ/mol =",g)
  57. dg_type(g)
  58. elif c==2:
  59. k=pos("K: ")
  60. t=pos("Temp K: ")
  61. g=-R*t*log(k)
  62. print("DG kJ/mol =",g)
  63. dg_type(g)
  64. k_type(k)
  65. else:
  66. g=num("DG kJ/mol: ")
  67. t=pos("Temp K: ")
  68. try:
  69. k=exp(-g/(R*t))
  70. print("K =",k)
  71. k_type(k)
  72. except:print("K too large")
  73. input("ENTER for guide: ")
  74. print("QUICK GUIDE")
  75. print("DG<0: spontaneous")
  76. print("DG>0: nonspontaneous")
  77. print("K>1: products")
  78. print("K<1: reactants")
  79. print("DuckieDai: done!")
  80. 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

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.