Just to clarify, this is not a homework problem. I'm using this for some code I'm writing for a simulation: I'm trying to find a point at which I should switch from a positive acceleration of a certain magnitude to a negative acceleration of the same magnitude, given an initial velocity. Basically, the goal is to stop at a specified position, given an initial position and velocity.
Sounds pretty easy, right? The problem is that I can only accelerate either fully forward or fully backward.
Essentially, I'm trying to find $pos_\text{switch}$ in terms of $pos_i$, $v_i$, $a$, and $pos_\text{tar}$, given that $v_f$ is $0$. Two things I have figured out are that the maximum initial velocity for which it is possible to stop at the target without overshooting is $\sqrt{2ad}$, and the obvious that if the velocity is $0$, $pos_\text{switch}$ is simply the halfway point between the initial and final points.
I hope you can help.