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 E-7 8,726 6383 E-7 8,726 6111 E-7 -7,9D7 -3,5D6
0,005 8,726 6462 E-5 8,726 6383 E-5 8,726 6111 E-5 -7,9D7 -3,5D6
0,05 8,726 6452 E-4 8,726 6372 E-4 8,726 6100 E-4 -7,9D7 -3,5D6
0,5 8,726 5355 E-3 8,726 5276 E-3 8,726 5004 E-3 -7,9D7 -3,5D6
1 1,745 2406 E-2 1,745 2391 E-2 1,745 2336 E-2 -1,6D7 -7,0D7
2 3,489 9497 E-2 3,489 9466 E-2 3,489 9357 E-2 -3,1D7 -1,4D6
3 5,233 5956 E-2 5,233 5911 E-2 5,233 5748 E-2 -4,6D7 -2,1D6
4 6,975 6474 E-2 6,975 6415 E-2 6,975 6199 E-2 -5,9D7 -2,7D6
5 8,715 5743 E-2 8,715 5672 E-2 8,715 5404 E-2 -7,1D7 -3,4D6
6 1,045 2846 E-1 1,045 2838 E-1 1,045 2806 E-1 -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,1E-6) 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.
|