4.8 Multiple Integrals and Monte Carlo Integration
β’ Composite Trapezoidal rule to approximate double
Integral: π π₯, π¦ ππ΄π where π = π₯, π¦ π β€ π₯ β€
π, π β€ π¦ β€ π} for some constants π, π, π and π.
β’ Let π = (π β π)/2, β = (π β π)/2.
β’ π π₯, π¦ ππ΄π = π π₯, π¦ ππ¦
π
π
π
πππ₯
β π β π
4[π π₯, π + 2π π₯,
π + π
2+ π(π₯, π)]
π
π
ππ₯
β π β π
4[π π₯, π + 2π π₯,
π + π
2+ π(π₯, π)]
π
π
ππ₯
=(π β π)
4
(π β π)
4[π π, π + 2π π,
π + π
2+ π(π, π)]
+(π β π)
4
(π β π)
42 ππ + π
2, π + 2π
π + π
2,π + π
2+ ππ + π
2, π
+(π β π)
4
(π β π)
4[π π, π + 2π π,
π + π
2+ π(π, π)]
The approximation is of order π((π β π)(π β π)[ π β π 2 + (π β π)2])
Monte Carlo Simulation
The needle crosses a line if π¦ β€ πΏ/2sin(π) Q: Whatβs the probability π that the needle will intersect on of these lines? β’ Let π¦ be the distance between the needleβs midpoint and the
closest line, and π be the angle of the needle to the horizontal. β’ Assume that π¦ takes uniformly distributed values between 0 and
D/2; and π takes uniformly distributed values between 0 and π.
β’ Let πΏ = π· = 1.
β’ The probability is the ratio of the area of the shaded region to the area of rectangle.
β’ π = 1
2π ππππππ0
π/2= 2/π
Hit and miss method: The volume of the external region is ππ and the fraction of hits is πβ. Then the volume of the region to be integrated is π = πππβ.
Algorithm of Monte Carlo
β’ Define a domain of possible inputs.
β’ Generate inputs randomly from a probability distribution over the domain.
β’ Perform a deterministic computation on the inputs.
β’ aggregate the results from all deterministic computation.
Monte Carlo Integration (sampling)
π΄ = limπββ π(π₯π)βπ₯
π
π=1
Where βπ₯ =πβπ
π, π₯π = π + (π β 0.5)βπ₯.
π΄ βπ β π
π π(π₯π)
π
π=1
Which can be interpreted as taking the average over π in the
interval, i.e., π΄ β π β π < π >, where < π >= π π₯πππ=1
π.