Integrate_1d() error: "The sinh_sinh quadrature evaluated your function at a singular point, leading to the value nan."

So you can run this function at whatever w and u_sd you like with the exported function, but then when it comes time to run the model it blows up?

If this is the case, then it’s probably the gradient calculation that is exploding.

We do Leibniz integral rule - Wikipedia for computing the gradients of the integrals in the ODE. I dunno what the function looks like, but it’s probably possible for a singularity to appear in a derivative that wasn’t there in the function itself. I don’t see where that would happen here tho, so I’m guessing some sorta numerical thing?

The only things I can think of off the top of my head is try to limit the domain of integration. Maybe just do [-1000, 1000]? Or set extreme values in the integrand to zero (like here).

What are valid ranges for w and u_sd by the way?