[VA] SRC#004- Fun with Sexagesimal Trigs
02-11-2019, 04:13 PM
Post: #1
 Valentin Albillo Senior Member Posts: 300 Joined: Feb 2015
[VA] SRC#004- Fun with Sexagesimal Trigs
.
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 !

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, 07:55 PM
Post: #2
 J-F Garnier Member Posts: 294 Joined: Dec 2013
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
(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
02-11-2019, 09:26 PM
Post: #3
 J-F Garnier Member Posts: 294 Joined: Dec 2013
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
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:51 PM (This post was last modified: 02-12-2019 01:37 AM by Gerson W. Barbosa.)
Post: #4
 Gerson W. Barbosa Senior Member Posts: 1,116 Joined: Dec 2013
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
(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-12-2019, 03:37 AM (This post was last modified: 02-14-2019 02:39 AM by Albert Chan.)
Post: #5
 Albert Chan Senior Member Posts: 549 Joined: Jul 2018
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
(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-12-2019, 08:05 AM (This post was last modified: 02-12-2019 08:37 AM by J-F Garnier.)
Post: #6
 J-F Garnier Member Posts: 294 Joined: Dec 2013
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
(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, 09:50 AM (This post was last modified: 02-12-2019 09:50 AM by Gerson W. Barbosa.)
Post: #7
 Gerson W. Barbosa Senior Member Posts: 1,116 Joined: Dec 2013
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
(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
02-12-2019, 12:14 PM
Post: #8
 Albert Chan Senior Member Posts: 549 Joined: Jul 2018
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
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, 01:23 PM
Post: #9
 Gerson W. Barbosa Senior Member Posts: 1,116 Joined: Dec 2013
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
(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, 02:00 PM
Post: #10
 Albert Chan Senior Member Posts: 549 Joined: Jul 2018
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
(02-12-2019 08:05 AM)J-F Garnier Wrote:  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

3^14.5 may be more accurate than 3^14 * √ (3), avoided 1 rounding.
Example, on my HP-12C:

3 [Enter] 14.5 [X^Y] => 8,284,345.319
3 [Enter] 14 [X^Y] 3 [√X] x => 8,284,345.321

It may be more accurate to do corrections to A:

lua> function t(a) return math.tan(math.rad(a)) end
lua> sqrt3 = math.sqrt(3)

lua> a = 1
lua> for i=1,29 do a = a * (1 + t(i) / sqrt3) end
lua> a * 3^14.5
536870912.0000006

lua> a = 3^14.5
lua> for i=1,29 do a = a + a * t(i) / sqrt3 end
lua> a
536870912
02-12-2019, 02:11 PM
Post: #11
 J-F Garnier Member Posts: 294 Joined: Dec 2013
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
(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
02-12-2019, 02:42 PM (This post was last modified: 02-12-2019 03:28 PM by Albert Chan.)
Post: #12
 Albert Chan Senior Member Posts: 549 Joined: Jul 2018
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
(02-12-2019 02:11 PM)J-F Garnier Wrote:  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

Neat! Perhaps this version is more elegant:

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

X = (1 - 1/tA) (1 - 1/tB)
tA tB X = (tA - 1) (tB - 1) = (tA tB + 1 - tA - tB) = 2 tA tB
X = 2

Bonus: For A+B=45°, we now have more accurate way to do 1 - tA - tB:

Example, on my Casio FX-115MS:
1 - t0.01 - t44.99 = 1.74472016000e-4 (with all internal digits)
1 - t44.99 - t0.01 = 1.74472015029e-4 (slightly better)
t0.01 * t44.99 ﻿ ﻿﻿ ﻿ ﻿ ﻿ = 1.74472014117e-4 (last digit should rounded to 8)
02-12-2019, 04:39 PM (This post was last modified: 02-12-2019 04:41 PM by Albert Chan.)
Post: #13
 Albert Chan Senior Member Posts: 549 Joined: Jul 2018
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
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
02-12-2019, 05:58 PM
Post: #14
 Albert Chan Senior Member Posts: 549 Joined: Jul 2018
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
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
02-14-2019, 02:12 AM (This post was last modified: 02-14-2019 02:21 AM by Albert Chan.)
Post: #15
 Albert Chan Senior Member Posts: 549 Joined: Jul 2018
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
(02-12-2019 03:37 AM)Albert Chan Wrote:  B = 1/(sin(45°)sin(46°)) + 1/(sin(46°)sin(47°)) + ... + 1/(sin(89°)sin(90°))

I got the prove !!!

Prove B = 1/sin(1°), using shorthand c(#) = c# = cos(#°), s(#) = s# = sin(#°):

Identities required:
cos(A+B) = cos(A)cos(B) − sin(A)sin(B)
cos(A−B) = cos(A)cos(B) + sin(A)sin(B)
cos(2*A) = 2*cos(A)² - 1

Replace sine with cosines, B = 1/(c0c1) + 1/(c1c2) + ... 1/(c44c45)

Sum 2 terms: 1/(c0c1) + 1/(c1c2)
= (c2+c0)/(c0c1c2)
= (2*c1c1) / (c1c2)
= 2*c1/c2

Sum 3 terms: 2*c1/c2 + 1/(c2c3)
= (2*c1c3 + 1)/(c2c3)
= (c2 + c4 + 1)/(c2c3)
= (c2 + 2*c2^2)/(c2c3)
= (1 + 2*c2)/c3

Sum 4 terms: (1 + 2*c2)/c3 + 1/(c3c4)
= (c4 + 2*c2c4 + 1)/(c3c4)
= (2*c2^2 + 2*c2c4)/(c3c4)
= 2*c2*(c2+c4)/(c3c4)
= 2*c2*(2*c1*c3)/(c3c4)
= 4*c1c2/c4

Sum 5 terms: 4*c1c2/c4 + 1/(c4c5)
= (4*c1c2c5 + 1)/(c4c5)
= (2*c2*(c4+c6) + 1)/(c4c5)
= (2*c2c4 + 2*c2c6 + 1)/(c4c5)
= (2*c2c4 + c8 + c4 + 1)/(c4c5)
= (2*c2c4 + 2*c4^2 + c4)/(c4c5)
= (1 + 2*c2 + 2*c4))/c5

Finally see a pattern! It can be proved by induction (not shown):

B = (1 + 2*c2 + 2*c4 + ... + 2*c44)) / c45

Sines and Cosines of Angles in Arithmetic Progression formulas:

sin(x) ﻿ + sin(x+y) ﻿ + ... + sin(x+(n-1)*y)﻿ =﻿ sin(x+(n-1)y/2)*sin(ny/2)/sin(y/2)
cos(x) + cos(x+y) + ... + cos(x+(n-1)*y) = cos(x+(n-1)y/2)*sin(ny/2)/sin(y/2)

B = (1 + 2*(c2 + c4 + ... + c44)) / c45, with x=y=2°,n=22
﻿ ﻿ ﻿ ﻿= (1 + 2*(c23 s22 / s1)) / c45
﻿ ﻿ ﻿ ﻿= (1 + 2*(c23 c68 / s1)) / c45
﻿ ﻿ ﻿ ﻿= (1 + (c91 + c45) / s1) / c45
﻿ ﻿ ﻿ ﻿= (1 - s1/s1 + c45/s1) / c45
﻿ ﻿ ﻿ ﻿= 1/sin(1°)
02-14-2019, 03:33 AM
Post: #16
 Carsen Member Posts: 158 Joined: Jan 2017
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
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.
02-14-2019, 04:08 AM
Post: #17
 Albert Chan Senior Member Posts: 549 Joined: Jul 2018
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
(02-14-2019 02:12 AM)Albert Chan Wrote:  B = (1 + 2*c2 + 2*c4 + ... + 2*c44)) / c45

Another way, using 2 sin(A) cos(B) = sin(A+B) + sin(A-B)

B sin(1°)
= (s1 + 2*s1c2 + 2*s1c4 + ... + 2*s1c44) / c45
= (s1 + (-s1 +s3) + (-s3 + s5) + ... + (-s43 + s45)) / c45
= s45 / c45
= 1
02-14-2019, 01:23 PM (This post was last modified: 02-14-2019 01:33 PM by Albert Chan.)
Post: #18
 Albert Chan Senior Member Posts: 549 Joined: Jul 2018
RE: [VA] SRC#004- Fun with Sexagesimal Trigs
Got a very elegant and general proof that B = 1/sin(1°):

1/(c0c1) + 1/(c1c2) + ... + 1/(c(n-1)c(n)) = tan(n°) / sin(1°), assumed n < 90

Proof above by induction:

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.

-> With 45 terms, B = tan(45°) / sin(1°) = 1/sin(1°)
 « Next Oldest | Next Newest »

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