chemhelper¶
General chemistry answers in one line of Python,
and the worked solution in one more.
chemhelper solves the problems that fill the first semester of general
chemistry: molar mass, percent composition, converting between grams, moles
and molarity, and the ideal gas law. Every solver has a twin whose name ends
in _steps that prints the solution the way you would write it on a
whiteboard.
It was written by a chemistry tutor, for tutoring. Check a student's answer in a second, show exactly where it came from, and spend the rest of the session on understanding.
What's inside¶
-
elements
Symbol, name, atomic number and mass for elements 1 to 92, as objects and as a pandas table.
-
compounds
Parse formulas like
Al2(SO4)3, then get molar mass, mass composition and percent composition. -
conversions
Grams to moles and back, molarity from mass or moles, and solute needed for a target concentration.
-
ideal_gas
Solve PV = nRT for any variable, with inputs in atm, torr, mmHg, kPa, L, mL, K or °C.
Why use it¶
-
Shows its work
Every solver has a
_stepstwin. The printed solution includes units and each intermediate value. -
Reads like chemistry
Formulas are written the way they appear in a textbook, parentheses and all. Arguments are named after the quantities.
-
Tells you what went wrong
A typo in a formula or a missing value raises an error that names the problem, not a cryptic traceback.
-
Tested examples
Every example on this site is run against the real package before the site is published.
Where to go next¶
| If you want to… | Read |
|---|---|
| Install the package and run your first calculation | Installation, then the Quickstart |
| Learn how formulas must be written | Writing formulas |
| See every function in a module, with examples | The User guide |
| Work through complete problems | The Tutorials |
| Copy a short recipe | The Cookbook |
| Look up the atomic masses chemhelper uses | The Periodic table |
| Upgrade code written for version 0.4 | Migrating from 0.4 |
| See what's planned or help out | Roadmap and Contributing |