Problem with NIntegrate over a piecewise function
If your second numerical integration uses appropriate options nearly the same results are obtained.
(Those options can be figured out from the messages NIntegrate
issues while evaluating your second integral.)
One such way is:
NIntegrate[ff, {y, 0, 1}, {x, y, 1},
Method -> {"GlobalAdaptive", "MaxErrorIncreases" -> 10^6},
MaxRecursion -> 1000]
Here is another:
NIntegrate[ff, {y, 0, 1}, {x, y, 1}, MinRecursion -> 3]
(See res3
and res4
in the attached screenshot.)
As I mentioned in a comment, NIntegrate
does solve the condition 1.1 x^0.045 < 1
for the singularity at x == b2bar
and this causes a problem with the integration, which is itself an issue. But that issue can be avoided by reducing the condition to something NIntegrate
can handle. If we throw in the domain restriction 0 <= x <= 1 && 0 <= y <= 1
from the integral, or just the x component 0 <= x <= 1
, then Reduce
will solve the condition.
ff = PiecewiseExpand[D[Min[G2, 1], x]*x*q2,
Method -> {"ConditionSimplifier" -> (Quiet[
Reduce[# && 0 <= x <= 1, x, Reals], Reduce::ratnz] &)}]
NIntegrate[ff, {y, 0, 1}, {x, y, 1}]