Free boundary formulation of the truncated boundary in the numerical solution of boundary value problems on infinite intervals