Skip to content

mehdi-es-shahkar/pi_random

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Consider a circle centered at the origin of two-dimensional coordinates and with radius 1. Now consider the quadrant perpendicular to the first region, that is, the region where both x and y values ​​are positive. Also consider a square with side 1 formed by the intersection of the coordinate axes and the lines x =1 and y =1. If we randomly select a point from this square, the probability that this point lies inside the quadrant is equal to the ratio of the area of ​​the quadrant to the area of ​​the square. The area of ​​a square is 1 × 1 and the area of ​​a quadrant is (pi / 4 × 1 × 1), so this probability is equal to pi / 4. Now we will simulate this with Python and calculate the value of the pi number , using this method.

About

calculate pi with random function

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages