44 Workshop Activities
Exercise 1: Estimating an Integral
Estimate the value of the following integral using Monte Carlo integration:
\[ I = \int_0^1 e^{-x^2}\,dx. \]
- Write down the Monte Carlo estimator for \(I\).
- Implement the estimator in R or Python, and compare your estimate to the true value of the integral (which can be computed using numerical integration).
Exercise 2: Estimating a Probability
Estimate the value of the following probability using Monte Carlo integration:
\[ P(X > 2.5), \quad X \sim N(0,1). \]
- Write down the Monte Carlo estimator for \(P(X > 2.5)\).
- Implement the estimator in R or Python, and compare your estimate to the true value of the probability (which can be computed using the cumulative distribution function of the normal distribution).
Exercise 3: Estimating the Area Under a Curve
Estimate the area under the curve:
\[ y = \sin(x), \quad 0 \le x \le \pi. \]
- Explain how to solve this analytically.
- Write down the Monte Carlo estimator for the area under the curve.
- Implement the estimator in R or Python, and compare your estimate to the true value of the area (which can be computed using numerical integration).
Exercise 4: Estimating an Expectation from an Exponential Distribution
Estimate \(\mathbb{E}[X^2]\) where \(X \sim \text{Exp}(\lambda = 1)\).
- Explain how to solve this analytically.
- Write down the Monte Carlo estimator for \(\mathbb{E}[X^2]\).
- Implement the estimator in R or Python, and compare your estimate to the true value of the expectation (which can be computed using the properties of the exponential distribution).
Exercise 5: High-Dimensional Integration
Estimate the value of the following integral using Monte Carlo integration:
\[ I = \int_{[0,1]^5} \exp\left(-\sum_{i=1}^5 x_i^2\right) dx_1 dx_2 dx_3 dx_4 dx_5. \]
This is a five-dimensional integral, which can be challenging to compute using traditional numerical integration methods. Use Monte Carlo integration to estimate the value of \(I\).
- Write down the Monte Carlo estimator for \(I\).
- Implement the estimator in R or Python, and compare your estimate to the true value of the integral (which can be computed using numerical integration or known properties of the multivariate normal distribution).
Exercise 6: Reliability Simulation
Suppose a machine fails if the stress S exceeds the strength R.
Let
\[ S \sim N(50, 10^2), \quad R \sim N(70, 15^2), \]
independetly. Estimate the probability that the machine fails, i.e., \(P(S > R)\), using Monte Carlo simulation.
- Write down the Monte Carlo estimator for \(P(S > R)\).
- Implement the estimator in R or Python, and compare your estimate to the true value of the probability (which can be computed using properties of the normal distribution).
- Discuss the advantages of using Monte Carlo simulation for reliability analysis in engineering.