Post Reply 
mini challenge: find the smallest cosine of an integer
10-24-2021, 12:46 PM
Post: #16
RE: mini challenge: find the smallest cosine of an integer
eps.bat Wrote:@spigot -C "2e%1/pi mod 2" | awk -vFS="/" -ve="e%1" "length($2)>34 {print 1.5708/$2, q1 e; exit} {q1=$2}"

Running this 1 liner overnight, x all the way to 6145 digits, we have a brute force proof Smile

Free42-Decimal: |cos(x)| > 10^-37, any real x

if p1/q1 is valid convergent (odd p1, neighboring p2/q2), then |cos(x)| < ε = (pi/2)/q2
The requirement of q1 being 34 digits is not necessary.

Example, both below suggested the same x (note that 2nd mantissa has 33 digits, not 34)

c:\> eps 5981      → 1.60573e-37 4272221537462525975023616239425960e5981
c:\> eps 5982      → 1.60509e-37 427222153746252597502361623942596e5982

427222153746252597502361623942596e5982 COS ABS → 1.605082938363676519340189975883263e-37

min(|cos(x)|) for integer x (also, for real x)

c:\> eps 1381      → 1.03065e-37 2344813655066356855719930664718056e1381

2344813655066356855719930664718056e1381 COS ABS → 1.030557387629248882465543827418861e-37

eps.bat even work with negative exponent (below is min(|cos(x)|) for non-integer x)

c:\> eps -25       → 1.55097e-35 2589477332551582209163675623249625e-25

2589477332551582209163675623249625e-25 COS ABS → 1.532138639232766081410107492878833e-35

---

eps.bat only get right a little over half the time.
Neighboring convergents cannot both have p1,p2 even → p1 is more likely odd.
see https://www.hpmuseum.org/forum/thread-17...#pid153072

We need to check actual p1/q1, for odd p1 (or, just try cos(x))
For even p1, we may have to settle for semi-convergents, or p0/q0 (p0 guaranteed odd)
(it is highly unlikely to produce small |cos(x)| though, see my previous post)

pq.bat Wrote:@spigot -C "2e%1/pi mod 2" | awk -vS="/" "length-index($0,S)>34 {exit} {print}" | tail -2

Example: this get wrong eps (being conservative is OK; we don't miss anything)

c:\> eps 4639       → 2.06902e-38 9308532438209917461067659354862169e4639
c:\> pq 4639
1528624876453580931164937665986407/8775804805425001620222943906879558 // p0/q0
1621418726123738114106180500221048/9308532438209917461067659354862169 // p1/q1

p1 is even, we have to settle for p0/q0: cos(x = q0*1E4639) ≈ 1.68729e-34
However, this suggested sin(x = q1*1E4639) is very close to 0.

9308532438209917461067659354862169e4639 SIN → -2.069013989544476107762446187843978e-38
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: mini challenge: find the smallest cosine of an integer - Albert Chan - 10-24-2021 12:46 PM



User(s) browsing this thread: 1 Guest(s)