Question: Is it possible to calculate the Pythagorean Formula without the use of a square root function? source
In order to support Geokit in sqlite3, I need a way to calculate distances that does not require cosine or square root. In my problem space, the points are relatively close to each other.
C1=A+B
The error was very similar to the size of the lowest number. So subtracted a fraction of the lowest number.
C2=A+B-min(A,B)*0.6
Restated the formula with min and max, and tweaked the ratios.
C3=max(A,B)*0.945 + min(A,B)*0.415
| A | B | C | c1 | error | c2 | error | c3 | error |
| 1000 | 1000 | 1414 | 2000 | 586 | 1400 | -14 | 1360 | 54 |
| 1000 | 750 | 1250 | 1750 | 500 | 1300 | 50 | 1256 | -6 |
| 1000 | 500 | 1118 | 1500 | 382 | 1200 | 82 | 1153 | -34 |
| 1000 | 250 | 1031 | 1250 | 219 | 1100 | 69 | 1049 | -18 |
| 1000 | 0 | 1000 | 1000 | 0 | 1000 | 0 | 945 | 55 |
Please share if you can help me come up with a better approximation or if you see an error.
thanks Meridian.