A Least-Squares Solution to Mass Balance around a Chemical Reactor