Is my integral integrable using Mathematica or is there a fundamental error?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
43 replies · 6K views
This might simplify your calculations a bit: integrating by parts you get $$\int_0^\infty e^{-x} f_X(x) dx = \int_0^\infty F_X(x) e^{-x} dx, $$ so you do not need to compute derivative of ##F_X##.
 
Physics news on Phys.org
Oh, really? So, I think you can see now where the integral in my first post came from. I will follow on this.
 
Integration by parts goes like this. Let ##u=e^{-x}## and thus ##du=-e^{-x}\,dx##, and ##dv=f_X(x)\,dx##, and thus ##v=\int f_X(x)\,dx##. I know that ##F_X(x)=\int_0^xf_X(x)\,dx##, but does the above ##v=F_X(x)## and why? I will continue. Assuming the above is correct, we have

[tex]\int_0^{\infty}e^{-x}f_X(x)\,dx=\underbrace{\left. e^{-x}F_X(x)\right|_0^{\infty}}_{=0}+\int_0^{\infty}e^{-x}F_X(x)\,dx=\int_0^{\infty}e^{-x}F_X(x)\,dx[/tex].

Interesting!
 
Based on the above derivations, the average value of ##\varepsilon(\alpha_1,\alpha_2,\alpha_3)## is given by

[tex]\varepsilon=1-\frac{A}{B}\int_0^{\infty}x^{-1}\exp\left[\frac{x+A}{xB}-x\right]E_1\left[\frac{x+A}{xB}\right]\,dx[/tex]

Is the above integral inetgrable now?
 
OK, now the integral is integrable, and Mathematica gives no complains. But when I compared the numerical results with Monte-Carlo simulations, where I generated ##10^5## samples for each point, I got very close but exactly the same curves. See attached Figure. My original equation is ##\varepsilon(\alpha_1,\alpha_2\alpha_3)=0.5\exp\left(-\frac{\frac{\alpha_1}{\alpha_2}G\gamma_Q}{\frac{1}{G}\alpha_3\gamma_p+1}\right)##. So,

[tex]\varepsilon=0.5-0.5\frac{G^2\gamma_Q}{\gamma_p}\int_0^{\infty}x^{-1}\exp\left[\frac{G\left(x+G\gamma_Q\right)}{x\gamma_p}-x\right]E_1\left[(\frac{G\left(x+G\gamma_Q\right)}{x\gamma_p}\right]\,dx[/tex]

The Mathematica code for the above equation is

Code:
yp = 10^(0/10);
GSS = 50;
For[yQdB = -10, yQdB <= 15, yQdB++;
yQ = 10^(yQdB/10);
A1 = 0.5 -
   0.5*((GSS^2)*yQ )/yp*
    NIntegrate[
     1/x*Exp[(GSS*(x + GSS*yQ))/(x*yp) - x]*
      ExpIntegralE[1, (GSS*(x + GSS*yQ))/(x*yp)], {x, 0, Infinity},
     PrecisionGoal -> 5, MaxRecursion -> 20];
Print[A1];]

I did Monte-Carlo simulations as follows

  1. For each ##\gamma_Q## generate three exponential random variables ##\alpha_i## for i=1,2,3.
  2. Find the value of ##\varepsilon(\alpha_1,\alpha_2\alpha_3,\gamma_Q)=\varepsilon(\alpha_1,\alpha_2\alpha_3,\gamma_Q)+0.5\exp\left(-\frac{\frac{\alpha_1}{\alpha_2}G\gamma_Q}{\frac{1}{G}\alpha_3\gamma_p+1}\right)##, where the initial value of ##\varepsilon(\alpha_1,\alpha_2\alpha_3,\gamma_Q)## is zero.
  3. Repeat for ##N=10^5## iterations.
  4. Find the average value as ##\varepsilon(\gamma_Q)=\varepsilon(\alpha_1,\alpha_2\alpha_3,\gamma_Q)/N##
Is there something wrong that gives me the difference between the two curves?

I didn't know how to attach the figure!
 
Is it an error margin in the numerical evaluation of the integral?
 
Can you show the figures? What error do you have?
 
How to upload a figure from my PC?
 
Upload image to a hosting site (dropbox, google photos, tumblr, flickr, etc) then click to "image" on the toolbar and insert the image url.
 
It doesn't work. I tried both dropbox and google photos. Isn't it "get a link" that I need to insert here?
 
Attached is the figure. Sim=Monte-Carlo simulations
 

Attachments

  • untitled.jpg
    untitled.jpg
    24.6 KB · Views: 498
I think Monte-Carlo simulations are accurate, so, I suspect, given that everything else done properly, the accuracy of NIntegrate in Mathematica is the issue. Is there any possible reason and I cannot see it?
 
Monte-Carlo convergence is quite slow, ##C/\sqrt N##, maybe the error is due to that. Also there could be some details that Monte-Carlo misses.
On the other hand how Mathematica does NIntegrate is hidden, it might also introduce some systematic error here.
 
I remember using Mathematica to evaluate some numerical integral in my master thesis. There was no difference between the numerical integration and Monte-Carlo simulations then!