I'm pretty new to physics (I am presently taking AP Physics 1 though I am far ahead of that in math) and I was reading this paper that found the equations of motion for Atwood's machine using lagrangian mechanics, and I think I understand all of that. Here's what I don't get: The Lagrangian is defined as the kinetic energy of a system minus the potential energy of the system. So then, say that I add friction to the system within the pulley the string and what not. The kinetic energy is still going to be the same at every instant I belive, because at every instant the kinetic energy will be the sum of a series of constants plus the square of the velocity. But friction is a force, which means at every instant, friction is applying acceleration, which means that instantaneously it should have no effect on the Lagrangian. And Instantaneously the potential energy in terms of the distance traveled by the rope is the same. Like, I understand that the friction must affect the action somehow, but I can't figure out or understand how it affects the Lagrangian.
I think that one could perhaps use the work-kinetic energy theorem, and then find the total amount of work done by friction by using a velocity proportional model to find the drag and considering the friction between the pulley and rope as static friction using the belt friction equation or something, and then integrating that over the path, but I don't know how to do that, and I still don't really understand how exactly the friction should affect the Lagrangian. So my question is essentially where did I go wrong in my understanding of how friction interacts with the lagrangian, and what would the proper understand be?
I appreciate any time you may spend helping me.