(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
|
|||
|
|||
(12C) Bhaskara's Sine and Cosine Approximations
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): Code: def cos(x): 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 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 |
|||
07-29-2022, 12:13 PM
Post: #2
|
|||
|
|||
RE: (12C) Bhaskara's Sine and Cosine Approximations
Inverse Sine and Cosine Approximations
Inverse Cosine Function The approximation for \(\cos(x)\) allows to find an approximation for \(\cos^{-1}(x)\) as well: \(\cos^{-1}(x) \approx 180 \sqrt{\frac{1 - x}{4 + x}}\) Program Code: 01- 01 1 Examples In parentheses you can find the correct value. 0 R/S 90.000 0.5 R/S 60.000 1 R/S 0.000 0.5 √x R/S 44.900 (45) 0.75 √x R/S 29.867 (30) 5 √x 1 + 4 ÷ R/S 35.871 (36) Accuracy For special values (e.g. 0, 0.5, 1) the approximation is exact. But in general the relative error is within a few ‰. Inverse Sine Function To calculate \(\sin^{-1}(x)\) we can simply use: \(\sin^{-1}(x)=90-\cos^{-1}(x)\) |
|||
07-29-2022, 05:13 PM
Post: #3
|
|||
|
|||
RE: (12C) Bhaskara's Sine and Cosine Approximations
(07-29-2022 12:13 PM)Thomas Klemm Wrote: The approximation for \(\cos(x)\) allows to find an approximation for \(\cos^{-1}(x)\) as well: We don't have estimate formula for asin(x), because sin(x) were defined from estimated cos(x) In other words, OP sin estimate formula is not needed; it is same as cos(90° - x°) --- We can define angle unit, ht = half-turn, to aid in memorization. With 1 ht = pi radian = 180 degree, we have: cos(x ht) ≈ (1-4x²) / (1+x²) acos(x) ≈ √( (1-x) / (4+x) ) ht Example: cos(45°) ≈ cos(1/4 ht) = (1-4/16) / (1+1/16) = 12/17 ≈ 0.7059 acos(0.7059) ≈ √(0.2941 / 4.7059) ht ≈ 0.2500 ht = 45.00° |
|||
07-30-2022, 10:51 AM
Post: #4
|
|||
|
|||
RE: (12C) Bhaskara's Sine and Cosine Approximations
(07-29-2022 05:13 PM)Albert Chan Wrote: We don't have estimate formula for asin(x), because sin(x) were defined from estimated cos(x) Agreed. Instead we can use: Code: 01- 43 33 07 g GTO 07 However the jump table is now switched: GTO 01 for \(\cos(x)\) GTO 02 for \(\sin(x)\) Quote:cos(45°) ≈ cos(1/4 ht) = (1-4/16) / (1+1/16) = 12/17 ≈ 0.7059 IIRC I used 9 and 60 instead of 1 and 180 to save one precious step. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)