Monthly Archives: December 2013

Calculate Cube Roots on an Ordinary Calculator

I discovered a relatively compact way of calculating a cube root on an ordinary calculator. The procedure is built on the formula for geometric series and on the calculator’s hidden “K” – constant – register.

By “ordinary calculator” I mean one of those inexpensive calculators that you can find in endless sizes, shapes, and styles, but all of which use identical calculating logic. They all include, among other things, an 8-digit display, square root key, and two clearing keys, AC and CE. They also all include an internal K register. I suspect that over 99% of people who use ordinary calculators have no idea what the K register is, or that it even exists. This is because I suspect those people who are geeky enough to figure out the K register don’t use ordinary calculators. Instead they buy and use fancy scientific/ programmable/ graphing calculators.

Now, to calculate a cube root. First enter the number, then press [√] [√] [×], then repeatedly press [√][√][=] eleven or twelve times at which point the number in the display stabilizes. That number is the cube root correct to seven digits. For example, take the cube root of 10:

Enter:               See displayed:
[1][0]                10
[√][√][×]         1.7782793
[√][√][=]         2.0535247
[√][√][=]         2.1287512
… 7 more iterations …
[√][√][=]         2.1544339
[√][√][=]         2.1544342
[√][√][=]         2.1544342

The answer differs only in the last digit from the accurate approximation 2.1544347.

This algorithm depends on the geometric series for 1/3:

1/3 = 1/4 + 1/16 + 1/64 + … + 1/4n + …

Packaged into exponential form:

x1/3 = (x1/4)(x1/16)(x1/64) …

And calculated with the assistance of the calculator’s K register, which caches the factor x1/4, while the product builds up in the displayed result.

Programming Unleashed – Or should it be Leashed?

Unleashed by the Book

If you browse in the computer-book section of any well-stocked bookstore, you will usually come across two or three books titled “Xxx Unleashed” where xxx is something to do with software. Developers can choose from titles like Java 2 Unleashed, JavaScript Unleashed, or PHP Unleashed. For system administrators there are titles like Windows Server 2012 Unleashed. (If I was a company’s IT manager, I’m not sure if I would want my sys admins, with their digital powers and privileges, to be really unleashed.) And if you want to take a break from screen and keyboard for a few minutes, there’s Doodles Unleashed to help you goof off productively.

I have a bit of a contrarian streak, so I thought to myself that it would be amusing for someone to publish a “leased” book. What might you learn from a book called Java 2 Leashed if it existed? (It turns out there are some “leashed” books but they are found in the romance and fantasy sections and have covers that would discourage anyone from reading them on public transit which may explain why most are available only for e-readers.)

What is an Unleashed Programmer? Two Views

However, having observed software being developed  by professionals, I am starting to think that there might be something serious with this contrarian idea. Perhaps production software could benefit from developers choosing to have a “leashed” mindset. Let me explain.

The term unleashed brings to mind two separate meanings:

  1. Able to roam anywhere. This unleashed dog in the park roams to any corner of the park and snuffles around wherever it likes. Similarly, an unleashed programmer can roam to any corner of the documentation, understand it, and figure out how to use any feature that the programming system offers.
  2. Able to act without restraint. This unleashed dog does whatever it wants in the park: jumping up on adults, knocking over little kids, and leaving doggy doo surprises. Similarly, an unleashed programmer can use whatever programming tricks, copy-pasted program snippets, or code hacks he can think of until his code passes the documented test cases. Continue reading