Speed of a train by quadratic equation