Clay Tech

"clay-works make things real"

translated from clazytech.com

Imperative knowledge beats declarative knowledge for finding square roots

I occasionally listen to MIT lectures on edX, and there was an interesting story in a lecture on algorithms, so I’ll summarize it here.

Declarative Knowledge is what in Japanese you might call “the stated principle,” while Imperative Knowledge is the concrete “procedure.” Declarative knowledge refers to the formula or definition itself, while imperative knowledge refers to instructions broken down into steps. The former teaches you nothing about how to reach the answer. The latter, conversely, lays out only the method, plainly and mechanically.

The representative example of imperative knowledge is a step-by-step algorithm. Suppose you have a formula like y * y = x, the area of a square (declarative knowledge), and the task is to figure out how to solve it. One method: say you want the root of 25. You compute 25-1=24, 24-3=21, 21-5=16, 16-7=9, 9-9=0, and it reaches zero in 5 steps, so you know the answer is 5. https://www.wizforest.com/gear/tiger/sqrt/

This does get you the value you want, but the computational cost becomes unworkable once the area gets large or involves decimals. An algorithm exists to solve a problem efficiently. A different method, devised in the 2nd century BC, is called the “Babylonian method for extracting square roots.” https://cpplover.blogspot.com/2010/11/blog-post_20.html https://books.google.co.jp/books?id=mV2jDgAAQBAJ&pg=PT22&lpg=PT22&dq=#v=onepage&q&f=false

For √S,

  1. Set any positive integer as the initial value X0 (a value as close as possible to the square root is preferable)
  2. Let Xn+1 be the average of Xn and S / Xn (the average here is the arithmetic mean)
  3. Repeat step 2 until the required precision is obtained

That’s the method. Let’s actually try calculating it by hand. Say we want to find √123. Plugging this into the algorithm above, S = 123. Let’s set x0 to 1 for now. Then x1 = ( x0 + 123 / x0 ) / 2 = ( 1 + 123 / 1 ) / 2 = 62 x2 = ( 62 + 123 / 62 ) / 2 = 31.9919 x3 = 17.9183 x4 = 12.3914 x5 = 11.1588 x6 = 11.0905 In just 6 calculations, you get a square root of reasonable precision. This is simply ancient wisdom, and I can’t claim credit for any of it, but here’s the point:

For √S,

  1. Set any positive integer as the initial value X0 (a value as close as possible to the square root is preferable)
  2. Let Xn+1 be the average of Xn and S / Xn (the average here is the arithmetic mean)
  3. Repeat step 2 until the required precision is obtained

Say just this much, and almost nobody gets it right away. Offer to prove it instead, and by the time you reach x1 = ( x0 + 123 / x0 ) / 2 = ( 1 + 123 / 1 ) / 2 = 62 x2 = ( 62 + 123 / 62 ) / 2 = 31.9919 x3 = 17.9183…, most people have already stopped listening. If you’re unlucky, someone will say “see, there’s a precision problem after all” even though the calculation isn’t finished yet. Worse, they’ll say you only ever talk declaratively, all mouth and no substance.

The big lesson here is that if you tell most people “this is the algorithm, the process for success,” they won’t understand it, and even if you try to prove it, they stop listening partway through. In other words, it’s wasted effort. What’s needed is the result. Almost nothing except the result carries any weight. And in most cases, nobody examines even that result closely — all the more so when it’s just a step along the way toward some larger goal.

There’s a reason people say silence is golden: you stay silent, do what needs doing, and carry it through to completion. Only then do you speak. If you’re dealing with someone you can discuss things with as an equal, none of this applies — you can just throw it at them without proof, and they’ll take it in properly. But in most cases, that’s not a desirable approach.


Originally published in Japanese at https://clazytech.com/2018/09/431/. Translated with LLM assistance and reviewed before publication.