# NIntegrate::inumri: error [closed]

I am getting the following error:

NIntegrate::inumri: The integrand c (1-0.6 (1-(1+Times[<<2>>])^0.5)-0.4 (1- (1+Times[<<2>>])^0.5)) (1-0.6 (1-(1+Times[<<2>>])^0.5)-0.4 (1- (1+Times[<<2>>])^0.5)) (0.3/(1-Piecewise[{<<2>>},0])^0.5+0.2/(1- Piecewise[{<<2>>},0])^0.5) has evaluated to Overflow, Indeterminate, or Infinity for all sampling points in the region with boundaries {{6/5,9/5}}. >>

My code is:

ch = 1;
cl = 0;
F[c_] := CDF[UniformDistribution[{cl, ch}], c];
f[c_] := PDF[UniformDistribution[{cl, ch}], c];
t1 = .1;
t2 = .2;
t3 = 1 - t1 - t2;
k1 = 0.5;
k2 = 0.;
k3 = 0.2;
l = .6;
H[c_, k_, t_] := l (1 - (1 - F[c - k])^t) + (1 - l) (1 - (1 - F[c])^t);
h[c_, k_, t_] :=
l*t*((1 - F[c - k])^(t - 1))*f[c-k] + (1 - l)*t*( (1 - F[c])^(t - 1))*f[c];
NIntegrate[c*h[c, k1, t1]*(1 - H[c, k2, t2])*(1 - H[c, k3, t3]), {c, cl, ch + k1}];


if t1 is 1 it works, if it's less than 1 it does not work.

Does anyone know how to fix it? [Solved. Thank you for your help]

UPDATE

The previous problem was resolved. Now I'm trying to do the same exercise with a truncated exponential CDF, but I get a slwcon and a ncvb errors.

The difference with the previous code is that now:

parExp = .5;
F[c_] := (1 - Exp[(-parExp)*c])/(1 - Exp[(-parExp)*ch] );
f[c_] := (parExp * Exp[(-parExp)*c])/( 1 - Exp[(-parExp)*ch]);


Then the function

NIntegrate[H[c, k1, t1], {c, cl, ch + k1}]


returns the slwcon and ncvb errors

## closed as off-topic by Cassini, Michael E2, user9660, MarcoB, bbgodfreyFeb 7 '16 at 2:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Michael E2, Community, MarcoB, bbgodfrey
If this question can be reworded to fit the rules in the help center, please edit the question.

• There appear to be (at least) a couple of typos in your code (e.g., the assignment for t1 and the "=" sign at the end of the code. That said, it's going to be difficult for someone to help you figure out what's going on without additional information about what this code is intended to do. – Cassini Feb 6 '16 at 16:37
• @Cassini- yes I'm very sorry. those are typos, but the error does not depend on those typos. – Andrew Feb 6 '16 at 17:26
• Please ask a new question instead of adding to the present question after you already have accepted an answer. Also, since this question is on hold, you are much more likely to obtain responses to your update by writing it as a new question. – bbgodfrey Feb 9 '16 at 17:46

## 1 Answer

Examine your integrand (which is suggested by the error, after all). PiecewiseExpand will collect all terms under one piecewise function.

c*h[c, k1, t1]*(1 - H[c, k2, t2])*(1 - H[c, k3, t3]) // PiecewiseExpand

(*  Power::infy, Infinity::indet errors... *)


You can see that the function does not have numeric values for c > 1.

How to fix it is certainly up to the OP. There is perhaps an error in the model or an error in coding up its formula.