--PI/4 == 1 - 1/3 + 1/5 - 1/7 + 1/9... - Just a note I made while developing it, it might still be useful...
function pi(precision) -- Type in the console "pi(no. of steps)" - It takes 1000000+ to be fairly accurate
pival = 1
isNegative = 1
k = 0
calc = 3
while k < precision do -- Rerun the calculation, adding accuracy each time, for precision # of steps.
pival = pival - (1/calc) * isNegative -- This is the 1 - 1/3 + 1/5 - 1/7...part.
calc = calc + 2 -- This is the 3, 5, 7 part.
isNegative = -isNegative -- This is the + - alternation part.
k = k + 1 -- How many steps it's run
end
tpt.log(pival * 4) -- Log the calculated value to console
end
It will probably give you an "Error - Script not responding": Ignore it. It actually is responding ('precision' # of times).
This script may not be of much use, but I'm still really proud of it: No flaming please :)
Gave me 3.1415926358123, but if you let it run longer, it will do better.
Well, pi is closer to 3.1415926535897 than 3.1415926358123...and how might you get more digits out of it?
How do you do that?
OK, so it's just a novelty.