Following from the hanging rope model here, I understood that the tension only varies with length if the rope is accelerated by external forces. Now, I was reading the proof of wave equation in this pdf, at end of end of the pdf, the common wave equation ( the one in most textbooks ) is resuled by setting $F_{ext} =0$ in this equation:
$$ \rho(x) \frac{\partial^2}{\partial t^2} u(x,t)= T(t) \frac{\partial^2}{\partial x^2} u(x,t) + F_{ext}(x,t)$$
Now if there are no external forces, then how come there is a tension gradient across the rope?