Re: OT: Cosine curio Message #4 Posted by C.Ret on 13 Dec 2011, 5:45 a.m., in response to message #1 by Bob Patton
Really interesting approximation.
As Namir and Crawl have already point out, there is a typo in the developed formulae only.
The linear formulea and the RPN instructions are all correct.
Using my HP41C, I just test a few points to observe error between cosine and the Laguerre approximation (express in the following table as ppm
Angle(°) m=a/90° Laguerre(m) Cos(a) Error(ppm)
90 1 0.0000000 0.0000000 0
45 0.5 0.7124144 0.7071068 7506
0 0 1.0000000 1.0000000 0
10 1/9 0.9848786 0.9848078 72
20 2/9 0.9398473 0.9396926 165
30 1/3 0.8661695 0.8660254 166
40 4/9 0.7660945 0.7660444 65
45 0.5 0.7071068 0.7071068 0
50 5/9 0.6427550 0.6427876 50
60 2/3 0.5000000 0.5000000 0
70 7/9 0.3421859 0.3420201 484
80 8/9 0.1739508 0.1736482 1742
90 1 0.0000000 0.0000000 0
120 4/3 0.1927647 0.5000000 614471 !!!!!
135 1.5 0.3203263 0.7071068 546
145 1.6111 0.4175237 0.8191520 490
180 2 1.0000000 1.0000000 0
225 2.5 n.a.r.v. 0.7071068 nan
As explain, in first quadrant, few error and exact value for same remarkable values are obtained.
No more approximation can be obtained after 180° due to the sign of the polynôme under the square root.
The following figure better illustrate accuracy and region of interest for this cosine approximation:
Note that in this graph, Lag(a) is the real part of the laguerre approximation. That’s why plot continue after the 180° limit.
As Namir point it out, we can enhance this approximation, but not only in accuracy, other way may be to make it usable on a larger domain.
Edited: 13 Dec 2011, 5:58 a.m.
