Should we miss BASIC?

Over in my post accepting my victory as the biggest geek on ScienceBlogs, an interesting discussion about beginners learning to program got started in the comments. It was triggered by someone mentioning David Brin’s article in Salon about how terrible it is that computers no longer come with basic. The discussion was interesting; I think it’s interesting enough to justify a top-level post.
A few days ago in Salon, David Brin published an article (no link, because Salon is a pay-site), lamenting the fact that computers no longer come with BASIC interpreters, and how that was going to wreck the next generation of up-and-coming programmers:
>Only, quietly and without fanfare, or even any comment or notice by software
>pundits, we have drifted into a situation where almost none of the millions of
>personal computers in America offers a line-programming language simple enough
>for kids to pick up fast. Not even the one that was a software lingua franca on
>nearly all machines, only a decade or so ago. And that is not only a problem
>for Ben and me; it is a problem for our nation and civilization.
Yes indeedy, the lack of built-in BASIC interpreters is a problem for our very civilization!
There are two contradictory threads running through the article. One is the idea that “back in the good old days”, everyone had the same programming language, a “lingua franca” which everyone spoke. The other is that the “line-oriented” BASIC was a better tool for beginners learning to program than anything that we have now.
I think both of these are utter nonsense.

Is Evolution Good Enough? It Beats Us.

One of the bad arguments that I’ve frequently seen from creationists
is the argument that some biological system is *too good* to be a possible result of an evolutionary process. On its face, this seems like it’s not a mathematical argument. But it actually is, and math is key to showing what the argument really is, and what’s wrong with it.

Continue reading

The Geekiest? Right here.

Yes, it appears that I have won the great ScienceBlogs nerdoff/geekoff. [Janet announced the results yesterday][geekoff], and despite [much][orac-whines] [whining][pz-whines], I’m proud to say that I was the winner. There was some stiff competition, particularly from Orac, but in the end, no one could quite exceed my pathetic level of geekiness.
In answer to a question I’ve heard a couple of times: Janet called it a “Nerd-Off”, but I’ve preferred to call it a “Geek-Off”. I consider them roughly equivalent. Depending on where you are, geographically, I’ve found that the differences between the two vary by location. Growing up, I always heard “nerd” used as a sort-of-positive thing (Nerds were smart people with odd interests, etc.); and “geek” was purely pejorative (geeks were obnoxious twits with no social skills). When I went to grad school, everyone there used the two words in exactly the opposite fashion: Geeks were the good ones, and Nerds were the obnoxious ones. So why do I like geek better? Because my wife has an “I love my geek” shirt that she likes to wear. And hey, if you’re a total geek like me, and by some incredibly strange stroke of luck, you somehow wind up meeting and marrying an amazing, brilliant, gorgeous, brilliant woman, you pretty much do whatever she prefers. (and yes, I repeated brilliant on purpose; she’s just that smart.)
Anyway; I think that my winning had something to do with the slide rules… so, as an award for myself, I ordered a brand-new slide rule – the Pickett whose simulated image I used for the slide rule posts last week. I’ll need a second one at some point anyway, since I have two kids, and I want them each to have a rule to learn on.
[geekoff]: http://scienceblogs.com/ethicsandscience/2006/09/and_the_nerdiest_is.php
[orac-whines]: http://scienceblogs.com/insolence/2006/09/i_was_robbed.php
[pz-whines]: http://scienceblogs.com/pharyngula/2006/09/it_was_rigged.php

Arithmetic on the Abacus: Part 1

If you want to talk about mechanical computing tools, you can’t ignore the abacus. It’s the oldest computing tool in the world; and it’s still very commonly used. It’s also about as different from the slide rule as you could imagine. The abacus is really fundamentally an addition device; the slide-rule is fundamentally a multiplier. And the slide rule is very complicated – all those different scales, in logarithmic relationships; the abacus is thoroughly simple – just beads hanging on wires. But don’t let that fool you: the abacus is is a remarkable device, which is capable of a really huge number of computations: addition. subtraction, multiplication, division, even square and cube roots.
The abacus is, basically, sort of like a *better* piece of paper. Any kind of numerical calculation that you can do using piece of paper and a pencil, you can do on an abacus; only it’s a whole lot faster on the abacus.

Continue reading

Topological Subspaces

Just like you can define a sub-set of a set, or a sub-object of an object in a category, you can define a sub-*space* of a topological space. It’s a pretty easy thing to understand; interestingly, a sub-space of a topological space works in pretty much exactly the same way as a sub-sets and sub-object. In fact, the topological definition of a sub-space is *identical* to the categorical definition of a sub-object when we’re looking at the category of topologies, **Top**.
Today, I’m going to explain what a subspace is, and show you how the categorical sub-object corresponds to the topological subspace. Read on beneath the fold.

Continue reading

More HIV/AIDs Denial: Lying with Math

Orac sent me a link to some more HIV denialist material, I assume under the assumption that since I’m already being peppered by insults from the denialist crowd, I might as well cover this now.

