Pi: comment cleanups
This commit is contained in:
parent
315869de4d
commit
f7f40fc070
@ -14,6 +14,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import math
|
import math
|
||||||
@ -25,19 +26,21 @@ import MySQLdb as mdb
|
|||||||
from Module import Module
|
from Module import Module
|
||||||
|
|
||||||
class Pi(Module):
|
class Pi(Module):
|
||||||
"""
|
|
||||||
Use the Monte Carlo method to approximate pi. Each time this method is called,
|
|
||||||
it calculates a random point inside a square on the xy plane. If that point also
|
|
||||||
falls within a circle bound within that square, it is added to the count of points
|
|
||||||
inside. Over time, 4 * count_inside / count approaches pi.
|
|
||||||
|
|
||||||
Idea from #linode on OFTC. Code from http://www.eveandersson.com/pi/monte-carlo-circle
|
"""Use the Monte Carlo method to approximate pi.
|
||||||
|
|
||||||
|
Each time this method is called, it calculates a random point inside a
|
||||||
|
square on the xy plane. If that point also falls within a circle bound
|
||||||
|
within that square, it is added to the count of points inside. Over time,
|
||||||
|
4 * count_inside / count approaches pi.
|
||||||
|
|
||||||
|
Idea from #linode on OFTC.
|
||||||
|
Code from http://www.eveandersson.com/pi/monte-carlo-circle
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def db_init(self):
|
def db_init(self):
|
||||||
"""
|
"""Initialize database tables."""
|
||||||
Initialize database tables.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# init the database if pi table doesn't exist
|
# init the database if pi table doesn't exist
|
||||||
version = self.db_module_registered(self.__class__.__name__)
|
version = self.db_module_registered(self.__class__.__name__)
|
||||||
|
Loading…
Reference in New Issue
Block a user