Clay Tech

"clay-works make things real"

translated from clazytech.com

Declarative Knowledge and Imperative Knowledge Solve Problems Differently

I sometimes listen to MIT lectures on edX, and one lecture on algorithms told an interesting story, so I want to put it together here.

Declarative knowledge, in Japanese, would be “the stated principle”; Imperative knowledge is the concrete “procedure.” The former refers to formulas and definitions themselves, the latter to instructions broken down into steps. The former teaches nothing about how to arrive at an answer. The latter shows only the method, mechanically but reliably.

A classic example of imperative knowledge is a step-execution algorithm. Take an equation like y * y = x, expressing the area of a square (declarative knowledge), and ask how to solve it. One method: to find the root of 25, subtract 25-1=24, 24-3=21, 21-5=16, 16-7=9, 9-9=0. It reaches zero in 5 steps, so 5 is the answer. https://www.wizforest.com/gear/tiger/sqrt/

That’s clever, and it 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. Another 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 is the arithmetic mean)
  3. Repeat step 2 until the required precision is obtained

That’s the gist of it. Let’s calculate it by hand. Say we want to find √123. Applying the algorithm above, S = 123. Let x0 be 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 reasonably precise square root. This is simply the wisdom of the ancients, nothing I can claim credit for, 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 is the arithmetic mean)
  3. Repeat step 2 until the required precision is obtained

Say just this, and almost nobody gets it right away. Say “let me prove it,” and x1 = ( x0 + 123 / x0 ) / 2 = ( 1 + 123 / 1 ) / 2 = 62 x2 = ( 62 + 123 / 62 ) / 2 = 31.9919 x3 = 17.9183…, and by around here most people have already stopped listening. Worse still, someone might interrupt mid-calculation with “see, there’s still a precision problem after all.” Or worse: “that guy only ever says declarative things, all talk, no substance.”

The big lesson here is that telling most people “here’s the algorithm, here’s the process for success” doesn’t land, and even trying to prove it loses them partway through. It’s wasted effort. What’s needed is the result. Almost nothing but the result carries any weight, and in most cases even that result isn’t examined closely. All the more so when it’s just one step 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, this doesn’t apply; you can throw it at them even without proof, and they’ll take it in. But in most cases, that’s not the better approach.


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