Rational trig identities?
10-10-2021, 04:42 PM
Post: #1 John Keith Senior Member Posts: 884 Joined: Dec 2013
Rational trig identities?
Surprisingly (to me), tan(n * arctan(1/n)) is rational when n is an integer. However, I can't get Mathematica nor the Prime CAS nor the 50g in exact mode to express this formula as a rational expression. Am I missing something obvious (probably!) or are such simplifications beyond the abilities of CAS's?

An iterative program is shown at A348140 but no formula is given. Here is a translation for the 49g/50g (exact mode):

Code:
 \<< DUP INV \-> n s   \<< s 1 n  1 -     START DUP s + SWAP n / 1 SWAP - / EVAL     NEXT   \>> \>>
10-10-2021, 06:21 PM
Post: #2
 Albert Chan Senior Member Posts: 2,142 Joined: Jul 2018
RE: Rational trig identities?
(05-31-2021 09:51 PM)Albert Chan Wrote:  $$\displaystyle\arctan(x) = 2\arctan\left( {x \over \sqrt{1+x^2}+1} \right)$$

This covered n = powers-of-2:

With Pythagorean triples formula: (m^2-n^2)^2 + (2mn)^2 = (m^2+n^2)^2
This made above square root goes away.

atan((2*m*n)/(m^2-n^2)) = 2*atan( (2*m*n)/((m^2+n^2)+(m^2-n^2)) = 2*atan(n/m)

Let 2^p = m/n, above simplified to: 2*atan(1/2^p) = atan(2^(p+1)/(4^p-1))

Example:

2*atan(1/2) = atan(4/3)

2*atan(1/4) = atan(8/15)
4*atan(1/4) = atan((2*15*8)/(15^2-8^2)) = atan(240/161)

2*atan(1/8) = atan(16/63)
4*atan(1/8) = atan((2*63*16)/(63^2-16^2)) = atan(2016/3713)
8*atan(1/8) = atan((2*3713*2016)/(3713^2-2016^2)) = atan(14970816/9722113)
10-10-2021, 08:02 PM
Post: #3
 Albert Chan Senior Member Posts: 2,142 Joined: Jul 2018
RE: Rational trig identities?
General case, by expanding tan(n*x), in terms of t = tan(x)

tan(n*x) = (t + tan((n-1)*x)) / (1 - t*tan((n-1)*x))

tan(2*x) = (2t) / (1 - t^2)
tan(3*x) = (3t - t^3) / (1 - 3t^2)
tan(4*x) = (4t - 4t^3) / (1 - 6t^2 + t^4)
tan(5*x) = (5t - 10t^3 + t^5) / (1 - 10t^2 + 5t^4)
...

Pattern appeared, (t+1)^n, odd powers goes on top, even powers bottom, alternate sign.

tan(n*x) = (n*t - binom(n,3)*t^3 + ...) / (1 - binom(n,2)*t^2 + ...)

Better with cotangent c = 1/t: (with x = atan(1/n), we have c = n)

tan(n*x) = (n*c^(n-1) - binom(n,3)*c^(n-3) + ...) / (c^n - binom(n,2)*c^(n-2) + ...)

Or, just let CAS do the work

CAS> a(n) := texpand(tan(n*x)) (tan(x)=1/n)
CAS> apply(a, range(1,9))

$$\displaystyle \left[ 1,\frac{4}{3},\frac{13}{9}, \frac{240}{161}, \frac{719}{475}, \frac{42372}{27755}, \frac{92567}{60319}, \frac{14970816}{9722113} \right]$$
10-10-2021, 09:25 PM (This post was last modified: 10-12-2021 04:26 PM by Albert Chan.)
Post: #4
 Albert Chan Senior Member Posts: 2,142 Joined: Jul 2018
RE: Rational trig identities?
A simple numeric version, adding angle x, 1 at a time

CAS> addx(n) := x -> (1+n*x)/(n-x)
CAS> a(n) := (addx(n) @@ n) (0)
CAS> a(8) ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → 14970816/9722113

Although code is dumb, this is much faster than expanding tan(n*x) version.
For huge n, we can make this faster with code similar to Exponentiation by squaring

For n = 8 = 2^3

CAS> doublex(x) := 2x/(1-x*x)
CAS> (doublex @@ 3) (1/8) ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → 14970816/9722113 = a(8)

For n = 10 = 2*(2^2 + 1)

CAS> (doublex @@ 2)(1/10) ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → 3960/9401
CAS> addx(10)(Ans) ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → 49001/90050
CAS> doublex(Ans) ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → 8825080100/5707904499 = a(10)
10-11-2021, 01:08 PM
Post: #5 John Keith Senior Member Posts: 884 Joined: Dec 2013
RE: Rational trig identities?
Thanks Albert, a lot of food for thought although much of it is above my head. 10-12-2021, 02:09 PM
Post: #6
 Albert Chan Senior Member Posts: 2,142 Joined: Jul 2018
RE: Rational trig identities?
Let θ = atan(1/n).
We do not know tan(nθ), but we do know tan(θ) = 1/n

Use sum of tangent formula, tan(A+B) = (tan(A) + tan(B)) / (1 - tan(A)*tan(B))

tan(2θ) = 2*tan(θ) / (1 - tan(θ)^2) = 2n/(n^2-1)
tan(3θ) = tan(2θ+θ) = (tan(2θ) + tan(θ)) / (1 - tan(2θ)*tan(θ)) = (3n^2-1)/(n^3-3*n)
...

When angle reached nθ, we have the solution.
Of course, there are more efficient ways to build tan(nθ) (see post #4)

---

More food for thought, what is the sequence converging to ?
n → inf is same as x = 1/n → 0

atan(x) = (x - x^3/3 + x^5/5 - ...) = x*(1 - x^2/3 + x^4/5 - ...)

limit(atan(x)/x, x=0) = 1

For finite n: tan(nθ) < tan(1) = 1.5574077246549 ...
10-12-2021, 04:05 PM
Post: #7
 Albert Chan Senior Member Posts: 2,142 Joined: Jul 2018
RE: Rational trig identities?
(10-10-2021 08:02 PM)Albert Chan Wrote:  Pattern appeared, (t+1)^n, odd powers goes on top, even powers bottom, alternate sign.

tan(n*x) = (n*t - binom(n,3)*t^3 + ...) / (1 - binom(n,2)*t^2 + ...)

What has this property ? Complex number !
odd powers of i goes imaginery, even powers of i goes real, i*i = -1

Assuming |θ| < pi/2, we have atan(tan(θ)) = θ

z = 1 + tan(θ)*i = r * cis(θ)
Z = z^n = r^n * cis(nθ)
tan(nθ) = im(Z) / re(Z)

If θ = atan(1/n), tan(θ) = 1/n
To keep Z parts integer, we scale up Z: (1+i/n)^n → (n+i)^n

CAS> (i+2)^2 ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → 3+4i → a(2) = 4/3
CAS> (i+3)^3 ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → 18+26i → a(3) = 26/18 = 13/9
CAS> (i+4)^4 ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → 161+240i → a(4) = 240/161
CAS> (i+5)^5 ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → 1900+2876i → a(5) = 2876/1900 = 719/475
 « Next Oldest | Next Newest »

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