implementation the computation of costFunction。.