Based on my experience, operation of a typical inexpensive GPS on the train is a solid "maybe"! The main problem you face is that GPS's rely on being able to have an unobstructed view (in the radio frequency sense) of a significant portion of the sky. The metal construction of rail cars tends to severely limit the ability of the GPS to receive the necessary satellite signals required for it to determine your position. However, depending on the specific orientation of your car at any given time, and the specific position of the GPS satellites at the same time, there will be times when you can get sufficient signal by holding the GPS near the window. Now to avoid being "glued" to the window, it works out best if you have a GPS that has a removable antenna that you can stick to the window itself, letting you comfortably hold the GPS readout in your lap. This sort of rules out the lowest priced units. I have traveled with a Garmin GPS III that has a relatively high performance 12 channel reciever, and found that on average I can get and maintain signal lock about 50% of the time. Again, it depends on several factors, and "your milage may vary" as they say. I would advise that if at all possible you avoid the least expensive models, and get one with both an external antenna and a built-in map database, so you can actually track your progress against known landmarks, etc. By all means take it along - it doesn't cost any extra to give it a try!
Sorry to get so wordy here - didn't mean to write a book!