Re: Hart, 3300 Message #5 Posted by Dieter on 17 Nov 2013, 3:32 p.m., in response to message #4 by Thomas Klemm
Quote:
Still not always better than the original.
Of course the proposed approximation is not everywhere better than the one by Hart. As mentioned, the goal was a certain maximum error in terms of significant digits. And that's the Hart approximation's weak point. Your table does not show this since it only shows up at small results below 0,1 or x < 5,7 degrees. Here the Hart approximation can bei off by 3  4 units in the 6th place while my version stays below 1 unit.
Note: "7,9D7" means 7,9 units in the 7th significant digit.
x sin(x) Dieter Hart err_D err_H

0,00005 8,726 6463 E7 8,726 6383 E7 8,726 6111 E7 7,9D7 3,5D6
0,005 8,726 6462 E5 8,726 6383 E5 8,726 6111 E5 7,9D7 3,5D6
0,05 8,726 6452 E4 8,726 6372 E4 8,726 6100 E4 7,9D7 3,5D6
0,5 8,726 5355 E3 8,726 5276 E3 8,726 5004 E3 7,9D7 3,5D6
1 1,745 2406 E2 1,745 2391 E2 1,745 2336 E2 1,6D7 7,0D7
2 3,489 9497 E2 3,489 9466 E2 3,489 9357 E2 3,1D7 1,4D6
3 5,233 5956 E2 5,233 5911 E2 5,233 5748 E2 4,6D7 2,1D6
4 6,975 6474 E2 6,975 6415 E2 6,975 6199 E2 5,9D7 2,7D6
5 8,715 5743 E2 8,715 5672 E2 8,715 5404 E2 7,1D7 3,4D6
6 1,045 2846 E1 1,045 2838 E1 1,045 2806 E1 8,0D8 4,0D7
So, as promised, the error of the proposed approximation stays below 1 unit in the 6th significant digit  for any value in the given domain, be it 50, 5, 0,5 or 0,00005 degrees. The Hart approximation will not handle this case with the same accuracy. As always, you have to decide what you want to optimize: the largest absolute error (see below) or the largest relative error (cf. my first approximation with a max. rel. error of 1,1E6) or something else.
If you want an approximation with a minimal absolute error in [0, 90] that's possible as well. Simply use the following coefficients:
a = 1,5707903
b = 0,6458861
c = 0,0794185
d = 0,0043227
This keeps the absolute error below 7*10^{7}. However, this improved accuracy mainly is due to the use of two more digits in the coefficients. The Hart approximation still is as good as it gets with five decimals instead of seven. ;)
Dieter
Edited: 17 Nov 2013, 3:48 p.m.
