Difference in behavior between integrate_1d and integrate

I loosened up the tolerances a bit and the function seems to work for me now:

v = integrate_1d(rank_density, down, up, theta, x_r, x_i, 1e-6);

I’m not sure how well it’s working though. I’m wondering if there isn’t something screwed up in how we’re interpreting the error checks from Boost.

Here’s some code for using the ODE integrators to do this:

real[] rank_density_ode(real x,
  real[] y,          // Function argument
  //  on the domain (defined later)
  real[] theta,    // parameters
  real[] x_r,      // data (real)
  int[] x_i) {     // data (integer)
  
  real t = theta[1];
  real A = theta[2];
  real v1 = theta[3];
  real v2 = theta[4];
  real s = theta[5];
  real v;
  
  v=lbaX_pdf(x, t, A, v1, s)*lbaX_cdf(x, t, A, v2, s);
  
  return { v };
}

real order_ode(real down, real up, real[] theta, data real[] x_r) {
  int x_i[0];
  real v;
    
  v=integrate_ode_rk45(rank_density_ode, { 0.0 }, down, { up }, theta, x_r, x_i)[1, 1];
  return v;
}

That worked as well.

5 Likes