7
4.8 Multiple Integrals and Monte Carlo Integration

4.8 Multiple Integrals and Monte Carlo Integrationzxu2/acms40390F13/MC-Integration.pdfย ยท 4 [๐‘“ , +2๐‘“ , + 2 +๐‘“( , )] The approximation is of order (( โˆ’ )( โˆ’ )[ โˆ’ 2+(

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

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

๐‘.