Author |
Topic: Is Pi different? (Read 1664 times) |
|
Benoit_Mandelbrot
Junior Member
Almost doesn't count.
Gender:
Posts: 133
|
Pi might be different than we thought, according to my math programs. Here is what I am doing. I want to find a fast algorithm for pi on my own. I'm using sin(x)=0, and thinking x=[pi]. So I used the newtonian method to calculate roots, and I got xn+1=xn-tan(xn) with x0=3.142. Since my math programs can do anything to arbitrary precision, I came up with 61 digits. But the thing is no matter how many iterations I did, the same result kept comming up. So now I thought to develop another algorithm, and I'm using tan(x)=0. Applying the newtonian method, I got xn+1=xn-sin(xn)*cos(xn) with x0=3.142. This method converged on [pi] to 60 decimals in three iterations. Why doesn't my x-tan(x) method work? Check the attachment pic for what was happening. By the way, the last argument specifies how many iterations are done.
|
« Last Edit: Jan 19th, 2004, 11:31am by Benoit_Mandelbrot » |
IP Logged |
Because of modulo, different bases, and significant digits, all numbers equal each other!
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Is Pi different?
« Reply #1 on: Jan 19th, 2004, 10:36am » |
Quote Modify
|
try using explicitly sin(x)/cos(x) iso tan(x).. I'm curious if there's a difference there..
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Is Pi different?
« Reply #2 on: Jan 19th, 2004, 10:54am » |
Quote Modify
|
heh.. if I insert the end value you get with tan(x) as the starting value in the one with sin(x)cos(x) I get a slightly different answer from the other two.. Also, if you take 3.141 as starting value with the tan(x) version, you do get all digits correct.. Somehow I don't think it's reasonable to expect more than half the digits to be correct.
|
« Last Edit: Jan 19th, 2004, 11:02am by towr » |
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Benoit_Mandelbrot
Junior Member
Almost doesn't count.
Gender:
Posts: 133
|
|
Re: Is Pi different?
« Reply #3 on: Jan 19th, 2004, 11:39am » |
Quote Modify
|
Is it possible that the Newtonian method doesn't work when the precision digits gets larger? Can the Newtonian method be wrong? I tried the same thing with Mathematica's Nest function, and got the same thing. Because the next result is closer to [pi] then the previous, it shouldn't matter if we start with 3.142 or 3.141. Perhaps x0 must always be less than [pi]. After I initially posted, I noticed that sin(x)cos(x)=sin(2x)/2. Will that make any difference? I can't test any of this stuff because Derive 5 is at home, and I'm at school during the day. There are security settings that prevent the installation of Derive at school.
|
« Last Edit: Jan 19th, 2004, 11:43am by Benoit_Mandelbrot » |
IP Logged |
Because of modulo, different bases, and significant digits, all numbers equal each other!
|
|
|
lochnesshamster
Newbie
Posts: 2
|
|
Re: Is Pi different?
« Reply #4 on: Jan 19th, 2004, 12:28pm » |
Quote Modify
|
>Is it possible that the Newtonian method doesn't work when the precision digits gets larger? No, though there are certain circumstances when it doesn't converge. This doesn't appear to be one of them, though-- since it does converge, just to the wrong number. >I noticed that sin(x)cos(x)=sin(2x)/2. Will that make any difference? Well, it requires one less evaluation of a trig function, which will make your algorithm faster. But, like you said, they're equal, so it *shouldn't* make any difference. If it does make a difference, then I would begin to suspect that the program you are using is lying about the amount of precision it has. I'm not sure what advice to give you. Maybe tan() requires even more digits of internal precision to give you an answer with 60 real digits. You could try increasing the precision beyond 60 and see if it affects the answer at all. Sorry I can't help otherwise!
|
|
IP Logged |
|
|
|
Sameer
Uberpuzzler
Pie = pi * e
Gender:
Posts: 1261
|
|
Re: Is Pi different?
« Reply #5 on: Jan 19th, 2004, 12:46pm » |
Quote Modify
|
I would assume any formula conversions you do will affect your result. Why? Something called finite register effect. Every calculating machine has to store numbers in what we call registers (flip flops) and it defines finite amount of bits to do that. Ultimately your choice of formula will affect it. Ok so now concentrating on the original problem: I was looking at the graph of sin(x), cos(x) and tan(x) between pi/2 and 3*pi/2 with pi as the middle point. Obviously 3.142 falls on the right of the mid point whereby sin is decreasing and cos is trying to increase. I would say this is why that formula is failing. Have you tried with 3.140 ? I believe it should converge nicely in 3 iterations. Still thinking about other possible reasons.
|
|
IP Logged |
"Obvious" is the most dangerous word in mathematics. --Bell, Eric Temple
Proof is an idol before which the mathematician tortures himself. Sir Arthur Eddington, quoted in Bridges to Infinity
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Is Pi different?
« Reply #6 on: Jan 19th, 2004, 12:48pm » |
Quote Modify
|
The problem is quite simple, tan(x) is 0 in 61 digits precision for a whole range of x. And the same goes for sin(x)cos(x). Sometimes you're lucky and get the 'right' answer, and in other cases you get the 'wrong' answer. In both cases though it has converged as far as it can, since the answer doesn't change on the next iteration. And in both cases it's the _right answer_ (there's a range of right answers), you're just expected a higher precision in the end result than you ought to.
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Rezyk
Junior Member
Gender:
Posts: 85
|
|
Re: Is Pi different?
« Reply #7 on: Jan 19th, 2004, 1:06pm » |
Quote Modify
|
Can someone try running these commands on the program (and comparing it to the theoretical answers given)? Code: PrecisionDigits := 61 y := ITERATE(x-TAN(x), x, 3.142, 1000) y 3.141592653589793238462643383279506696523846127483096363777488 TAN(y) .000000000000000000000000000000003812326676728107990542802543.. y-TAN(y) 3.14159265358979323846264338327950288419716939937510582097494.. ITERATE(x-TAN(x), x, y, 1) 3.14159265358979323846264338327950288419716939937510582097494.. ITERATE(x-TAN(x), x, 3.142, 1001) 3.14159265358979323846264338327950288419716939937510582097494.. |
|
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Is Pi different?
« Reply #8 on: Jan 19th, 2004, 1:24pm » |
Quote Modify
|
I get tan(y)=0, not .000000000000000000000000000000003812326676728107990542802543.. (I also get sin(y)=0)
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Rezyk
Junior Member
Gender:
Posts: 85
|
|
Re: Is Pi different?
« Reply #9 on: Jan 19th, 2004, 2:24pm » |
Quote Modify
|
I presume the program will also claim that TAN([pi])=0. Then the program's tangent function just isn't providing as much accuracy as expected in this case... The slope of tangent is >=1 throughout this interval, so the difference between TAN(y) and TAN([pi]) is at least (y-[pi]) and should be observeable with the given precision, instead of both showing as 0.
|
« Last Edit: Jan 19th, 2004, 2:31pm by Rezyk » |
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Is Pi different?
« Reply #10 on: Jan 19th, 2004, 2:35pm » |
Quote Modify
|
on Jan 19th, 2004, 2:24pm, Rezyk wrote:I presume the program will also claim that TAN([pi])=0. |
| well yes.. it is after all.. Quote:Then the program's tangent function just isn't providing as much accuracy as expected in this case... |
| If I set the precision higher (even just one digit, to 62) it does show the difference, so in the calculation up to at least about 30 digits of the 61 digit precision get lost..
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Rezyk
Junior Member
Gender:
Posts: 85
|
|
Re: Is Pi different?
« Reply #11 on: Jan 19th, 2004, 2:48pm » |
Quote Modify
|
I wonder what the program would draw for the graph of tangent between the 2 points... It would have to either give more accurate readings or obscenely distort tangent's shape.
|
|
IP Logged |
|
|
|
Benoit_Mandelbrot
Junior Member
Almost doesn't count.
Gender:
Posts: 133
|
|
Re: Is Pi different?
« Reply #12 on: Jan 20th, 2004, 6:06am » |
Quote Modify
|
I found out how to get all digits correct up to how much you want. The thing is to get more decimal places for pi, you'd need to start with a more accurate approximation for pi, based on ceiling(n/25)=m where n is the number of decimals and m is the number needed to start with. Using this method, I was able to get 1000 digits correct with my algorithm.
|
|
IP Logged |
Because of modulo, different bases, and significant digits, all numbers equal each other!
|
|
|
|