Calculation of Pi Using the Monte Carlo Method by Mathematica
由 養花種魚數月亮賞星星 於 2008年11月27日星期四
下午1:21 發表
MonteCarlo=Table[{Random[],Random[]},{i,10000}];
ListPlot[Select[MonteCarlo,#[[1]]^2+#[[2]]^2<=1&], PlotStyle->RGBColor[1,0,0],AspectRatio->1];
ListPlot[Select[MonteCarlo,#[[1]]^2+#[[2]]^2>1&],AspectRatio->1];
Show[%,%%];
GraphicsRow[{Graphics[%],Graphics[%%],Graphics[%%%]}]
讀者回應 ( 0 意見 )
訂閱發佈留言 (Atom)
發佈留言
Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.
如果這篇文章對你有幫助,那請留個訊息給我~