ericagol / NbodyGradient.jl

N-body integrator computes derivatives with respect to initial conditions for TTVs, RV, Photodynamics & more
MIT License
20 stars 9 forks source link

Order of indices in transit time computation #89

Open ericagol opened 1 year ago

ericagol commented 1 year ago

The g! function takes the dot product between the sky velocity and position of two bodies relative to one another, and this is monitored to see when the sign changes to flag that a transit may have occurred. The indices in the following line, i and j, are the indices of these two bodies, with the body being transited first (tt.ti) and the transiting body second (i): https://github.com/ericagol/NbodyGradient.jl/blob/85631d64cd22125820474fc9acd8f6da2f29c78f/src/transits/timing.jl#L22

but, in this earlier line, the opposite order is used: https://github.com/ericagol/NbodyGradient.jl/blob/85631d64cd22125820474fc9acd8f6da2f29c78f/src/transits/timing.jl#L13

I think that if the indices are swapped, then the sign of both the velocity and the position will change, and so this shouldn't affect the computation of the time of transit. But, we should check that this is the case.

ericagol commented 1 year ago

Hmmm.... if I reverse the order of these indices, then I get an error...