eelregit / pmwd

Differentiable Cosmological Forward Model
BSD 3-Clause "New" or "Revised" License
69 stars 16 forks source link

the initial step size in jax odeint could be nan #18

Closed Yucheng-Zhang closed 1 year ago

Yucheng-Zhang commented 1 year ago

The odeint function in jax.experimental.ode determines the initial step size internally. However, the returned value could be nan when the initial derivative fun(t0, y0) is much smaller than the initial value y0. This is caused by the internal algorithm which evaluates the function at a value ~y0/fun(t0, y0), which could be far beyond the valid range of the function and thus returns nan.