基于分子量将重量比转换为摩尔比的简单程序

对于由 $n$ 种物质,每种物质的相对分子质量为 $\mathbf{M}=[M_1,\ M_2,\ \dots,\ M_n]^\intercal$ 组成的体系,如果每种物质的质量分数分别为 $\mathrm{\boldsymbol{\omega}=[\omega_1,\ \omega_2,\ \dots,\ \omega_n]}^\intercal$,可通过求解齐次线性方程组的方式得到每种物质的摩尔分数 $\mathbf{x}=[x_1,\ x_2,\ \dots,\ x_n]^\intercal$。

\[\left(\begin{bmatrix}\displaystyle{\frac{M_2}{M_1}}&&&\\&\displaystyle{\frac{M_3}{M_1}}&&\\&&\ddots&\\&&&\displaystyle{\frac{M_n}{M_1}}\end{bmatrix}+\begin{bmatrix}\omega_2\\\omega_3\\\vdots\\\omega_n\end{bmatrix}\begin{bmatrix}1-\displaystyle{\frac{M_2}{M_1}}&1-\displaystyle{\frac{M_3}{M_1}}&\cdots&1-\displaystyle{\frac{M_n}{M_1}}\end{bmatrix}\right)\begin{bmatrix}x_2\\x_3\\\vdots\\x_n\end{bmatrix}=\begin{bmatrix}\omega_2\\\omega_3\\\vdots\\\omega_n\end{bmatrix}\]

其中$\displaystyle{\sum_{i=1}^n\omega_i=1}$ 并且 $\displaystyle{\sum_{i=1}^nx_i=1}$

使用方法

下载wt2mol.zip

启动程序后按提示输入物种数 $n$,随后依次输入每个物种的摩尔质量与重量分数(或重量比)。输入完成后程序会输出每种组分的信息。

 wt2mol: convert weight ratio to mole ratio
 Programmed by Yaocy

 How many components are there? e.g. 3
3
 Input molar weight and weight ratio of component 1
18.016 0.85
 Input molar weight and weight ratio of component 2
46.068 0.10
 Input molar weight and weight ratio of component 3
60.094 0.05

 ----------- ------------ -------------- ------------
  Component   Mole ratio   Weight ratio   Molar mass
 ----------- ------------ -------------- ------------
      1         0.9402        0.8500         18.02
      2         0.0433        0.1000         46.07
      3         0.0166        0.0500         60.09
 ----------- ------------ -------------- ------------

 Press ENTER to exit