3 ms·
I had a calculator from 1985 a TI Scientific SLR solar powered. I did not know it had a bug in the square root function. It was enough to flunk Algebra and get
by orionblastar 7y ago
I had a calculator from 1985 a TI Scientific SLR solar powered. I did not know it had a bug in the square root function. It was enough to flunk Algebra and get a C in Statistics. I bought a more modern calculator later on when I went back to college and learned the older one had a square root bug. I never learned to do the math in my head, that would have been a neat trick.
- nullc 7y agoArbitrary precision sqrt in your head: There are two ways to do it, one is via a process that looks like long division, the other is via newtons method. I find the latter more useful because I for me its easier to remember and even a single step of it gives a pretty good result. First guess get an initial guess. If you're good with base-2, you can crop off half the number's binary digits. Otherwise, think of the number in scientific notation and take the sqrt of the mantissa and halve the exponent. Alternately, guess and check some nearby squares. Now we apply newton's method using the derivative of sqrt() to refine your guess: guess_n+1 (x) = 0.5 * (guess_n + x/guess_n) That division is a PITA mentally, so don't be a chump-- keep your intermediate results in rational form and keep multiplying up the denominator (the rapidly bloating denominator also gives you an idea of how fast the precision of this process increases-- very fast...). Sometimes I get the sign wrong, but that or any other mistake I've encountered obvious really fast.
- SamReidHughes 7y agoThat algorithm should be called square rootus horribilis. Let's say we're square rooting a 3-4 digit number (or you can multiply/divide out the exponent accordingly). I recommend starting with the (x + .5)^2 = x(x+1) + .25 shortcut, multiplied by 100, to be able to compute all multiple-of-five squares 5, 10, 15, 20, ..., 95. Then, from some multiple of 5 that is x, with k in {-2,-1,0,1,2}, use (x+k)^2 = x^2 + 2xk + k^2 to tweak that to a particular perfect square. E.g. 42^2 = 1764 = 1600+160+4. Now, we're square rooting a number, so find the two nearest perfect squares. Depending on how close you are to halfway between them, and depending on if you're in the mood for that sort of thing, poke it up by <0.25 to account for the quadratic factor of whatever you're square rooting (because (x+.5)^2 is 0.25 less than the average of x^2 and (x+1)^2), and then linearly interpolate between the two perfect squares. (You don't really have to calculate both neighboring squares to interpolate, because the difference is about 2x, and you probably already calculated that when you did the 2xk calculation.) So for example, what's the square root of (types randomly) 5719? Why, 56 is 7*8, so 5625 is 75^2. We're like, 95 more than that, out of 150? So, 75.6 and change. Or more exactly, 94/151? That's like a +4% -.6% adjustment of .6 [1], so maybe 75.62. Or even closer, you might use 94.2/151, sure. [1] (a+n%)/(b+m%) can be approximated (a/b) + n% - m%, for small percentages.
- deleted 7y ago[deleted]