I'm going to use a speed of 0.8, or 4/5ths the speed of light; because then the numbers are going to work out. Let's start by sketching the world-lines of the train, front and back:
We're going to assume the train is of unit length. Remember, the funny thing about that is you can't assume that it passes through the point (0,1). The world-line of the front of the train only passes through that point if the train is standing still. We can't assume anything if the train is moving, so we're going to call that point (0, h) for now. We'll find out that h is less than 1.
Now we're going to use the relativistic Law of Pythagoras (I think it's called the Minkowski metric) to measure the length of the train. We saw the other day how the hyperbolas in the lower half of the quadrant corresponded to equal time-like intervals, counted off in seconds. The same law tells us that hyperbolas in the upper half of the quadrant mark of points in space-time of equal distance from the origin. Since the train is of length 1, at the moment the back of the train passes through the origin, the front of the train must lie on the hyperbola x^2 - t^2 = 1. That's our first equation. (Actually, if I look back at my diagram, it's my second equation. But you get the idea.)
Then we just add in the fact that the train has a velocity of 0.8, and write the equation for the straight line passing through the point (0, h). Because we're trying to find out how long the speeding train appears to an observer standing on the ground.
It's not to hard to solve those two equations. I find that the front of the train is located at the position (4/3, 5/3) and consequently the world-line of the train passes through the point (0, 0.6). (EDIT: I had the coordinates reversed when I posted this morning, but I've fixed it now.) Here is another drawing the train, this time showing the hyperbola which represents the locus of all points unit distance from the origin. No matter how fast the train is moving, at the moment the caboose is passing through the origin, a man inside the train will find that the engine is somewhere on this hyperbola:
I fixed my picture so that the green line and the brown line have the same angular separation from the light cone. I also drew in the hyperbola so that it's tangent to the world-line of the train. I'm not sure why it should be that way but I think it's right. You might want to check me on that.