Integration using Monte-Carlo method

In summary, the problem is to approximate the integral by the mean value of a random variable Y(X) = f(X) when X \in \mathcal{U}(\pi/4, \pi/2) is uniformly distributed. The error in this approximation can be estimated by using the error propagation formula, which depends on the derivative of the function and the standard deviation of the independent variable.
  • #1
Pzi
26
0

Homework Statement


Integrate using Monte-Carlo method and evaluate absolute error.
[tex]\int\limits_1^{ + \infty } {\frac{{\sqrt {\ln (x)} }}{{{x^5}}}dx} [/tex]

Homework Equations


Everything about Monte-Carlo integration I guess.

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*".
 
Physics news on Phys.org
  • #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:
  • #3
Dickfore said:
[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}]

It is necessary for me to use Monte-Carlo method for this one.
However I appreciate your observation about the precise value!
 
  • #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].
 

Related to Integration using Monte-Carlo method

1. What is the Monte-Carlo method?

The Monte-Carlo method is a numerical technique used to solve complex mathematical problems through the use of random sampling. It involves generating random numbers and using them to approximate the solution to a problem.

2. How is the Monte-Carlo method used for integration?

The Monte-Carlo method can be used to approximate the value of a definite integral by randomly sampling points under the curve of the function. The average value of these points is then multiplied by the total area under the curve to approximate the integral value.

3. What are the advantages of using the Monte-Carlo method for integration?

One advantage of using the Monte-Carlo method is that it can be applied to a wide range of functions, including those that are difficult to integrate analytically. It is also a useful technique for high-dimensional integrals, where other numerical methods may become computationally expensive.

4. Are there any limitations to using the Monte-Carlo method for integration?

One limitation of the Monte-Carlo method is that it can be computationally expensive, especially when higher levels of accuracy are desired. Additionally, the accuracy of the approximation depends on the number of random points generated, which can be difficult to determine for complex functions.

5. How can I improve the accuracy of my integration using the Monte-Carlo method?

The accuracy of the Monte-Carlo method can be improved by increasing the number of random points generated and by using variance reduction techniques such as importance sampling. It is also important to choose a suitable integration region and to ensure that the random points are uniformly distributed within that region.

Similar threads

  • Calculus and Beyond Homework Help
Replies
3
Views
362
  • Calculus and Beyond Homework Help
Replies
4
Views
205
  • Calculus and Beyond Homework Help
Replies
1
Views
266
  • Calculus and Beyond Homework Help
Replies
6
Views
787
  • Calculus and Beyond Homework Help
Replies
8
Views
899
  • Calculus and Beyond Homework Help
Replies
2
Views
891
  • Calculus and Beyond Homework Help
Replies
22
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
587
  • Calculus and Beyond Homework Help
Replies
5
Views
814
  • Calculus and Beyond Homework Help
Replies
19
Views
1K
Back
Top