Re: Calculating Pi
- From: "Proginoskes" <CCHeckman@xxxxxxxxx>
- Date: 14 May 2006 23:45:53 -0700
foulbr3@xxxxxxxxx wrote:
Here is a nice way to calculate pi:
f(x) = x + sin x
g(x) = f(f(f(...f(x)...)))
g(1) = pi
It works like this: when you take the sine of a small angle, the result
is the small angle. If I have a guess for pi then, and it is off by a
small quantity, we can get the difference between the quantity and pi
and add it.
Seems to work :-)
Now I have a question. Does this converge fast or slow? How can I
determine complexity or prove that each iteration doubles the precision
for example?
Answered already.
I have another method of calculating pi that finds the area of an
n-sided polygon inscribed in a circle. This method leads naturally to
my own method for computing "sine" with arbitrary precision. It uses
square roots which is binary searched to find and the number of sides
of the polygon increases until we "find" the parameter x on the circle,
at which point sin(x) is also known.
Converges slowly. Using this proceedure, it took centuries to get pi to
even 30-some decimal places.
Anyone have any comments? I do not know advanced theories about orbits.
Can you enlighten me about this algorithm for pi of mine? Why does it
REALLY work? How fast is it? The idea is that if x is very nearly pi
then sin x is very nearly 0. The difference between pi and x is
reported as the result of sin(x) if the difference is small, so if we
add it we get pi! Actually we only approximately get pi since sinx
almost equals x for small x but not quite.
If g(x) is defined, then
g(x) = f(f(f(...(x)...))) = f(g(x)),
so g(x) is a "fixed point" of f. (A fixed point of a function F is an
number y such that
F(y) = y.) If x is a fixed point of f(x) = x + sin(x), then
x = f(x) = x + sin(x), so sin(x) = 0.
That means that g of anything, if defined, must be an integral multiple
of pi. (These are the only values of x such that sin(x) is 0.)
Evidently, when x = 1, then g(x) exists and is pi itself.
All of this is assuming that g(x) exists. If you start off with the
function
f(x) = -x,
then g(1) is undefined, since
f(1) = -1
f(f(1)) = f(-1) = 1
f(f(f(1))) = f(1) = -1,
and we keep alternating between 1 and -1.
--- Christopher Heckman
.
- References:
- Calculating Pi
- From: foulbr3
- Calculating Pi
- Prev by Date: Re: Recurrence for Selection Algorithm
- Next by Date: Re: rock-scissors-paper game
- Previous by thread: Re: Calculating Pi
- Next by thread: Re: Calculating Pi
- Index(es):
Relevant Pages
|
Loading