Is it ever rational to commit suicide?

I would add this, however. While it certainly can be rational to commit suicide, people who are considering suicide aren't always in a good position to think about it rationally. That's for the obvious reason that many (perhaps most) people who are seriously thinking about killing themselves are depressed, and part of what depression does is make it hard to think clearly. A depressed person might believe that there's no hope, and that the pain will never end, but that's often not true. So yes: suicide can be rational. But if you know someone who's thinking about it, helping them get help may serve what they would understand as their own rational ends if only they were in a better position to see them.