We give a modified Hamiltonian for a particle in a box with infinite potential walls that takes into account wall effects. The Hamiltonian is expressed in both the position and momentum representation. In the momentum representation the eigenvalue problem for energy is an integral equation.