estimate_pi2: Simple estimate of pi using a rcpp and our inside function

Description Arguments Value Author(s) Examples

Description

Compute an approximation of pi using simulation and rcpp package to make it faster. The idea is to take a certain number of points (B is the number) that goes from -1 to 1 and store they coordinate (x and y). Then using the fact that a circle has an area of pi we can calculate an aproximation of pi. We take the area of the square which is 4, times the total of point that are in the circle, divided by the total of point (B).

Arguments

B

A numeric (integer) used to denote the number of points in the simulations.

seed

A numeric used to control the seed of the random number generator used by this function.

Value

A list containing the following attributes:

estimated_pi2

Estimated value of pi

points

list of all the point that have been generated, we have their x and y coordinates and inside which tell us if the points is in the circle or outside

Author(s)

Julien Kleinmann, Constance Havret, Lumia Claramunt, Sana Ghali, Azza Akamoun

Examples

1
estimate_pi2( B=5000, seed = 10)

JulienKleinmann/ptds2018hw4g4 documentation built on May 8, 2019, 8:53 p.m.