hw4 Computation methods