Search code examples
matlabintegralnumerical-integration

Explicit integral could not be found


I am getting a well-known error of "Explicit integral could not be found" if I try to evaluate following integral

syms z;
funz=1./(1+exp((z*z-0.5)/0.1));
Integ2=int(funz,z,0,inf)

I get the warning:

Warning: Explicit integral could not be found.        
Integ2 =   
int(1/(exp(10*z^2 - 5) + 1), z == 0..Inf)

Mathematica evaluates this integral to 0.693.

I have tried replacing lower integration limit to some small finite number (0.001) but that doesn't help. Please help in identifying the fix for this problem. Any help is appreciated. Thanks a lot !


Solution

  • Try variable-precision arithmetic, vpa:

    syms z; 
    funz=1./(1+exp((z*z-0.5)/0.1));
    
    Integ2=int(funz,z,0,inf)
    Warning: Explicit integral could not be found. 
    
    Integ2 =
    int(1/(exp(10*z^2 - 5) + 1), z = 0..Inf)
    
    vpa(Integ2,5)  % 5 is the number of significant digits
    ans =     
    0.69305
    

    See the last example in the documentation, "Approximate Definite Integrals". Quote:

    If int cannot compute a closed form of a definite integral, try approximating that integral numerically using vpa.