Computation of expectation values with Dirichlet one-dimensional wave functions