Quote:
the applet you posted a link to gives different data
than the above.


You probably let it do more that one collision. Check after just one collision. Beyond that and we're not modelling our flying tube anymore.


Anyway here's my program in the form of a Visual Basic 2008 Express Edition project. You can download that from MS.

http://dl.dropbox.com/u/21857463/tube.zip

The guts of it is this:

Code:
        'Update positions
        oldMassPosition = massPosition
        oldTubePosition = tubePosition
        massPosition = massPosition + massVelocity * TimeStepSize
        tubePosition = tubePosition + tubeVelocity * TimeStepSize

        'Check for hitting end of tube
        If (massPosition < tubePosition) Or (massPosition > tubePosition + tubeLength) Then
            Dim newMassVelocity As Double
            Dim newTubeVelocity As Double
            newMassVelocity = (massVelocity * (massMass - tubeMass) + 2 * tubeMass * tubeVelocity) / (massMass + tubeMass)
            newTubeVelocity = (tubeVelocity * (tubeMass - massMass) + 2 * massMass * massVelocity) / (massMass + tubeMass)
            massVelocity = newMassVelocity
            tubeVelocity = newTubeVelocity
        End If

        'Check for passing accelerator
        If massVelocity - tubeVelocity < 0 Then 'Only apply accelerator when going left
            If ((massPosition - tubePosition) <= AcceleratorLocation) _
            And ((oldMassPosition - oldTubePosition) > AcceleratorLocation) Then
                massVelocity = massVelocity - MomentumAddedByAccelerator / massMass
                tubeVelocity = tubeVelocity + MomentumAddedByAccelerator / tubeMass
            End If
        End If


The big equations I got from the "Elastic Collision" page on Wikipedia

Here's a screenshot