stoich_balance
Balances a chemical equation, ionic ones too (charge is a conserved row), by the exact integer null space of its composition matrix; molar masses from formulas with brackets and hydrates; limiting reagent, theoretical and percent yield, excess left over, atom economy.
- Field
- Chemistry
- Version
- 0.1.0
- Runs as
- Compiled (Rust)
- Typical run
- 0.01 s
Compiled from source: run sh packs/install.sh once before admitting it.
Known answers it must pass
r0001propane combustion, textbook: C₃H₈ + 5 O₂ → 3 CO₂ + 4 H₂O (exact integers)passed
coefficients= [1, 5, 3, 4][1, 5, 3, 4]lockedexact matchcoefficient_sum= 1313lockedexact matchr0002permanganate oxidises HCl, textbook redox: 2 KMnO₄ + 16 HCl → 2 KCl + 2 MnCl₂ + 8 H₂O + 5 Cl₂ (exact integers)passed
coefficients= [2, 16, 2, 2, 8, 5][2, 16, 2, 2, 8, 5]lockedexact matchr0003ionic, textbook half-reactions: MnO₄- + 5 Fe₂+ + 8 H+ → Mn₂+ + 5 Fe₃+ + 4 H₂O, charge +17 on each side (exact integers)passed
coefficients= [1, 5, 8, 1, 5, 4][1, 5, 8, 1, 5, 4]lockedexact matchcharge_per_side= 1717lockedexact matchr0004ionic with carets, textbook dichromate-iron(II): Cr₂O₇²- + 6 Fe²+ + 14 H^+ → 2 Cr³+ + 6 Fe³+ + 7 H₂O, charge +24 per side (exact integers)passed
coefficients= [1, 6, 14, 2, 6, 7][1, 6, 14, 2, 6, 7]lockedexact matchcharge_per_side= 2424lockedexact matchr0005classic hard redox with a complex ion, literature coefficients: 10 K₄[Fe(CN)6] + 122 KMnO₄ + 299 H₂SO₄ → 162 KHSO₄ + 5 Fe₂(SO₄)3 + 122 MnSO₄ + 60 HNO₃ + 60 CO₂ + 188 H₂O (exact integers)passed
coefficients= [10, 122, 299, 162, 5, 122, 60, 60, 188][10, 122, 299, 162, 5, 122, 60, 60, 188]lockedexact matchr00064 g H₂ + 16 g O₂ with H = 1, O = 16 exactly, closed form: O₂ limits (0.5 mol), 18 g water, 2 g H₂ left, 9 g weighed = 50 % yield, atom economy 100 % (rel 10⁻⁹)passed
limiting_reagent= O₂O₂lockedexact matchextent_mol0.5 ± 5 × 10⁻¹⁰0.5lockedunder 0.01 % of the tolerance usedtheoretical_yield_g18 ± 1.8 × 10⁻⁸18lockedunder 0.01 % of the tolerance usedtheoretical_yield_mol1 ± 10⁻⁹1lockedunder 0.01 % of the tolerance usedexcess_left_g2 ± 2 × 10⁻⁹2lockedunder 0.01 % of the tolerance usedpercent_yield_pct50 ± 5 × 10⁻⁸50lockedunder 0.01 % of the tolerance usedatom_economy_pct100 ± 10⁻⁷100lockedunder 0.01 % of the tolerance usedr00074 g H₂ + 16 g O₂ with IUPAC weights, textbook: O₂ limits, 18.0 g water (textbook gives 3 significant figures, so abs 0.05 g)passed
limiting_reagent= O₂O₂lockedexact matchtheoretical_yield_g18 ± 0.0518.0161locked32 % of the tolerance usedr0008copper(II) sulfate pentahydrate CuSO₄.5H2O, textbook molar mass 249.68 g/mol (textbook gives 2 decimals, so abs 0.005)passed
molar_mass_g_per_mol249.68 ± 0.005249.677locked60 % of the tolerance usedformula_hill= CuH₁₀O₉SCuH₁₀O₉Slockedexact matchr0009brackets, exact by construction with integer weights Ca = 40, P = 31, O = 16: Ca₃(PO₄)2 = 3·40 + 2·31 + 8·16 = 310 g/mol (rel 10⁻¹²)passed
molar_mass_g_per_mol310 ± 3.1 × 10⁻¹⁰310lockedunder 0.01 % of the tolerance usedcomposition.0.count= 3misseddiffersr0010two balances possible, coefficients given and checked: 3 H₂ + 2 O₂ → 2 H₂O + H₂O₂ conserves H (6 = 4 + 2) and O (4 = 2 + 2) by hand count (exact integers)passed
coefficients= [3, 2, 2, 1][3, 2, 2, 1]lockedexact matchcoefficients_given= truetruelockedexact matchcharge_per_side= 00lockedexact match
Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.
Inputs
| Name | Unit | Default | Meaning |
|---|---|---|---|
equation | 1 | Reactants → products, without coefficients (they are computed). '=', '=>', '≤>' also work. Charges: Fe₂+, MnO₄-, SO₄²-, [Fe(CN)6]4-; electron e-; phase labels (aq) (s) (l) (g) are dropped. Empty: no balance, only 'formula'. | |
formula | 1 | One formula for its molar mass and mass composition: Ca₃(PO₄)2, K₄[Fe(CN)6], CuSO₄.5H2O, SO₄²-. Empty: skipped. | |
masses_g | {} | Mass of each reactant you have, in grams, by species as written in the equation: {"H₂": 4, "O₂": 16}. A reactant left out is taken to be in excess. Each above 0 and at most 10¹² g. | |
moles_mol | {} | Amount of each reactant in moles, instead of masses_g (a reactant in only one of the two). | |
product | 1 | The product whose yield is reported, as written in the equation. Empty: the first product. | |
actual_yield_g | g | Mass of the product you obtained, for the percent yield. Optional: leave it out for no percent yield. | |
coefficients | 1 | Optional: coefficients you already know, one per species in the order written. They are checked for atoms and charge, not computed. Needed when atoms and charge alone allow more than one balance. | |
atomic_weights | {} | Atomic weights that replace the built-in IUPAC abridged standard atomic weights (CIAAW 2021), or supply one for an element without a standard weight (Tc, Pm, Po, ...): {"Tc": 98.0}. Each above 0 and at most 1000 g/mol. |
Readings
| Name | Unit | Meaning |
|---|---|---|
balanced_equation | 1 | The equation with the smallest whole-number coefficients. |
coefficients | 1 | Coefficients in the order the species are written. |
coefficients_given | 1 | true when the coefficients were given as an input and only checked. |
species | 1 | |
coefficient_sum | 1 | |
charge_per_side | 1 | Total charge on each side, in elementary charges (equal on both sides by construction). |
limiting_reagent | 1 | |
extent_mol | mol | Extent of reaction set by the limiting reagent: its moles over its coefficient. |
product | 1 | |
theoretical_yield_g | g | |
theoretical_yield_mol | mol | |
percent_yield_pct | % | |
excess_left_g | g | Total mass of the given reactants left unreacted. |
atom_economy_pct | % | Mass of the chosen product over the mass of all reactants, with the coefficients. |
species_table | 1 | |
atom_balance | 1 | |
formula_hill | 1 | |
molar_mass_g_per_mol | g/mol | |
formula_charge | 1 | |
composition | 1 | |
ok | 1 | false when the actual yield is above the theoretical yield. |
warnings | 1 |
Try the call
Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.