HP Forums

Full Version: [VA] SRC#004- Fun with Sexagesimal Trigs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
.
Hi, all:

Welcome to my brand new SRC#004, this time commemorating that this is my 300th post here so if I'm not mistaken I'll be granted the description "Senior Member" from now on. What a treat ! Wink

Tired of trigs in radians ? Wanna see some trigs in sexagesimal degrees ? Read on !

Details:

If you're in the mood for a nice helping of awesome "sexagesimal" results go and try your hand at accurately evaluating the following trig expressions, either manually or else by writing a short bit of RPN/RPL/71BASIC/HPPL code for your preferred HP calculator (not Excel, Matlab, Mathematica, Python, Java, Haskell, C/C++, Wolfram Alpha, etc., there are many other forums/threads for that), namely:

\[ A = (\sqrt{3}\;+\;tan\;1º)\;(\sqrt{3}\;+\;tan\;2º)\;...\;(\sqrt{3}\;+\;tan\;29º) \]
\[ B = \frac{1}{sin\;45º \; sin\;46º} +\frac{1}{sin\;47º \; sin\;48º} \; + \;...\; + \; \frac{1}{sin\;133º \; sin\;134º} \]
\[ C = \left(1 - \frac{cos\;61º}{cos\;1º}\right) \; \left(1 - \frac{cos\;62º}{cos\;2º}\right) \; ... \; \left(1 - \frac{cos\;119º}{cos\;59º}\right) \]
\[ D = \left(1-\frac{1}{tan\;1º}\right)\;\left(1-\frac{1}{tan\;2º}\right)\; ...\; \left(1-\frac{1}{tan\;44º}\right) \]
\[ E = \left(2\;cos\;2^2º-\frac{1}{cos\;2^2º}\right)\;\left(2\;cos\;2^3º-\frac{1}{cos\;2^3º}\right)\;...\;\left(2\;cos\;2^{25}º-\frac{1}{cos\;2^{25}º}\right) \]
Once you've succeeded in accurately evaluating them you should attempt to identify the results that aren't immediately obvious (i.e.: if you get something like 1.7320508.. you should identify it as \(\sqrt{3}\)), which will be useful to gauge the accuracy obtained by comparing what you got with the exact results, benchmark-like.

You must not use anything other than your intuition and the help of your trusty HP calculator for the identification (in particular give the Internet a miss) but those of you using HP calcs with CAS might want to check if your CAS will produce the exact results at once or if at least it will simplify them to something much .. well, simpler !

Let's see your code, results and comments (try not to spoil early the fun for others), I will post mine within a few days.

V.
.
(02-11-2019 04:13 PM)Valentin Albillo Wrote: [ -> ]You must not use anything other than your intuition and the help of your trusty HP calculator for the identification...

So the use of your great IDENTIFY program is perfectly legal ? :-)

J-F
Amazing expressions !

Programming (especially on the 71) is immediate - no need to post it - , but the identification of the B value stopped me for a while.

J-F
(02-11-2019 09:26 PM)J-F Garnier Wrote: [ -> ]Amazing expressions !

Programming (especially on the 71) is immediate - no need to post it -

Agreed. Same on the 50g.

Gerson.

PS.: Not a spoiler, just a reminder to myself...

ALBINVASINCDLBE++++->51.9999999999
(02-11-2019 09:26 PM)J-F Garnier Wrote: [ -> ]the identification of the B value stopped me for a while.

Here is a good way to estimate B.

Middle term angle is around 90°, any angles bigger than that can be used to fill the "holes":

Example, 1/(sin(133°)sin(134°)) = 1/(sin(47°)sin(46°))

So, B = 1/(sin(45°)sin(46°)) + 1/(sin(46°)sin(47°)) + ... + 1/(sin(89°)sin(90°))

I remember derivative of tan(x) is sec(x)^2 = 1/cos(x)^2

So, change all the sines to cosines, angles goes from 0° to 45°
The x's are in degree, so need to scale the area, like this:

sum ~ (180/Pi) * integrate(sec(x)^2, x, 0, Pi/4) = (180/Pi) * (1 - 0) = 180/Pi

Actual sum is not exactly like this, but should be close.
My guess for true sum is 1/sin(1°), but to prove it is hard ...
(02-11-2019 09:26 PM)J-F Garnier Wrote: [ -> ]Programming (especially on the 71) is immediate - no need to post it -

Well, straightforward programming is indeed immediate and enough to get an idea of the results, but it is possible to do slightly better "in accurately evaluating them"

Let's see on value A.
Straightforward programming:
>A=1 @ FOR I=1 TO 29 @ A=A*(SQR(3)+TAN(I)) @ NEXT I @ DISP A
536870912.011

The rounding error on SQR(3), accumulated on 29 successive iterations introduces a systematic bias.
We can reduce this effect by factoring SQR(3) and evaluating SQR(3)^29 directly:
>A=1 @ FOR I=1 TO 29 @ A=A*(1+TAN(I)/SQR(3)) @ NEXT I @ A=A*3^14*SQR(3) @ DISP A
536870912.002

