1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Integration using Monte-Carlo method

  1. May 13, 2012 #1

    Pzi

    User Avatar

    1. The problem statement, all variables and given/known data
    Integrate using Monte-Carlo method and evaluate absolute error.
    [tex]\int\limits_1^{ + \infty } {\frac{{\sqrt {\ln (x)} }}{{{x^5}}}dx} [/tex]

    2. Relevant equations
    Everything about Monte-Carlo integration I guess.

    3. The attempt at a solution
    [tex] I = \int\limits_1^{ + \infty } {\frac{{\sqrt {\ln (x)} }}{{{x^5}}}dx} = \int\limits_{\pi /4}^{\pi /2} {\frac{{\sqrt {\ln (\tan (t))} }}{{{{(\tan (t))}^5} \cdot {{(\cos (t))}^2}}}dt} [/tex]

    I define random variable Y so that its mean would be equal to my integral I.
    [tex] {y_k} = \left( {\frac{\pi }{2} - \frac{\pi }{4}} \right) \cdot \frac{{\sqrt {\ln (\tan ({t_k}))} }}{{{{(\tan ({t_k}))}^5} \cdot {{(\cos ({t_k}))}^2}}} = \frac{{\pi \sqrt {\ln (\tan ({t_k}))} }}{{4{{(\tan ({t_k}))}^5} \cdot {{(\cos ({t_k}))}^2}}} [/tex]
    [tex] {t_k} = \left( {\frac{\pi }{2} - \frac{\pi }{4}} \right) \cdot {r_k} + \frac{\pi }{4} = \frac{\pi }{4}\left( {{r_k} + 1} \right) [/tex]
    r_k - equally likely random numbers between 0 and 1.

    I then proceed using 55 random numbers to calculate my approximation.
    [tex] {\hat I_n} = \frac{1}{n}\sum\limits_{k = 1}^n {{y_k}} [/tex]
    [tex] I \approx {\hat I_{55}} = \frac{1}{{55}}\sum\limits_{k = 1}^{55} {{y_k}} = 0.{\rm{113481}} [/tex]

    What about absolute error? It is meant to be like "it is very likely (probability over 0.9 or whatever) that our approximation missed the actual value by no more than *ERROR NUMBER*".
    1. The problem statement, all variables and given/known data



    2. Relevant equations



    3. The attempt at a solution
     
  2. jcsd
  3. May 13, 2012 #2
    [tex]
    t = \sqrt{\ln x} \Rightarrow x = e^{t^2}, dx = 2 \, t \, e^{t^2} \, dt
    [/tex]
    [tex]
    \frac{\sqrt{\ln x}}{x^5} \, dx = t \, e^{-5 t^2} \, 2 \, t \, e^{t^2} \, dt = 2 \, t^2 \, e^{-4 t^2} \, dt
    [/tex]
    [tex]
    x = 1 \Rightarrow t = 0, \ x \rightarrow \infty \Rightarrow t \rightarrow \infty
    [/tex]
    So, your integral is equivalent to:
    [tex]
    I = 2 \, \int_{0}^{\infty}{t^2 \, e^{-2 t^2} \, dt} = -2 \, \frac{d}{d a} \left(\int_{0}^{\infty}{e^{-a t^2} \, dt} \right) \vert_{a = 4} = - 2 \, \frac{d}{d a} \left( \frac{1}{2} \, \pi^{\frac{1}{2}} \, a^{-\frac{1}{2}} \right) \vert_{a = 4} = \frac{1}{2} \, \pi^{\frac{1}{2}} \, 4^{-\frac{3}{2}} = \frac{\sqrt{\pi}}{16} \approx 0.110778\ldots
    [/tex]

    EDIT:
    See exact result:
    http://www.wolframalpha.com/input/?i=Integrate[Sqrt[Log[x]]%2Fx^5%2C{x%2C1%2CInfinity}]
     
    Last edited: May 13, 2012
  4. May 13, 2012 #3

    Pzi

    User Avatar

    It is necessary for me to use Monte-Carlo method for this one.
    However I appreciate your observation about the precise value!
     
  5. May 13, 2012 #4
    Because your integrand is given by the estimation of the mean:
    [tex]
    I = \mu_{Y}
    [/tex]
    of a random variable:
    [tex]
    Y(X) = \frac{\sqrt \ln \tan X}{\tan^{5} X \, \cos^{2} X}
    [/tex]
    when [itex]X \in \mathcal{U}(\pi/4, \pi/2)[/itex] is uniformly distributed, by taking the arithmetic average:
    [tex]
    \mu_{Y} \approx \frac{1}{n} \, \sum_{k = 1}^{n}{f(X_k)}
    [/tex]
    you may esitmate your error by the error propagation formula:
    [tex]
    \sigma^{2}_{\mu_Y} = \sum_{k = 1}^{n}{\left( \frac{\partial \mu_Y}{\partial X_k} \right)^{2} \, \sigma^{2}_{X_k}}
    [/tex]
    where the derivative is:
    [tex]
    {\partial \mu_Y}{\partial X_k} = \frac{1}{n} \, f'(X_k)
    [/tex]

    1. Find the derivative [itex]dY/dX[/itex], and estimate it at [itex]E(X) = \frac{\frac{\pi}{4} + \frac{\pi}{2}}{2} = \frac{3 \pi}{8}[/itex]. Let us call it A;

    2. What is the variance of X [itex]\sigma^{2}_{X}[/itex], when [itex]X \in \mathcal{U}(\pi/4, \pi/2)[/itex] is uniformly distributed with the given limits. Let us call this number [itex]\sigma^2[/itex].

    3. Then, using the above values, your error propagation formula becomes:
    [tex]
    \sigma^{2}_{\mu_Y} = \sum_{k = 1}^{n}{\left( \frac{A}{n} \right)^{2} \, \sigma^{2}} = \frac{A^2 \, \sigma^2}{n}
    [/tex]

    The error in the mean is then [itex]\sigma_{\mu_Y}[/itex]. This is a very general formula that holds for any Monte-Carlo evaluation. Notice that it is inversely proportional to the square root of the number of sample points. It is proportional to both the absolute value of the derivative [itex]A = \vert Y'(X = E X) \vert[/itex], and the standard deviation of the independent variable [itex]\sigma_{X}[/itex].
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Integration using Monte-Carlo method
  1. Monte Carlo methods (Replies: 0)

Loading...