Continue reading

More Minimal Masochism: Pathological Programming in OISC

Expanding on last weeks theme of minimalism, this week, we’ve got OISC: the One Instruction Set Computer. This is a machine-code level primitive language with exactly one instruction. There are actually a few variants on this, but my favorite is the “subleq” OISC, which I’ll describe beneath the fold.

Continue reading

Off topic: Mental Illness

This is *very* off-topic for this blog; it’s really more of a rant on a personal subject which I think it’s worth saying publicly.
I am mentally ill. I have clinical depression. CD is a thoroughly miserable illness. I’m incredibly lucky to live at a time when CD like mine is easily treated by medication. Two pills every morning, and I’m myself again.
The point of writing this isn’t to tell the world that I’ve got clinical depression, or to say “Gosh I like my drugs”. The reason that I’m writing this is gripe about how people react when they hear that I take psychiatric medication. For some reason, the fact that my *brain* has a problem that’s easy to fix using medication is somehow considered to be a huge strike against me, an inexcusable sign of personal weakness.
No other illness is treated this way.
To contrast things, I also have a dreadful stomach problem. It’s not actually something with a simple name; basically, it’s classic reflux disorder, combined with an extremely irritable stomach, which triggers extremely painful muscular spasms. Those two together are a bad combination: the spasms behave almost like a pump, spraying acid up my esophagus. (Which is exactly as much fun as it sounds.) In order to treat this, I needed surgery. And as an after-effect of the surgery, I now get *espohageal* spasms, which are excruciating; according to people who’ve experienced both, they feel very much like having a heart attack. The difference is that they are more or less *continuous* for *weeks* at a time.
To treat this, I take three different drugs. One is quite expensive; about $6/day. The other two are cheap, but both have unpleasant side effects. One even contains a small quantity of an addictive opiate.
For my stomach problems, if I didn’t take my drugs, the main thing that would happen would be that it would hurt. Not life threatening, not dangerous. It would just be painful. I *might* end up going through some withdrawal from the addictive one.
How many people have heard about my stomach problems? A *lot* of people. Partly because of the fact that I need to take drugs three times a day; and partly because of the fact that can create some peculiar symptoms that are visible to other people. Out of the dozens of people who’ve heard about my stomach problem, and know about the drugs I take for it, how many have lectured me about how I shouldn’t take those nasty drugs? Zero. No one has *ever* even made a comment about how I shouldn’t be taking medications for something that’s just uncomfortable. Even knowing that some of the stuff I take for it is *addictive*, no one, *not one single person* has ever told me that I didn’t need my medication.
But depression? It’s a very different story.
What happens if I don’t take my medication? I turn into a zombie. Everything turns flat, it seems almost as if things lose their color, like all the colors fade. I feel like my body weighs so much that I can’t even hold my shoulders up. I don’t feel *sad*; I feel *nothing*. Empty, blank, flat. Great things can happen, but they don’t make me happy. *Awful* things can happen, but they don’t make me sad.
What happens when I take my medication? I’m myself again. The medication doesn’t make me feel happy; it makes me *feel*. With the medication, my emotions come back; I can feel happy or sad. I enjoy it when things are going well; I get sad or angry when they go poorly.
But how do people react?
Somewhat over 1/2 of the people who hear that I take an antidepressant express disapproval in some way. Around 1/3 make snide comments about “happy pills” and lecture me about how only weak-willed nebbishes who can’t deal with reality need psychiatric medication.
I confess to being thoroughly mystified by this. Why is it OK for my stomach, or my heart, or my pancreas to be ill in a way that needs to be treated with medication, but it’s *not* OK for my brain? Why are illnesses that originate in this one organ so different from all others, so that so many people believe that nothing can possibly go wrong with it? That there are absolutely no problems with the brain that can possibly be treated by medication?
Why is it OK for me to take expensive, addictive drugs for a painful but non-life-threatening problem with my stomach; but totally unacceptable for me to take cheap harmless drugs for a painful but non-threatening problem with my brain?

Using a Slide Rule Part 2: Exponents and Roots

Slides rules are actually astonishingly powerful things. The simple slide rule does multiplication and division using the C and D scales; strictly speaking, you can have a basic rule with nothing but C and D. But you almost never see a rule that simple. (The only one I’ve ever seen with only the two scales was a circular rule used as a promotional giveaway.)

The other scales are where things get a bit complicated; but it’s a lot of fun to figure out how they work, and to see how much you can actually do with, basically, two attached rulers with a bunch of different markings.

As an example, I’m going to walk through how you do exponents and roots using a slide rule. They’re interesting, because they’re the hardest things to do on the slide rule; so if you can get how to do them, there’s pretty much nothing that you can do with a slide rule that you won’t be able to figure out by understanding the scale. I’m using the same virtual slide rule program as yesterday, but this time, the images are of a Pickett N3-T, which is a log-log duplex trig scientific rule. We’ll need the extra scales of a log-log for today.

