JavaScript Stoichiometer

Internal Combustion Engine

Online JavaScript calculator to obtain molar ratio and gram ratio of precursors required to obtain a desired result in solid-state chemistry. All source code for the Stoichiometer calculator is contained within this HTML file. Select "View Source" in your browser to see the details.

Features Implemented:

Precursor and result elements may be typed as either one upper case letter, or two letters with the first upper case and the second lower case. Please separate precursors and results with commas, spaces are ignored. You may type a number immediately after an element to indicate more atoms, as in 'H2O'. Fractional atoms are typed as decimal numbers. This version is not aware of electrovalency and will not balance the charge in your reaction.

Precursors:
Results:
Normalization: First Precursor First Result None

Algorithm Used:

First we parse user input from the Precursors and Results fields to produce composite tree structures, each being a list of compounds, which are in turn lists of elements. We set the molar quantity of the first result compound to unity, then obtain the molar quantity for each precursor compound according to the amount of each first element present in the first result. Then we set the molar quantities of the remaining results according to how much of each first element is present in the precursors. Finally, we tally up all input elements, subtract the output elements, and produce a list of what is excess or missing.

ArrowMap


Prev Page Home Page Next Page Last updated 21 July 2023 by No Spam Please!