Given two bodies on Keplerian orbits, what is the procedure to find the next closest approach of the two bodies? The bodies would be effectively massless objects like two spaceships orbiting around a uniform central body. The orbits can be given by state vectors or the six keplerian elements or any representation of elements that leads to the easiest solution.
Note that by "next closest approach" I mean the immediate next time when the orbits switch from getting closer to getting further apart (which may not actually be very close at all compared to the optimal closest approach of the two orbits).
I expect it is a numerical root finding problem followed by a second derivative check of some sort.
I guess one simple way to do this would be to write a function which takes the state vectors, propagates them to time t and then calculates the distance, then just wrap that with Brent's 1-dimensional minimization algorithm (e.g. Matlab's fminbnd), then have a heuristic to find a bound range that the minimum is in or expand the search radius if it fails. It'd be nice to find a method with better convergence properties than that though.