For a small personal project I'm looking at travel time of objects in a video game called EVE-Online.
I need to calculate time it will take object to travel from stand-still, constantly accelerating, until it reaches $x$ meters.
In this game objects velocity while accelerating in straight line is defined with equation:
$$v(t)= s(1-e^{-\frac{t}{a}})$$
Where $a$ and $s$ are object specific and unchanging for duration of acceleration.
The function is constructed in a way that $v(t)$ will approach $s$ (maximum speed of object), but never reaching it.
What I did to solve I would call a brute force approach: I calculated $v(t)$ for each second of simulation and summed it up until reaching $x$ (not exactly, as You will overshoot but my system will work fine with precision around one second).
Because I have to calculate this value for many thousand of objects it is impractical to perform this simulation for each and every single one due to computing time needed (I want my system to be relatively fast) and I'm looking for directly solving for $t$ needed to sum of $v(t)$ equaling to $x$.
Is there a way to solve this other than just sum up $v(t)$ at each second or fraction of a second until reaching designated goal?
You can work out a formula for distance travelled using an integral :
$$x(t) = \int_0^t{v(t) dt}$$
When you work out that equation you can solve it for $t$ in terms of $x$.
What you get is :
$$x(t) = s t + sa ( e^{-t/a} - e^0 )$$
Which is :
$$x(t) = st - sa( 1 - e^{-t/a} )$$
Now we cannot provide a convenient formula for $t(x)$, the time to travel a given distance. A basic numerical approach would be to use Newton's Method. Note that for that method you will need the derivative of $x(t)$ and this is simply the velocity $v(t)$
In your case you keep calculating new values of $t_n$ using :
$$t_{n+1} = t_n - \frac{x(t_n)-X_0}{v(t_n)}$$
Where $X_0$ is your target distance.
When $(t_n-t_{n-1})$ is small enough for your needs ( which should should not take many calculations ) you have your approximate answer. You can start with any value, but try $t_0 = 0$ for simplicity.
( Thanks to Claude Leibovici for spotting a silly sign error in my original post. ).