Code for AlgebraicFitting