Approximate My Squares
Python 2, 47 ... 36 bytes
-3 bytes thanks to @JungHwanMin
-1 byte thanks to @HyperNeutrino
-2 bytes thanks to @JonathanFrech
-3 bytes thanks to @OlivierGrégoire
def f(x):s=int(x**.5);print(x/s+s)/2
Try it online!
R, 43 bytes 29 bytes
x=scan()
(x/(s=x^.5%/%1)+s)/2
Thanks to @Giuseppe for the new equation and help in golfing of 12 bytes with the integer division solution. By swapping out the function call for scan, I golfed another couple bytes.
Try it online!
Java (OpenJDK 8), 32 bytes
n->(n/(n=(int)Math.sqrt(n))+n)/2
Try it online!
Explanations
The code is equivalent to this:
double approx_sqrt(double x) {
double s = (int)Math.sqrt(x); // assign the root integer to s
return (x / s + s) / 2
}
The maths behind:
s + (x - s²) / (2 * s) = (2 * s² + x - s²) / (2 * s)
= (x + s²) / (2 * s)
= (x + s²) / s / 2
= ((x + s²) / s) / 2
= (x / s + s² / s) / 2
= (x / s + s) / 2