Hi,
Here is my code to create the square root function based on the Babylonian method. I reproduced the formula in wikipedia:
- x represent the approximation of the square root of n
- y is the quotient between the number n and this approximation
In my program I chose 0,0000001 of accuracy but you can change this value is you don’t want something really precise.
Here is my code:
https://github.com/aureliemartinet/TC101/blob/master/wsq13.py
Have a good day !
WSQ13 #TC101 by aureliemartinette is licensed under a Creative Commons Attribution 4.0 International License.