Stepsize restrictions for stability in the numerical solution of ordinary and partial differential equations