1 / 2

Problem 5 Pi Again

Problem 5 Pi Again. Monte Carlo methods 使用重複的隨機樣本來模擬複雜的數學和物理系統。給定一發生狀況的事件機率 p ,程式來模擬所發生的狀況。 我們使用隨機數來模擬發生狀況。當事件發生的次數除以隨機發生的狀況數就會逐漸趨近於機率 p 。 使用 Monte Carlo Method 來趨近 Pi 。 = 使用 for loop 來模擬 100, 1000, 10000, 100000, 100000 次。 Note: you need to import random,

tania
Download Presentation

Problem 5 Pi Again

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Problem 5 Pi Again Monte Carlo methods使用重複的隨機樣本來模擬複雜的數學和物理系統。給定一發生狀況的事件機率p,程式來模擬所發生的狀況。 我們使用隨機數來模擬發生狀況。當事件發生的次數除以隨機發生的狀況數就會逐漸趨近於機率p。 使用Monte Carlo Method來趨近Pi。 = 使用for loop來模擬100, 1000, 10000, 100000, 100000次。 Note: you need to import random, And use the random.uniform(a,b) function.

  2. How to generate a random number • Import random • Generate a random x, so that a<=x<=b: x=random.uniform(a,b)

More Related