Post Reply 
Rational trig identities?
10-10-2021, 09:25 PM (This post was last modified: 10-12-2021 04:26 PM by Albert Chan.)
Post: #4
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)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Rational trig identities? - John Keith - 10-10-2021, 04:42 PM
RE: Rational trig identities? - Albert Chan - 10-10-2021 09:25 PM
RE: Rational trig identities? - John Keith - 10-11-2021, 01:08 PM



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