One quick note of clarification: a slang term for a slide rule is a “slipstick”, or just “stick”. I’m actually used to calling it a stick; that’s what my father used to call it when he taught me to use it. So if I slip up and say “stick”, you’ll know what I’m talking about.

Continue reading

Manual Calculation: Using a Slide Rule (part 1)

Several people in the geekout thread asked me to explain how a sliderule works, and I’ve been meaning to write a couple of article about manual computing devices. So I thought I’d do it. There’s a nice slide-rule simulator at Derek’s Virtual Slide Rule Gallery, which is what I used to generate the images in this article.

I know a lot of people think that the idea of learning to use something like a slide rule is insane in an age of computers and calculators, and that this is a silly thing to post about. But I really love slide rules, and not just because I’m a geek. Slide rules make math tactile. Using a slide rule makes you understand how certain kinds of math work; and not just a theoretical understanding, but an understanding on a very concrete, physical level. My dad taught me to use one not because I needed to know (I’m not that old!), but because he loved it and thought it was cool; my slide rule is the one that he used in college. He gave it to me when I was in high school. It’s a beautiful K&E log-log duplex decitrig.

There are a couple of things to be said about slide rules up front. They’re beautiful things, and the guy who invented them is an incredible genius. But they’re not a tool for the weak-of-heart. Using a slide rule isn’t like using an electronic calculator. You actually need to do an approximation of the calculation in your head, because the slide rule doesn’t do powers of ten; you need to do that by yourself! Also, in general, the slide rule is used for the “hard stuff”; multiplication and division, logarithms, exponents, and trigonometry. Addition and subtraction you do by yourself, either in your head, or on paper.

The basic idea of the slide rule comes from logarithms, in particular this fundamental identity: x * y = blogb(x) + logb(y). That is: adding logarithms is equivalent to multiplying numbers. The slide rule places numbers onto a ruler on a *logarithmic* scale; so the distance from “1” to a number “n” on the rule is the logarithm of “n”. That’s the whole fundamental trick to make it work.

Let’s take a look at a slide rule. This is a picture of a Pickett Microline sliderule. That’s a very simple rule, which is easy to see on the computer, but it’s relatively wimpy. It doesn’t have a lot of scales (which is equivalent to a calculator with very few buttons); and it’s really only good for 2 to 2.5 significant digits. (Personally, I’m not a pickett fan; I prefer the big old K&Es, but that’s just because they’re what I’m used to.)

rule.jpg

For multiplication and division, we only need two scales: the D scale, which is the top row of the lowest third of the rule; and the C scale, which is the bottom row of the moving slide in the center. C and D are done with the same logarithmic scale. We’ll also use the *cursor*, which is the vertical line on the transparent view slide.

Let’s say we wanted to multiply 22.5 by 3.7. We move the center slide so that “1” on the C scale lines up with 2.25 on the “D” scale below it:

mult-step1.jpg

Now – since adding logarithms is multiplying numbers, and the position of a number on the C and D scales are determined by the same logarithm, that means that “3.7” on the “C” scale is in the same position as “2.25*3.7” on the D scale. So what’s on the D scale at 3.7? We slide the cursor over (both to mark the position, and to make it easier to read), and find that it’s at 8.3.

mult-result.jpg

So the answer is 8.3 times 10 to the something. The rule doesn’t tell us what. So we do it approximately in our heads. It’s about 20 times 3 and a half, which is around 80. So the answer is 83. (The exact answer is 83.25, but this rule isn’t big enough for us to see that.)

See? Simple. Now, if we wanted to multiply that by, say, 18, we’d slide the “1” over so that it lined up with the cursor… Except that then, the answer is off the end of the rule. But no problem! There’s *also* a one on the *other* end of the rule. We can slide the C scale so that its *right hand* 1 is over 83 where we’ve left the cursor. Now we slide the cursor down to 1.8 on the C scale:

mult2.jpg

And you can see it’s sitting at about 1.49. But since we only used two digits, we can only read two digits, so we say 1.5. Now we need to do our powers of ten: it’s about 20 times 80, which is 1600. So it’s 1.5×103, or about 1500. (Exact result is 1494.)

Division is almost the same thing done backwards: x/y = aloga(x) – loga(y). So, to divide x by y, we put “y” on the C scale over “x” on the D scale, and slide the cursor over to 1 on C. For example, let’s take π/2. Most rules have a specific mark for π to make that easy. So we slide 2 on C to line up with π on D:

div-setup.jpg

And slide the cursor to one on C:

div-result.jpg

And our answer is: about 1.57. (The cursor is about half-way between the marks for 1.56 and 1.58; and π is positioned to three significant digits.) We need to do the powers of ten for division to, but that’s easy; we know π/2 is between 1 and 2, so it’s 100, so the answer is just 1.57.

What’s the real answer? About 1.5708.

See? Isn’t that cool?

[sr]: http://www.antiquark.com/sliderule/sim/