hw5 Computation methods