Transcript
Page 1: 4.8 Multiple Integrals and Monte Carlo Integrationzxu2/acms40390F13/MC-Integration.pdfΒ Β· 4 [𝑓 , +2𝑓 , + 2 +𝑓( , )] The approximation is of order (( βˆ’ )( βˆ’ )[ βˆ’ 2+(

4.8 Multiple Integrals and Monte Carlo Integration

Page 2: 4.8 Multiple Integrals and Monte Carlo Integrationzxu2/acms40390F13/MC-Integration.pdfΒ Β· 4 [𝑓 , +2𝑓 , + 2 +𝑓( , )] The approximation is of order (( βˆ’ )( βˆ’ )[ βˆ’ 2+(

β€’ Composite Trapezoidal rule to approximate double

Integral: 𝑓 π‘₯, 𝑦 𝑑𝐴𝑅 where 𝑅 = π‘₯, 𝑦 π‘Ž ≀ π‘₯ ≀

𝑏, 𝑐 ≀ 𝑦 ≀ 𝑑} for some constants π‘Ž, 𝑏, 𝑐 and 𝑑.

β€’ Let π‘˜ = (𝑑 βˆ’ 𝑐)/2, β„Ž = (𝑏 βˆ’ π‘Ž)/2.

β€’ 𝑓 π‘₯, 𝑦 𝑑𝐴𝑅= 𝑓 π‘₯, 𝑦 𝑑𝑦

𝑑

𝑐

𝑏

π‘Žπ‘‘π‘₯

β‰ˆ 𝑑 βˆ’ 𝑐

4[𝑓 π‘₯, 𝑐 + 2𝑓 π‘₯,

𝑐 + 𝑑

2+ 𝑓(π‘₯, 𝑑)]

𝑏

π‘Ž

𝑑π‘₯

Page 3: 4.8 Multiple Integrals and Monte Carlo Integrationzxu2/acms40390F13/MC-Integration.pdfΒ Β· 4 [𝑓 , +2𝑓 , + 2 +𝑓( , )] The approximation is of order (( βˆ’ )( βˆ’ )[ βˆ’ 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])

Page 4: 4.8 Multiple Integrals and Monte Carlo Integrationzxu2/acms40390F13/MC-Integration.pdfΒ Β· 4 [𝑓 , +2𝑓 , + 2 +𝑓( , )] The approximation is of order (( βˆ’ )( βˆ’ )[ βˆ’ 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 πœ‹.

Page 5: 4.8 Multiple Integrals and Monte Carlo Integrationzxu2/acms40390F13/MC-Integration.pdfΒ Β· 4 [𝑓 , +2𝑓 , + 2 +𝑓( , )] The approximation is of order (( βˆ’ )( βˆ’ )[ βˆ’ 2+(

β€’ 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 𝑉 = π‘‰π‘’π‘“β„Ž.

Page 6: 4.8 Multiple Integrals and Monte Carlo Integrationzxu2/acms40390F13/MC-Integration.pdfΒ Β· 4 [𝑓 , +2𝑓 , + 2 +𝑓( , )] The approximation is of order (( βˆ’ )( βˆ’ )[ βˆ’ 2+(

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.

Page 7: 4.8 Multiple Integrals and Monte Carlo Integrationzxu2/acms40390F13/MC-Integration.pdfΒ Β· 4 [𝑓 , +2𝑓 , + 2 +𝑓( , )] The approximation is of order (( βˆ’ )( βˆ’ )[ βˆ’ 2+(

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

𝑁.


Top Related