C# 클래스 Scimark_Csharp_Android.MonteCarlo

Estimate Pi by approximating the area of a circle. How: generate N random numbers in the unit square, (0,0) to (1,1) and see how are within a radius of 1 or less, i.e.
   sqrt(x^2 + y^2) < r 
since the radius is 1.0, we can square both sides and avoid a sqrt() computation:
 x^2 + y^2 <= 1.0 
this area under the curve is (Pi * r^2)/ 4.0, and the area of the unit of square is 1.0, so Pi can be approximated by
 # points with x^2+y^2 < 1 Pi =~ 		--------------------------  * 4.0 total # points 
파일 보기 프로젝트 열기: zanew/MonovsDalvik 1 사용 예제들

공개 메소드들

메소드 설명
integrate ( int Num_samples ) : double
num_flops ( int Num_samples ) : double

메소드 상세

integrate() 공개 정적인 메소드

public static integrate ( int Num_samples ) : double
Num_samples int
리턴 double

num_flops() 공개 정적인 메소드

public static num_flops ( int Num_samples ) : double
Num_samples int
리턴 double