This gives us more confidence in identifying it to a certain simple integer expression.

J-F
(02-12-2019 08:05 AM)J-F Garnier Wrote: [ -> ]The rounding error on SQR(3), accumulated on 29 successive iterations introduces a systematic bias.
We can reduce this effect by factoring SQR(3) and evaluating SQR(3)^29 directly:
>A=1 @ FOR I=1 TO 29 @ A=A*(1+TAN(I)/SQR(3)) @ NEXT I @ A=A*3^14*SQR(3) @ DISP A
536870912.002

This gives us more confidence in identifying it to a certain simple integer expression.

Right in between:

« 1 1 29
FOR i i DUP + SIN LASTARG COS 1 + / 3 √ + *
NEXT
»

EVAL ->

536870912.006
Prove A = 2^29 = 536870912:

Checking the edges, using shorthand t# = tan(#°):

tan(A°+B°) = (tA + tB) / (1 - tA tB)

(t60 + tA) (t60 + tB), where A+B=30°
= t60^2 + t60*(tA + tB) + tA tB
= t60^2 + t60*t30*(1 - tA tB) + tA tB
= 3 + 1 - tA tB + tA tB
= 2^2

t15 = tan(45° - 30°)
= (t45 - t30) / (1 + t45 t30)
= (1 - 1/√3) / (1 + 1/√3)
= (√3 - 1) / (√3 + 1)
= (√3 - 1)^2 / (3 - 1)
= (3 + 1 - 2*√3) / 2

-> t15 = 2 - √3
-> center = t60 + t15 = 2

14 pairs of edges and 1 center, all can considered value of 2, thus A = 2^29
(02-12-2019 12:14 PM)Albert Chan Wrote: [ -> ]Prove A = 2^29 = 536870912:

Checking the edges, using shorthand t# = tan(#°):

tan(A°+B°) = (tA + tB) / (1 - tA tB)

(t60 + tA) (t60 + tB), where A+B=30°
= t60^2 + t60*(tA + tB) + tA tB
= t60^2 + t60*t30*(1 - tA tB) + tA tB
= 3 + 1 - tA tB + tA tB
= 2^2

t15 = tan(45° - 30°)
= (t45 - t30) / (1 + t45 t30)
= (1 - 1/√3) / (1 + 1/√3)
= (√3 - 1) / (√3 + 1)
= (√3 - 1)^2 / (3 - 1)
= (3 + 1 - 2*√3) / 2

-> t15 = 2 - √3
-> center = t60 + t15 = 2

14 pairs of edges and 1 center, all can considered value of 2, thus A = 2^29

A is the only one I had trouble with because at first I had wrongly programmed it as a sum instead of a product. When I notice my mistake and finally got the correct value, I simply computed its base-2 logarithm in order to check it was a power of two. But only because I had identified D already. For whatever reason I decided to check the product of the first and last terms:

(1 - 1/tan1°)*(1 - 1/tan44°) = 1.99999999997

That’s 2 to me, so I just did 2^22 = 4194304 which “matched” 4194303.99965, the value my D program returned, and I gave it no further thought.

I do appreciate, however, your efforts in going deeper into the problem and providing a proof.

Gerson.
(02-12-2019 12:14 PM)Albert Chan Wrote: [ -> ]Prove A = 2^29 = 536870912:

Checking the edges, using shorthand t# = tan(#°):

tan(A°+B°) = (tA + tB) / (1 - tA tB)

(t60 + tA) (t60 + tB), where A+B=30°
= t60^2 + t60*(tA + tB) + tA tB
= t60^2 + t60*t30*(1 - tA tB) + tA tB
= 3 + 1 - tA tB + tA tB
= 2^2

...

14 pairs of edges and 1 center, all can considered value of 2, thus A = 2^29

Great!

With the same method (and notations), it's easy to prove D = 2^22:

tan(A°+B°) = (tA + tB) / (1 - tA tB)

(1 - 1/tA) (1 - 1/tB), where A+B=45°
= 1 - (1/tA + 1/tB) + 1/(tA tB)
= 1 - (tA + tB) / (tA tB) + 1 / (tA tB)
= 1 - t45 (1 - tA tB) / (tA tB) + 1 / (tA tB)
= 1 - (1 / (tA tB) - 1) + 1 / (tA tB)
= 2

J-F
Prove C = 1:

