Hello,
There is no error on derivative function!
Newton-Raphson is not indicated for this case.
first we compute u_bound an l_bound:
//Get upper bound on mu
u_bound1 = a1-fabs(b1);
u_bound2 = a2-fabs(b2);
u_bound3 = a3-fabs(b3);
u_bound = u_bound1;
if...