(12C) Bhaskara's Sine and Cosine Approximations
02-26-2022, 06:22 PM (This post was last modified: 02-28-2022 06:29 AM by Thomas Klemm.)
Post: #1
 Thomas Klemm Senior Member Posts: 2,104 Joined: Dec 2013
(12C) Bhaskara's Sine and Cosine Approximations

References
Formulas

$$\sin(x) \approx \frac{16(\pi - x)x}{5 \pi^2 - 4(\pi - x)x}$$

$$\cos(x) \approx \frac{\pi^2 - 4x^2}{\pi^2 + x^2}$$

We can use the substitution $$\pi \to 180^{\circ}$$ and get instead for $$x$$ in degrees:

$$\sin(x) \approx \frac{4(30 - \frac{x}{6})\frac{x}{6}}{1125 - (30 - \frac{x}{6})\frac{x}{6}}$$

$$\cos(x) \approx \frac{9 - 4[\frac{x}{60}]^2}{9 + [\frac{x}{60}]^2}$$

Python Programs

Code:
def sin(x):     u = x / 6     v = (30 - u) * u     return 4 * v / (1125 - v)

Code:
def cos(x):     u = x / 60     v = u ** 2     return (9 - 4 * v) / (9 + v)

Program

There's a jump table at the beginning, so you can use the following:

GTO 01 for $$\sin(x)$$
GTO 02 for $$\cos(x)$$

Code:
01-     43 33 19 g GTO 19 02-     36         ENTER 03-     06         6 04-     00         0 05-     10         ÷ 06-     36         ENTER 07-     20         × 08-     09         9 09-     34         x≷y 10-     40         + 11-     09         9 12-     43 36    g LSTx 13-     04         4 14-     20         × 15-     30         − 16-     34         x≷y 17-     10         ÷ 18-     43 33 00 g GTO 00 19-     36         ENTER 20-     06         6 21-     10         ÷ 22-     03         3 23-     00         0 24-     34         x≷y 25-     30         − 26-     43 36    g LSTx 27-     20         × 28-     01         1 29-     01         1 30-     02         2 31-     05         5 32-     34         x≷y 33-     30         − 34-     43 36    g LSTx 35-     04         4 36-     20         × 37-     34         x≷y 38-     10         ÷ 39-     43 33 00 g GTO 00

Examples

Sine

What is $$\sin(36^{\circ})$$?

GTO 01
36
R/S

0.587

Cosine

What is $$\cos(36^{\circ})$$?

GTO 02
36
R/S

0.808

Accuracy

For special values (e.g. 30, 60, 90, …) the approximation is exact.
But in general it's only correct to about 3 places.
In the last column is the correct value.

Sine

0: 0.000 0.000
10: 0.175 0.174
20: 0.343 0.342
30: 0.500 0.500
40: 0.642 0.643
50: 0.765 0.766
60: 0.865 0.866
70: 0.939 0.940
80: 0.985 0.985
90: 1.000 1.000
100: 0.985 0.985
110: 0.939 0.940
120: 0.865 0.866
130: 0.765 0.766
140: 0.642 0.643
150: 0.500 0.500
160: 0.343 0.342
170: 0.175 0.174
180: 0.000 0.000

Cosine

-90: 0.000 0.000
-80: 0.175 0.174
-70: 0.343 0.342
-60: 0.500 0.500
-50: 0.642 0.643
-40: 0.765 0.766
-30: 0.865 0.866
-20: 0.939 0.940
-10: 0.985 0.985
0: 1.000 1.000
10: 0.985 0.985
20: 0.939 0.940
30: 0.865 0.866
40: 0.765 0.766
50: 0.642 0.643
60: 0.500 0.500
70: 0.343 0.342
80: 0.175 0.174
90: 0.000 0.000

Attached File(s)