1 kill "sineiter.txt"
2 open "sineiter.txt" for output as #2
10 A0=(sin(#pi/45))^2
20 A=A0:N=0
30 print A0
40 for Iter=1 to 100
50 A=4*A*(1-A)
60 N=N+1
70 print N;" ";A;" ";A-A0
71 print 2,N;" ";A;" ";A-A0
80 next
200 close #2
The answer seems assuredly to be n=12.
When the above was run with about 195-digit precision it was apparent that the difference from a0 was non-zero through a11. Truncated values are:
n difference from a0 (truncated)
1 0.014503186401625726583638
2 0.071109986292572172348799
3 0.275948460976246448815520
4 0.802964772033614297376292
5 0.616094982170619018822108
6 0.936607830800248628557973
7 0.215537582635411742461673
8 0.682437331078741175249369
9 0.854803934540110727219914
10 0.477684286019534671718889
11 0.993916059500697281348468
At n=12 we get
-0.000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000462
as the difference from a0.
At successive multiples of 12, the rounding error accumulates:
n=24
-0.000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000001895733
n=36
-0.000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000007764925473
etc.
Edited on January 8, 2019, 11:23 am
|
Posted by Charlie
on 2019-01-08 11:22:15 |