code solving for m with uncertainties