But using `sin`, and `radians` means that you equation to generate pi already has pi in it.
But using `sin`, and `radians` means that you equation to generate pi already has pi in it.
You can do the same with 9s, for the same reason you might be picking up on if you don't trivialize that there is another pi in the mix. You can't escape it when you're talking about circular things, regardless.
Every proof or non-coincidental estimate of pi (ie: not 22/7) out there has pi embedded in the proof somehow. Dismissing it is like saying the Pythagorean theorem is bollocks because they also add up to the same number of degrees. Even though you're describing it in lengths, the degrees don't disappear. This code is very much like that. Just not triangular.
It's not (quite) as trivial as just copying the pi.
sin(radians(repeated)) * (10 ** (repeat + 2)) = radians(repeated) * 100 * 1.8 / repeated = repeated * pi / 180 * 180 / repeated = pi
The main and only reason you get pi in the end is that the radians function is defined as radians(x) = pi * x / 180, which requires knowing the value of pi to begin with.So this program is basically an equivalent of
multiply_the_argument_by_pi(555) / 555
except with a few layers of completely unnecessary math on top of it to obscure the magic trick.This was a result of converting degrees to radians. There is another way as well.
from math import sin, acos
def nines(repeat: int) -> float:
repeated = 2 / int('9' * repeat)
value = sin(repeated) * acos(repeated) * (10 ** repeat)
return value
nines(18)
I'm sure this can be edited to accept other values in the same way.Took a while to convince me, but you got there.
value = sin(repeated) * acos(0) * (10 ** repeat)
(keep in mind that that acos(0) = pi/2)