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

=================

=================

1 Answer

1

=================

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.