
-----------------------------------
BenLi
Tue Oct 24, 2006 8:25 pm

pi
-----------------------------------
This has to be the most retarded thing i've ever posted... but entertaining (and interesting) nonetheless


setscreen ("graphics:max;max")

var x := 0

drawfilloval (maxx div 2, maxy div 2, maxy div 2, maxy div 2, black)

for i : 1 .. maxx
    for n : 1 .. maxy
        if whatdotcolor (i, n) = black then
            x += 1
        end if
    end for
end for
put "pi is: ", x / (maxy div 2) ** 2
[/quote]

-----------------------------------
ericfourfour
Tue Oct 24, 2006 9:33 pm


-----------------------------------
That was pretty funny. I didn't even go over the source before I ran it because it looked like another flashy program (it was like 10 lines with 1 draw in a loop) but then all I saw was a big black circle. Then I actually looked at the source and wow. That is one of the most original ways of finding pi ever.

-----------------------------------
Tony
Tue Oct 24, 2006 9:42 pm


-----------------------------------
well since the accurasy increases with the size of the circle, it would be interesting to see this done in a loop for circle radius from 1 to maxx/2, with something like


put "Radius: ", i, " pi:", num, " Error: ", (PI - num)/PI


and perhaps some graphs of the resulting data :D

-----------------------------------
Zacebdal
Wed Oct 25, 2006 3:08 pm

Is it just me?
-----------------------------------
Is it just me, or maybe i just dont understand but if this is used to find the mathematical value of pi, it is incorrect. Pi, as far as i know and im proud of knowing it :),is approximately 3.14159265358979. so maybe im just doing something wrong but anyways....

-----------------------------------
BenLi
Wed Oct 25, 2006 4:16 pm


-----------------------------------
consider this: with 50 digits of pi, you are able to calculate the biggest circle possible in the observable universe down to the error margin of a single proton. The inversely, you would need a circle as big as the universe to calculate pi to 50 digits (unless you use a computer to simulate this). So obviously this program wouldn't be accurate since the circle is only the size of your moniter. Its accurate to tw digits though! lol

-----------------------------------
Clayton
Wed Oct 25, 2006 4:16 pm


-----------------------------------
It's because the circle isn't big enough to get that degree of accuracy. To get that good of a degree of accuracy you would have to have a HUGE circle to calculate from.

-----------------------------------
ZeroPaladn
Thu Oct 26, 2006 12:46 pm


-----------------------------------
googled it. not sure if it is a reliable source, but i found it cool anyways...

here it is, pi to a billion decimal places.

http://3.141592653589793238462643383279502884197169399375105820974944592.com/index1.html

-----------------------------------
Silent Avenger
Thu Oct 26, 2006 3:45 pm


-----------------------------------
Now how do you know that all those decimal places are correct? Now just for laughs I'm going to print off the first page and show it to my Geometry teacher.

-----------------------------------
iamcow
Thu Oct 26, 2006 4:44 pm


-----------------------------------
not sure if it is a reliable source

i think that means he's not sure

-----------------------------------
Silent Avenger
Thu Oct 26, 2006 6:00 pm


-----------------------------------
I meant that question to be a rhetorical question, of course the site will most likely be unreliable.

-----------------------------------
[Gandalf]
Thu Oct 26, 2006 6:59 pm


-----------------------------------
Eh... What?
"Hmm... Why don't I make a website that outputs random numbers claiming to be pi..  Sounds good."

And, Zacebdal, just to show how much work it takes to calculate pi, here's the accuracy after just under one billion iterations of pi = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11...:
3.141592652587059
Compared to the real approximation:
3.141592653589793

-----------------------------------
Silent Avenger
Thu Oct 26, 2006 9:50 pm


-----------------------------------
"]Eh... What?
"Hmm... Why don't I make a website that outputs random numbers claiming to be pi..  Sounds good." I'm not saying it is an unreliable source but it could be. I also find the site has no real point to it because most people only really need pi to the accuracy of 8 decimal places. Now I'm not saying that everybody needs pi to only 8 decimal places because some could use more or less.

-----------------------------------
[Gandalf]
Fri Oct 27, 2006 2:53 pm


-----------------------------------
of course the site will most likely be unreliable.
Sounds pretty definite to me.

And why not have pi to some large number of decimal places?  It's been computed, so why not make it available for everyone to use whenever?  Even if it's just for curiosity.

-----------------------------------
Silent Avenger
Fri Oct 27, 2006 10:48 pm


-----------------------------------
I guess there is no reason to not have pi to a billion decimal places but who would use that many decimal places anyway? (this is a rhetorical question you don't actually need to answer)

-----------------------------------
Andy
Sun Oct 29, 2006 5:00 am


-----------------------------------
to find pi, just do an taylor expansion of tan(x). there are faster ways of approximating pi than that gandalf =P

-----------------------------------
Cervantes
Sun Oct 29, 2006 10:17 am


-----------------------------------
to find pi, just do an taylor expansion of tan(x). there are faster ways of approximating pi than that gandalf =P

I did that a while back, and I got 15 decimal places of accuracy just from Microsoft's calc.exe. I think 15 was the number of decimal places it displayed.

My question is, is this approach really valid? tan x = sinx / cosx. sinx and cosx come from circles, right? So aren't we using a bit of circular (oh, oh, pun!) reasoning here?

I know sinx and cosx can be approximated by a Taylor series, but my question still remains.

-----------------------------------
Windsurfer
Mon Oct 30, 2006 7:06 pm


-----------------------------------
to find pi, just do an taylor expansion of tan(x). there are faster ways of approximating pi than that gandalf =P
Ha. I've experienced that. On my Ti-83 Plus, I had a basic program that would use that one Gandolf said, and it would take forever to find the first 5 digits. I think it was like 500 iterations? Can't remember.
But then I implemented the taylor expansion method (or something similar) and my calc ran out of digits on the 12th or 14th iteration, so less than 2 seconds :P

-----------------------------------
Andy
Mon Oct 30, 2006 9:23 pm


-----------------------------------
but cervantes, you're not using sin(x) and cos(x) to calculate values.

tan(x) = sin(x)/cos(x)

and sin(x) can be expanded into sin(x) = x - x3/3! + x5/5! - x7/7! + ... 
and cos(x) into cos(x) = cos(x) = 1 - x2/2! + x4/4! - x6/6! + ...

then you just need to do a long division

so you're not cheating at all =P

-----------------------------------
Cervantes
Tue Oct 31, 2006 12:37 am


-----------------------------------
How did we get those series for sin(x) and cos(x)? 

I think I detect sarcasm in your last sentence there, right? So this method is using circular reasoning, yes? Or does it matter? Since we don't necessarily need a value for pi to find values for sin(x). Or do we?

-----------------------------------
Andy
Tue Oct 31, 2006 1:28 am


-----------------------------------
you use taylor's theorum to get those series. 

you dont actually need to know the value of pi to determine what sin(pi) and cos(pi) is.
