Happy Pi Day!
Hello everyone!
Some people on the Replit Discord pointed out to me that it was Pi Day, but I hadn't made anything special. So, I came up with this idea - a program which calculates pi using random numbers and includes a nice visual of what it does!
Here's how it works:
Consider the square to have a side length of 2, and an area of 4. The circle has a radius of 1, and an area of π. Each point is chosen at a random position within the square. The chances of a point falling inside the circle are π/4, so to find the value of π, simply multiply the fraction of points which are inside the circle by 4.
I hope you enjoy - let me know the values for pi that you calculate with this!
Thanks to @Spotandjake for helping me fix a bug regarding canvas sizing.
cookie stfu and just updoot it
ok
@Coder100 lmao I really wish there was a downdoot just for fun lmao
@Spotandjake yeah that would be cool
@potatojs it could go very bad I think it should be an option though like you can enable it for your posts
UPDOOT @Coder100
lol, kewl!
It appears that the equation you used is 4 inCircle / total, shouldn't it be 4 (inCircle / total) or am I missing something?
@doineednumbers those two expressions are the same :)
@AJDevelopment :0 is this a very zoomed-in image of the program?
kewll
@zplusfour thanks
@minx28 np :)
It looks like a color-blind test thing lol
What?? is?? that??
lol! I just randomly liked the bottom comment. LOL
I found the article you got this info from!
@BotProgrammer uh, I didn't get this info from an article. It's a very basic method and I'm sure there are hundreds if not thousands of articles on it.
bruh.
You mean -
"Mar 19 day?" mar is march?
omg the value of pi is 3.15! 0_0
Wow this is really smart!
@KrazyOrange thanks, though I didn't come up with the idea myself. I've seen many different implementations of it in the past
lol funny that im commenting from a raspberry pi XD
kewl repl!
LOL @TheC0derGirl !!!!!!!!!!
@TheC0derGirl nice, and thanks
It would take one year MILLIONS OF YEARS for It to actually reach
the quintillion digits!!
@Gh0stHack3r I doubt it would ever reach that with randomness.
WoW that Is cool....
i'm a day late but this is actually a really cool way of doing it, take my upvote minks minx
@oignons thanks (dw I'm now even later)
WHO HAD A PERFECT CIRCLE?
@LegendaryWolf yeah that's the point...
@pythonPOG :rofl:
@LegendaryWolf me, when I left it running overnight
The first few digits of pi: 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679...
this is so cool!
liking this on pi day at 3:14:
big brain moments 2021
btw today is einstein's birthday :D
Also minx lol you don't need to thank me for fixing it lol I literally added two lines lmao thanks anyways but not needed really lol.
Dang, it's already been a year...
Interesting
@JDOG787 thanks
@minx28 it is interesting I wish you could make it faster lol though maybe a pre calculated map lol or something.
@Spotandjake no he can just add multipule points per frame!
something like that
@potatojs he could for sure lol but eventually it gets slow a precomputed map is good for speed lol
lol there is a much more beautiful and unexpected way which is:
if you take 2 random integers, the probability that they are co factor (share a gcd bigger than 1) is 6/PI²
isn't that absolutely gorgeous!
@potatojs yes, I have heard of that. It is very nice, but harder to implement, and also doesn't have an obvious visual representation like this does.
@minx28 ah ok but the method you used is still cool
happy pie day everyone hey lets make this happen https://www.change.org/p/rename-science-and-stuff-rename-science-n-stuff-to-math-with-minx
maths*
@k9chelsea2 I don't know how to rename lol
@Spotandjake ehhh why? is he a teacher or something idk
@potatojs lol it is a joke from the discord sort of lol
@k9chelsea2 maths is british english, math is american english
@Spotandjake ok, i'm in
@Kookiez
"british english" --> "correct english"
"american english" --> "english with mistakes"
(thanks for the updoot though)
@minx28 it really is tho lol
@k9chelsea2 wdym i know engrish very well and he's right!
@potatojs minx I's brit lol I canadian so it is really just a different way of speaking lol I would argue both are correct lol and maths is more correct lol and I know engrish too lol it is my favourite language lmao
@Spotandjake haha ok, but maths is rightyou said lol way too many times are you okay?
@potatojs I like to laugh I see know problem in that I think laughing is good to be honest.
@Spotandjake lol i was jk
"british english" --> "correct for british people"
"american english" --> "correct for american people"
Look no one is going to know what a biscuit is in the USA. Heck the only reason I know what it is is because I utilize Google.
@FlaminHotValdez i would argue that british terms with the internet have made there way around lol, just less common. i would argue that maths is more correct tbh but I would argue that it should be linguistics and sciences as well at the end of the day lol I say math because it is more familiar and I am talking about the subject as a whole not the plural of rules that it defines lol.
@FlaminHotValdez a biscuit is a breakfast food. in britain, they're cookies, which doesn't make sense to me because biscuits are nothing like cookies. Wait, now i'm confused with myself
@Kookiez lol it makes a lot of sense i just think you consider a cookie to be only a sweet lol when it is really just a form of pastry lol.
Chuck Norris's PIN is the last 4 digits of PI.
@ch1ck3n
Ah yes, I figured that out ages ago. It's ####ARR ROBLOX CENSOR!@tussiez #####################
@###### ##########################################
@tussiez @ch1ck3n pi is irrational.
@220723j Wrong! #######################
@ch1ck3n @tussiez ####### ######### ##
@######## #### ####### ################ ################# ###############
@tussiez 3.14159265358979323?
@####### ## ### ###### ##### #### ####
@220723j that's the joke lol
@220723j 3.14159265358979323846 (i recited it lol)
@Hyderite 3.14159265358979323846264338327950
@FuturisticIdiot how lol
@220723j wtf
woooosh @220723j