varified version with analytical solution