Let's say I'm trying to model a train accelerating from speed $v_1$ to speed $v_2$, where the train's mass $m$ and engine power $P$ is known. I would like to find both the time $t$ and the distance $s$ needed to reach speed $v_2$. I know that the work done by the engine, $A=Pt$, would be equal to the change in kinetic energy $∆E$. So:
$$ \frac{1}{2}m(v_2^2-v_1^2)=Pt $$ $$ t=\frac{m}{2P}(v_2^2-v_1^2) $$ But how would I go about finding the distance traveled during time $t$, because acceleration is not constant? I'm not well versed in calculus, but maybe it has something to do with integrals? (distance being the integral of velocity)