Hamiltonian problem replaced by harmonic oscillator