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

Tolerance of transit time finding is fixed at double precision #16

Open ericagol opened 5 years ago

ericagol commented 5 years ago

The global constant TRANSIT_TOL is defined for double precision.

It might make more sense to adapt this precision to the computation.

ericagol commented 5 years ago

When I change this to TRANSIT_TOL = 10*sqrt(eps(one(typeof(h)))), this causes the numerical derivatives in test_findtransit2 to no longer pass. This is strange behavior, but could be due to the acceleration approximation not being accurate enough when computing finite-difference derivatives, or perhaps due to the transit time being found slightly differently (since the test passes when TRANSIT_TOL = 10*sqrt(eps(1.0)).

ericagol commented 5 years ago

I decreased the tolerance, but the discrepancy continues. Indeed, it turns out that gdot is being computed inaccurately, due to a slight difference between v and dx/dt.

ericagol commented 5 years ago

To resolve this I need to compute dq/dtq which I never got working properly.

ericagol commented 5 years ago

I got the computation of dq/dt working with dh17 which involved assigning jac_step to the identity just before phisalpha. This routine still isn't working in the kick fast limit, but is passing tests for now. It will also have problems for alpha != 0.