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. Note that this is a prototype, so results should not be relied on without independent verification. 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:

Inputs may be upper or lower case, or a mix. Please separate compounds with commas, and elements with spaces. You may type a number immediately after an element to indicate more atoms, as in 'H2 O'. This version cannot parse elements that run together without spaces. Also, this version is not aware of electrovalency and will not balance the charge in your reaction.

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.


Prev Page Home Page Next Page Last updated 5/24/2011 by No Spam Please!