problems22
Number of data points 100,000Value of pi? 3.13992StartTime 10:38:02 AMStopTime 10:38:04 AMElapsed 0:00:02- =StopTime3-StartTime3Press Ctrl-A to start the magic点的数目 100,000pi值? 3.13992开始时间 10:38:02 AM停止时间 10:38:04 AM运行时间 0:00:02- =StopTime3-StartTime3按Ctrl-A来开始程序Number of data points 400,000Value of pi? 3.138892153StartTime 10:39:01 AMStopTime 10:39:02 AMElapsed 0:00:01Update Frequency 10,000(Enter 0 to DISABLE)Press Ctrl-B to start the magic点的数目 400,000pi值? 3.138892153开始时间 10:39:01 AM停止时间 10:39:02 AM运行时间 0:00:01更新频率 10,000(Enter 0 to DISABLE)按 Ctrl-B开始程序Number of data points 10,000,000Area 19.08158Real result 19.08554- =EXP(3)-EXP(0)X EXP(X)0 10.1 1.1051709180.2 1.2214027580.3 1.3498588080.4 1.4918246980.5 1.6487212710.6 1.82211880.7 2.0137527070.8 2.2255409280.9 2.4596031111 2.7182818281.1 3.0041660241.2 3.3201169231.3 3.6692966681.4 4.0551999671.5 4.481689071.6 4.9530324241.7 5.4739473921.8 6.0496474641.9 6.6858944422 7.389056099 Press Ctrl-C to start themagic2.1 8.1661699132.2 9.0250134992.3 9.9741824552.4 11.023176382.5 12.182493962.6 13.463738042.7 14.879731722.8 16.444646772.9 18.174145373 20.08553692E X P (X )00.30.60.91.21.51.82.12.42.7 3051 01 52 02 5XEXP(X)Sub MonteCarlo1()Dim X As Double, Y As Doublen= Range(Number)Hits=0For Index = 1 To nX= RND()*3Y= RND()*20If Y Exp(X) Then Hits= Hits + 1Next IndexRange (Estimate) = (Hits/n)*60End SubE X P (X )00.30.60.91.21.51.82.12.42.7 3051 01 52 02 5XEXP(X)点的数目 10,000,000面积 19.08692真实值 19.08554- =EXP(3)-EXP(0)X EXP(X)0 10.1 1.1051709180.2 1.2214027580.3 1.3498588080.4 1.4918246980.5 1.6487212710.6 1.82211880.7 2.0137527070.8 2.2255409280.9 2.4596031111 2.7182818281.1 3.0041660241.2 3.3201169231.3 3.6692966681.4 4.0551999671.5 4.481689071.6 4.9530324241.7 5.4739473921.8 6.0496474641.9 6.6858944422 7.389056099 按 Ctrl-C开始程序2.1 8.1661699132.2 9.0250134992.3 9.9741824552.4 11.023176382.5 12.182493962.6 13.463738042.7 14.879731722.8 16.444646772.9 18.174145373 20.08553692E X P (X )00.30.60.91.21.51.82.12.42.7 3051 01 52 02 5XEXP(X)Sub MonteCarlo1()Dim X As Double, Y As Doublen= Range(Number)Hits=0For Index = 1 To nX= RND()*3Y= RND()*20If Y Exp(X) Then Hits= Hits + 1Next IndexRange (Estimate) = (Hits/n)*60End SubE X P (X )00.30.60.91.21.51.82.12.42.7 3051 01 52 02 5XEXP(X)Approximately how many runs does it require until you get 4-decimal accurancy for using the MC simulation?4-decimal accurancy about 8.000.0008-decimal accurancy Computer gave up; because 20 minutes and 500,000,000 datas are just enough for a accurancy around 6 decimals16-decimal accurancy Failure!Number of data points 10,000,000Pi? 3.141775200000000000 Differences 0.000182546410206993.14159265358979000StartTime 10:42:48StopTime 10:42:55Elapsed 0:00:07resulting timePress Ctrl-D to start the magicApproximately how many runs does it require until you get 4-decimal accurancy for using the MC simulation?Computer gave up; because 20 minutes and 500,000,000 datas are just enough for a accurancy around 6 decimals用MC模拟值精确到小数点后4位大概需要多少次运行?精确到小数点后4位 大约8.000.000精确到小数点后8位 计算机放弃了; 因为20分钟和500,000,000个数据对于精确到小数点后6位已经足够精确到小数点后16位 失败!Number of data points 10,000,000Pi? 3.141775200000000000 差值 0.000182546410206993.14159265358979000开始时间 10:42:48停止时间 10:42:55运行时间 0:00:07结果时间按 Ctrl-D开始魔法计算机放弃了; 因为20分钟和500,000,000个数据对于精确到小数点后6位已经足够Pi 3.141592653590- =PI()Pi 3.1415decimals 4Decimal accuracy 103071 232 6003 16114 103075 3598636 14610547 178203638 too time consumingPress Ctrl-E to start the magic1 2 3 4 5 6 711 01 0 01 0 0 01 0 0 0 01 0 0 0 0 01 0 0 0 0 0 01 0 0 0 0 0 0 01 0 0 0 0 0 0 0 01 2 3 4 5 6 711 01 0 01 0 0 01 0 0 0 01 0 0 0 0 01 0 0 0 0 0 01 0 0 0 0 0 0 01 0 0 0 0 0 0 0 0Pi 3.141592653590- =PI()Pi 3.1415小数点 4精确的小数点数 103071 232 6003 16114 103075 3598636 14610547 178203638 浪费太多的时间按 Ctrl-E开始魔法1 2 3 4 5 6 711 01 0 01 0 0 01 0 0 0 01 0 0 0 0 01 0 0 0 0 0 01 0 0 0 0 0 0 01 0 0 0 0 0 0 0 01 2 3 4 5 6 711 01 0 01 0 0 01 0 0 0 01 0 0 0 0 01 0 0 0 0 0 01 0 0 0 0 0 0 01 0 0 0 0 0 0 0 0RamanujanN 1Pi from Ramanujan 3.14159273001331000Pi from Excel 3.14159265358979000As you can see, with n = 2, the numbers are exactly the same, even we have here more than 15 digits- =ramanujan(B3)- =PI()As you can see, with n = 2, the numbers are exactly the same, even we have here more than 15 digitsRamanujanN 1Pi from Ramanujan 3.14159273001331000Pi from Excel 3.14159265358979000正如你能够看到的, 当n = 2时,数字基本上是相同的,即使我们在这里多于15位- =ramanujan(B3)- =PI(