Created
March 19, 2020 20:34
-
-
Save neoneye/408227d65d116a98d41899eb883c6608 to your computer and use it in GitHub Desktop.
Alternative way of computing the squareroot using acos+sin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mesolabe Compass and Square Roots - Numberphile | |
# https://www.youtube.com/watch?v=9VVPBS_flOI | |
v=4; Math.sin(Math.acos(2.0 / (v + 1) - 1.0)) * (v + 1) / 2.0 | |
# 2.0000000000000004 | |
v=9; Math.sin(Math.acos(2.0 / (v + 1) - 1.0)) * (v + 1) / 2.0 | |
# 3.0 | |
v=16; Math.sin(Math.acos(2.0 / (v + 1) - 1.0)) * (v + 1) / 2.0 | |
# 4.000000000000002 | |
v=25; Math.sin(Math.acos(2.0 / (v + 1) - 1.0)) * (v + 1) / 2.0 | |
# 4.999999999999999 | |
v=36; Math.sin(Math.acos(2.0 / (v + 1) - 1.0)) * (v + 1) / 2.0 | |
# 5.9999999999999964 | |
v=49; Math.sin(Math.acos(2.0 / (v + 1) - 1.0)) * (v + 1) / 2.0 | |
# 7.000000000000008 | |
v=100; Math.sin(Math.acos(2.0 / (v + 1) - 1.0)) * (v + 1) / 2.0 | |
# 10.00000000000001 | |
v=10000; Math.sin(Math.acos(2.0 / (v + 1) - 1.0)) * (v + 1) / 2.0 | |
# 100.00000000000786 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment