Randomly Throwing Things to Estimate Pi (Summer 2023)

[b][i]Did you know you can estimate [/i][/b][math]\pi[/math][b][i] by randomly throwing darts at a circle inscribed in a square? Press the play button below to run a simulation.[/i][/b]
[b][i]Here's how to make a simplified version of the simulation. Enter the following in different lines of the input bar below.[/i][/b][br][br]1) poly1=Polygon((-1,-1),(1,-1),4)[br][br]2) x^2+y^2=1[br][br]3) n=Slider(1,1000,1)[br][br]4) l1=Sequence(RandomPointIn(poly1),k,1,n)[br][br]5) l2=Sequence(If((x(Element(l1,k)))^(2)+(y(Element(l1,k)))^(2)>1,0,1),k,1,n)[br][br]6) a=Sum(l2)[br][br]7) PiEstimate=((4 a)/(n))[br]
[b]Once your simulation is working, you can:[/b][br]Edit the colors of the square and points (choose your favorites).[br]Edit the slider, to see even more points. Does this impact the estimate of [math]\pi[/math]?
[justify][/justify][b]You can even [i]randomly[/i] throw frozen hot dogs at parallel lines and get an estimate of [/b][math]\pi[/math][b]. Press the play button below to run a simulation.[/b]

Information: Randomly Throwing Things to Estimate Pi (Summer 2023)