Using shorthand c(#) = c# = cos(#°), s(#) = s# = sin(#°)

C = (1 - c61/c1)(1 - c62/c2) ... (1 - c119/c59)

center = (1 + c90/c30) = (1 + 0/c30) = 1

Check the edges, each pair P had the form:
= (1 - c(90-x)/c(30-x)) * (1 - c(90+x)/c(30+x))
= (1 - sx / c(30-x)) * (1 + sx / c(30+x))

To simplify P, we need these identities:
cos(A+B) = cos(A)cos(B) − sin(A)sin(B)
cos(A−B) = cos(A)cos(B) + sin(A)sin(B)

Removing the annoying denominator, let k = c(30-x) * c(30+x)

k P
= (c(30+x) - sx) * (c(30-x) + sx)
= k + sx^2 + sx * (c(30+x) - c(30-x))
= k + sx^2 + sx * (-2 s(30) sx)
= k + sx^2 − sx^2
= k
-> P = 1

All factors can considered value of 1, thus C = 1
Prove E = -1:

This one is easy. Just do the first term, using shorthand c(#) = c# = cos(#°)

(2 c4 - 1/c4) = (2 c4^2 - 1) / c4 = c8 / c4

Numerator and denominator for everything cancelled out, except c(2^26)/c(4)

c(2^26) = c(2^26 mod 360) = c184 = -c4

-> E = -c4/c4 = -1
Solutions with RPL. These programs are designed to not be flexible. Only to solve the problem.

Code:
Spoilers for A









<<
DEG 
1 29 FOR j 3 SQRT j TAN + NEXT 
1 28 START + NEXT
>>
Answer: 58.1827673706

Code:
Spoilers for B









<<
DEG 45 1 -> C
<<
DO DUP 2 + 1 'C' STO+ UNTIL DUP 133 == END
C ->LIST DUP 1 ADD SIN SWAP SIN * INV OBJ-> 2 SWAP
START + NEXT
>>
>>
Answer: 57.298688498

Code:
Spoilers for C









<<
DEG
1 59 FOR j j 60 + COS j COS / 1 SWAP - NEXT
1 58 START * NEXT
>>
Answer: 0.999999999989

Code:
Spoilers for D









<<
DEG
1 44 FOR j 1 j TAN INV - NEXT
1 43 START * NEXT
>>
Answer: 4,194,303.99961

Code:
Spoilers for E









<<
DEG
2 25 FOR j 2 j ^ COS 2 * LASTARG DROP INV - NEXT
1 23 START * NEXT
>>
Answer: -0.999999999966

Fun programming.
B = 1/(s45s46) + 1/(s47s18) + ... 1/(s89s90) + 1/(s91s92) + ... + 1/(s133s134)
   = 1/(c44c45) + 1/(c42c43) + ... 1/(c0c1) + 1/(c1c2) + ... + 1/(c43c44)
   = 1/(c0c1) + 1/(c1c2) + 1/(c2c3) + ... + 1/(c44c45)

Proof below statement by induction. If success, it proved B = tan(45°) / sin(1°) = 1/sin(1°)

sum(1/(cos(k°)*cos((k+1)°)), k=0 to n-1) = tan(n°) / sin(1°)

For n=1, 1/(c0c1) = 1/c1 = tan(1°) / sin(1°)

Assume this work for n=k, add 1 more term, we got:

tan(k°) / sin(1°) + 1/(ck c(k+1)) = (sk c(k+1) + s1) / (s1 ck c(k+1))

Since s1 = s((k+1) - k) = s(k+1) ck - c(k+1) sk, we got:

Sum of k+1 terms = (s(k+1) ck) / (s1 ck c(k+1)) = tan((k+1)°) / sin(1°)

QED

Update: above general formula work in any angle unit, not just degrees.
.
Hi, all:

A short proof of the evaluation of B:\[ B = \frac{1}{sin\;45º \; sin\;46º} +\frac{1}{sin\;47º \; sin\;48º} \; + \;...\; + \; \frac{1}{sin\;133º \; sin\;134º} = \frac{1}{sin\;1º} \]1) First, we multiply both sides by sin 1º: \[ \frac{sin \;1º}{sin\;45º \; sin\;46º} +\frac{sin \;1º}{sin\;47º \; sin\;48º} \; + \;...\; + \; \frac{sin \;1º}{sin\;133º \; sin\;134º} = \frac{sin \;1º}{sin\;1º} = 1 \]2) Now we use the identity
\[ \frac{sin((k + 1)º - kº)}{sin\;kº\;sin(k + 1)º} = cot\;kº - cot(k + 1)º \]which transforms the left-hand side into this: \[ cot\; 45º - cot\; 46º + cot\; 47º - cot\; 48º +···+ cot\; 133º - cot\; 134º \]3) Then we reorder the terms in the sum like this: \[ cot \;45º - (cot \;46º + cot \;134º) + (cot \;47º + cot \;133º) - ··· + (cot \;89º + cot \;91º) - cot \;90º \]4) All the terms inside the parentheses cancel out because they feature supplementary angles ( cot Nº + cot (180º-Nº) = 0 ), so the expression reduces to: \[ cot \;45º - cot \;90º = 1 -0 = 1 \]
Q.E.D. Smile

Thanks for your interest and have a nice weekend.
V
.
Reference URL's