2 May
2026
2 May
'26
8:40 a.m.
I have written a small utility for balancing chemical equations: https://hackage.haskell.org/package/chemical-equation Example: $ balance-chemical-equation CH4 O2 CO2 H2O CH4 + 2 O2 <=> CO2 + 2 H2O The solution requires determining the nullspace of an integer matrix where the nullspace must also be expressed in integer vectors. The default solver computes the Reduced Row Echelon Form in Haskell using lists and Rational. An alternative solver uses the FLINT library and can be enabled with the Cabal flag 'flint'. My first attempt using LAPACK can be tried with the Cabal flag 'lapack'. LAPACK's LU decomposition however cannot handle rank deficient matrices, thus the solver fails on some equations.
21
Age (days ago)
21
Last active (days ago)
0 comments
1 participants
participants (1)
-
Henning Thielemann