You might well ask why you cannot have a wave function that has a change in wave function value at the ends of the pipe. In particular, you might ask what is wrong with a wave function that is a nonzero constant inside the pipe and zero outside it. Since the second derivative of a constant is zero, this (incorrectly) appears to satisfy the Hamiltonian eigenvalue problem with an energy eigenvalue equal to zero.
The problem is that this wave function has “jump
discontinuities” at the ends of the pipe where the wave
function jumps from the constant value to zero. (Graphically, the
function is broken
into separate pieces at the ends.)
Suppose you approximate such a wave function with a smooth one whose
value merely drops down steeply rather than jumps down to zero. The
steep fall-off produces a first order derivative that is very large in
the fall-off regions, and a second derivative that is much larger
still. Therefore, including the fall-off regions, the average kinetic
energy is not close to zero, as the constant part alone would suggest,
but actually almost infinitely large. And in the limit of a real
jump, such eigenfunctions produce infinite energy, so they are not
physically acceptable.
The bottom line is that jump discontinuities in the wave function
are not acceptable. However, the correct solutions will have jump
discontinuities in the derivative of the wave function, where
it jumps from a nonzero value to zero at the pipe walls. Such
discontinuities in the derivative correspond to
kinks
in the wave function. These kinks are
acceptable; they naturally form when the walls are made more and more
impenetrable. Jumps are wrong, but kinks are fine. (Don't break the
wave function, but crease it all you like.)
For more complicated cases, it may be less trivial to figure out what
singularities are acceptable or not. In general, you want to check
the expectation value,
as defined later, of the energy
of the almost singular case, using integration by parts to remove
difficult-to-estimate higher derivatives, and then check that this
energy remains bounded in the limit to the fully singular case. That
is mathematics far beyond what this book wants to cover, but in
general you want to make singularities as minor as possible.