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: C3H8 + 5 O2 -> 3 CO2 + 4 H2O (exact integers)passed
coefficients= [1, 5, 3, 4][1, 5, 3, 4]lockedexact matchcoefficient_sum= 1313lockedexact matchr0002permanganate oxidises HCl, textbook redox: 2 KMnO4 + 16 HCl -> 2 KCl + 2 MnCl2 + 8 H2O + 5 Cl2 (exact integers)passed
coefficients= [2, 16, 2, 2, 8, 5][2, 16, 2, 2, 8, 5]lockedexact matchr0003ionic, textbook half-reactions: MnO4- + 5 Fe2+ + 8 H+ -> Mn2+ + 5 Fe3+ + 4 H2O, 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): Cr2O7^2- + 6 Fe^2+ + 14 H^+ -> 2 Cr^3+ + 6 Fe^3+ + 7 H2O, 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 K4[Fe(CN)6] + 122 KMnO4 + 299 H2SO4 -> 162 KHSO4 + 5 Fe2(SO4)3 + 122 MnSO4 + 60 HNO3 + 60 CO2 + 188 H2O (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 H2 + 16 g O2 with H = 1, O = 16 exactly, closed form: O2 limits (0.5 mol), 18 g water, 2 g H2 left, 9 g weighed = 50 % yield, atom economy 100 % (rel 1e-9)passed
limiting_reagent= O2O2lockedexact matchextent_mol0.5 ± 5e-100.5lockedunder 0.01 % of the tolerance usedtheoretical_yield_g18 ± 1.8e-0818lockedunder 0.01 % of the tolerance usedtheoretical_yield_mol1 ± 1e-091lockedunder 0.01 % of the tolerance usedexcess_left_g2 ± 2e-092lockedunder 0.01 % of the tolerance usedpercent_yield_pct50 ± 5e-0850lockedunder 0.01 % of the tolerance usedatom_economy_pct100 ± 1e-07100lockedunder 0.01 % of the tolerance usedr00074 g H2 + 16 g O2 with IUPAC weights, textbook: O2 limits, 18.0 g water (textbook gives 3 significant figures, so abs 0.05 g)passed
limiting_reagent= O2O2lockedexact matchtheoretical_yield_g18 ± 0.0518.0161locked32 % of the tolerance usedr0008copper(II) sulfate pentahydrate CuSO4.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= CuH10O9SCuH10O9Slockedexact matchr0009brackets, exact by construction with integer weights Ca = 40, P = 31, O = 16: Ca3(PO4)2 = 3*40 + 2*31 + 8*16 = 310 g/mol (rel 1e-12)passed
molar_mass_g_per_mol310 ± 3.1e-10310lockedunder 0.01 % of the tolerance usedcomposition.0.count= 3misseddiffersr0010two balances possible, coefficients given and checked: 3 H2 + 2 O2 -> 2 H2O + H2O2 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: Fe2+, MnO4-, SO4^2-, [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: Ca3(PO4)2, K4[Fe(CN)6], CuSO4.5H2O, SO4^2-. Empty: skipped. | |
masses_g | {} | Mass of each reactant you have, in grams, by species as written in the equation: {"H2": 4, "O2": 16}. A reactant left out is taken to be in excess. Each above 0 and at most 1e12 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.