Hidden WordScanner
Private scans · No account required

DuckieDai Beer-Lambert Law

Solve A = epsilon*c*l and convert between absorbance and transmittance while keeping units and model limits visible.

chemistry · MIT License

Overview

Solve A = epsilon*c*l and convert between absorbance and transmittance while keeping units and model limits visible.

  • Not calculator tested
  • Downloaded 34 times
  • Version 1.0.0
  • 2111 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
  • The sample is homogeneous and follows a linear Beer-Lambert response at the selected wavelength.
  • Scattering, stray light, chemical equilibria, and instrument effects are negligible.
  • Divisors and intensity values must be positive; A, epsilon, and concentration are nonnegative in the primary solve modes.

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 the Beer-Lambert law works

The idea

A colored solution absorbs more light when it is more concentrated or when the light travels further through it. Absorbance is directly proportional to both.

That straight-line relationship is how a spectrophotometer turns a light reading into a concentration.

The formula

A = epsilon*c*l

A = -log10(I/I0)

A
absorbance (no units)
epsilon
molar absorptivity (L/mol cm)
c
concentration (mol/L)
l
path length (cm)
I/I0
fraction of light transmitted

Using the program

Worked example

NADH has epsilon = 6220 L/mol cm at 340 nm. For a 0.0001 mol/L solution in a 1 cm cuvette, choose 1 and enter 6220, 0.0001, and 1.

A = 6220 x 0.0001 x 1

The program shows A = 0.622.

Tips and common mistakes

Where this comes up

It is used in every spectrophotometry lab, from general chemistry to biochemistry and analytical chemistry, to turn an absorbance reading into a concentration or to build a calibration line.

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
  2. def duckiedai_intro(program_name,wait=True):
  3. title=program_name[:16]
  4. empty=16-len(title)
  5. left=empty//2
  6. right=empty-left
  7. print("+----------------------+")
  8. print("| "+" "*left+title+" "*right+" |")
  9. print("| |")
  10. print("| __ |")
  11. print("| ___(o )> quack! |")
  12. print("| \\ <_. ) |")
  13. print("| `---' |")
  14. print("| by DuckieDai |")
  15. print("+----------------------+")
  16. print("Loading...")
  17. if wait:
  18. input("Press enter to start ")
  19. print("\n"*6)
  20. def num(s,zero=0):
  21. while 1:
  22. try:
  23. x=float(input(s))
  24. if x>0 or zero and x>=0:return x
  25. except:pass
  26. print("Enter a valid #")
  27. def ratio():
  28. while 1:
  29. x=num("I/I0: ")
  30. if x<=1:return x
  31. print("I/I0 must be <=1")
  32. duckiedai_intro("BEER LAMBERT")
  33. print("BEER-LAMBERT LAW")
  34. print("1 Find A")
  35. print("2 Find conc")
  36. print("3 Find epsilon")
  37. print("4 Find path")
  38. print("5 A from I/I0")
  39. print("6 Light from A")
  40. c=""
  41. while c not in ("1","2","3","4","5","6"):
  42. c=input("Choose 1-6: ")
  43. if c=="1":
  44. e=num("epsilon: ",1)
  45. x=num("Conc mol/L: ",1)
  46. l=num("Path cm: ")
  47. a=e*x*l
  48. print("A =",a)
  49. elif c=="2":
  50. a=num("Absorbance A: ",1)
  51. e=num("epsilon: ")
  52. l=num("Path cm: ")
  53. print("Conc mol/L =",a/(e*l))
  54. elif c=="3":
  55. a=num("Absorbance A: ",1)
  56. x=num("Conc mol/L: ")
  57. l=num("Path cm: ")
  58. print("epsilon =",a/(x*l))
  59. print("L/(mol*cm)")
  60. elif c=="4":
  61. a=num("Absorbance A: ",1)
  62. e=num("epsilon: ")
  63. x=num("Conc mol/L: ")
  64. print("Path cm =",a/(e*x))
  65. elif c=="5":
  66. print("1 Enter I and I0")
  67. print("2 Enter I/I0")
  68. q=""
  69. while q not in ("1","2"):
  70. q=input("Choose 1 or 2: ")
  71. if q=="1":
  72. i0=num("I0: ")
  73. i=num("I: ")
  74. r=i/i0
  75. else:r=ratio()
  76. print("A =",-log(r,10))
  77. print("I/I0 =",r)
  78. print("%T =",r*100)
  79. else:
  80. a=num("Absorbance A: ",1)
  81. r=10**(-a)
  82. print("I/I0 =",r)
  83. print("%T =",r*100)
  84. q=input("Find I? 1=yes: ")
  85. if q=="1":print("I =",num("I0: ")*r)
  86. input("ENTER for guide: ")
  87. print("QUICK GUIDE")
  88. print("A=epsilon*c*l")
  89. print("A=-log(I/I0)")
  90. print("Higher A: less light")
  91. print("A has no units")
  92. print("DuckieDai: done!")
  93. input("ENTER to exit: ")
Filename
beer.py
Size
2111 bytes
SHA-256
f83924f329db3a636204ccf0d19041002cb6e5d0a4b25a420d766df22c4596cf

Usage

Inputs

  • Solve mode and the required absorbance, molar absorptivity, concentration, or path length
  • Incident and transmitted intensity, or their dimensionless ratio

Outputs

  • Absorbance, concentration, molar absorptivity, path length, transmittance ratio, or percent transmittance

Units: A is dimensionless; epsilon uses L/(mol*cm), c uses mol/L, and l uses cm. I and I0 must use the same intensity unit.

Assumptions and limitations

Assumptions

  • The sample is homogeneous and follows a linear Beer-Lambert response at the selected wavelength.
  • Scattering, stray light, chemical equilibria, and instrument effects are negligible.

Constraints

  • Divisors and intensity values must be positive; A, epsilon, and concentration are nonnegative in the primary solve modes.

Known failures

  • I greater than I0 gives negative absorbance and usually indicates a baseline, reference, or measurement issue.
  • High concentration or high absorbance can depart from linear behavior.

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
BEER — 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 BEER 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.