HN user

ntoronto

140 karma

http://students.cs.byu.edu/~ntoronto/

Posts2
Comments22
View on HN

It's like he's contemplating his entire acting career and questioning how he got to this point in his life.

That's my favorite Rickman scene as well.

It takes a fine actor to pack 30 years of fictional history into a single line. I'll greatly miss his tremendous talents.

I've posed exactly these problems to children about 15 times now. Most children 10 and up I've talked to can figure out the first (one more guest) easily enough, the second (an infinite bus of new guests) with a little help, and the third (infinitely many infinite buses) if I draw a picture.

It helps a lot to be precise and use concrete examples. "Hilbert has an infinite hotel. We have to be careful with infinities, though, so I'll tell you what that means. If you think of a number zero or bigger, any number at all, Hilbert's hotel has a room with that number on it. Think of a number. ('2 million!') Yep, he's got that room. ('Six googolpillion!') Yep, he's got that room."

"A guest comes into the hotel and asks, 'Mr. Hilbert, do you have one more room?' Mr. Hilbert says, 'Sure!' He picks up his magic phone that calls everyone in the hotel at the same time and gives all the guests exactly the same message. After they do what he says, there's one room empty. What does he tell them to do?"

When they invariably come up with "Move up one room," it helps to belabor a couple of points. First, reformulate it as, "Look at your room number, add 1, and go to that room." (This helps them figure out "Multiply your room number by 2" as the answer to the second problem.) Second, dwell on who goes where, and whether it's a problem. "Where does the guest in room 0 go? ('Room 1.') Doesn't that have someone in it? ('Yes. Oh, no it doesn't, because he went to room 2!')"

No child has figured out my favorite fourth problem, but then it took mathematics until Cantor to figure it out, too.

"An uncountable group of people shows up at the hotel. Let me tell you what that means. They all have infinite name tags, all filled with As and Bs. Every possible name tag is in the group. [Give example names. Blow raspberries to do it.] The head of the group, whose name is 'AAAAAAAAAAAAAA...' [said with a blank look, trailing off] asks Mr. Hilbert if he has room in his hotel. Mr. Hilbert says 'No!' Why does he say that?"

Let them stew for a bit, and ask questions. Going on: "Mr. Hilbert says, 'OK, tell you what. If you give me a room assignment, I can always find someone you left out.' How does Mr. Hilbert do that?"

You can illustrate this with a game, using only four-letter names. Write down something like

AAAA BBAA BABA AABA

"Can you find a four-letter name that's missing?" Play this a few times, and then ask, "Can you come up with an easier way that doesn't make you think of all the names in turn?" Show them how to flip the letters along the diagonal, and then extend to infinite names.

I've had 2 kids and 1 adult follow this to the end. It's always mind-blowing for them, though, no matter how far they get. I follow up with this:

"That stuff they taught you in school, that stuff a lot of people say they hate, is arithmetic. This is math."

EDIT: Come to think of it, I actually helped a friend's 11-year-old daughter decide that she didn't hate math using these problems. She's probably still bummed about being stuck doing arithmetic for now, though...

"I'm sure there's way more complexity I'm overlooking, but that's how one might get started."

That's how I'd start. There's probably a way to make the search a lot smarter. Here's the part you're overlooking, though:

"... there are only so [many] formulas made up of a fixed number of terms and operators..."

"So many" = "countably infinite." Paring it down to finitely many would require understanding tantamount to having solved the problem in the first place.

[Edit: I can words.]

Meta-comment: Not sure what's up with the downvotes on the parent comment. During lifeguard training years ago, like everyone else in my class, I was very surprised to learn what drowning looks like. But it's not far-fetched to think there's a small percentage of people who aren't surprised, and only need a few blanks filled in.

Sorry, forgot about the able swimmers.

But first: another water poloist! Awesome! Water polo was pretty small in my area, so we didn't have a lot of talent in the pool. (Pun intended.) I swam distance on the swim team and was a decent sprinter, so my coach had me play both offensive and defensive hole. My best friend could keep his navel above the water for minutes, so he played keeper behind me. I still love to get my hands on a ball and demo the backwards corner shot. Fun times.

Conscious able swimmers have usually been taught how to lie still and float on their backs, or will figure it out quickly if in calm water. They can often call for help, and will do so, interspersed with periods of rest. (Shouting takes a lot of energy.) If the water is warm, they might have hours to get rescued. If the water is cold or even just lukewarm, how long they have depends on a lot of factors, especially the temperature and whether hypothermia is setting in - but in any case they have a lot less time.

Able swimmers, especially those who are good enough to swim a mile, often underestimate the effects of cold water on the body.

They also tend to underestimate the tremendous strength of moving water. Anybody in moving water who is in distress should be helped ASAP, no matter how good they are at swimming. Moving water is a destroyer and an equalizer.

That leaves us with unconscious swimmers. Nobody swims well while unconscious. :) If there's a chance something could knock you out, whether a boat, an overhanging branch, exposure to cold water, or (for those of extended age) a heart attack, put on a well-fitting life jacket.

What do people usually expect drowning to look like?

Head erect, more splashing, perhaps a cry for help, and above all, someone who thinks and acts like a human being. You can't tell from the site, but a drowning swimmer is a wild animal. If you have to approach at all, approach with extreme caution and with something to extend your reach.

It may be you aren't surprised because the premise of the site is to identify people who are drowning. You know it'll be happening within a minute or so. In real life, it'll happen with small probability in the next few hours. It's a lot harder to spot under those circumstances.

Also, how do you differentiate the drowning response from someone that's just bad at treading water and floats low in the water?

Watch the face, arms and legs, and water surface. A swimmer in distress has his mouth as high as possible, may be flailing a little with his arms, barely kicks (if at all), barely disturbs the surface of the water, and goes under repeatedly.

But as a lifeguard, I helped weak swimmers, and then requested very firmly that they stay in shallow water. I also took their names so I could get their attention quickly if they wandered too close to the deep end.

I'll bet it was both.

I was a lifeguard, so I can speak with some authority. Both skills are necessary. Not only do you have to count and track swimmers, but you have to keep mental notes about their abilities, be aware of what they're doing, and imagine possible outcomes so you can identify and react quickly to the actual outcomes. If your attention wanders for too long, especially at a busy place, you can easily lose track of someone. If you lose track of the wrong person, well, buckle up.

Fortunately, there are usually multiple lifeguards on duty with you, you're usually on a strict 10- or 15-minute rotation with them, and one of the stations is the break room. That helps a lot.

Lifeguarding at a camp is at least 5 times more difficult than at a pool, and I suspect that's why they ran drills to keep the lifeguards on their toes. Underwater visibility is usually next to nothing. The lake is usually full of teenage boys. Access to the water is effectively unlimited. There are often a lot of occluders, such as boats and bushy shores.

Also, 95% of life-guarding is preventive.

I remember this well: sitting in a chair, scanning the pool, and every 20 seconds yelling, "Walk, please!" I was a living reminder to slow the heck down.

I'm pretty sure it was one of my most important tasks, though. The only serious injury I ever witnessed (a skull fracture) happened when someone was running on deck.

Rescuing active drowning victims (this kind of drowning) is very dangerous, for that reason. The victim won't just hold you, they'll climb you.

My only save as a lifeguard was a double for this very reason: the drowning kid's older brother jumped in to save him, and they both went under as the younger one scrambled for air.

"Good thing I jumped in after you, huh?" said the older brother, after I dragged them to the side. I wanted to punch him.

I've monkeyed with a lot of numeric representations, and every one of them involves tough theoretical and practical trade-offs. Returning an exact rational as the result of division sounds reasonable.

My favorite representation so far pairs a signed float in [2^-512,2^512) with a signed integer to extend the exponent range. The idea is to avoid overflow and underflow, particularly when multiplying thousands of probabilities.

(On average, adding a few thousand log probabilities or densities and then exponentiating the sum yields a number with about 9 digits precision. Worst case for adding log probabilities and exponentiating is about 8 digits precision, and for adding log densities it's 0 digits. Multiplying the same number of probabilities or densities retains about 13 digits in the worst case.)

We had this discussion on the Racket user's mailing list a couple of years ago. One user with an AMD processor experienced significant stalls; others with Intel processors didn't.

I don't know the status of AMD's floating point at the moment, but I hope they're doing something about that.

Ugh. It's shameful when people use wrong arguments about mathematics to oppress. I really wish you the best.

This article first appeared in "Computing in Science and Engineering" magazine, so its audience is mainly scientists in various fields who use floating point in their research. Because of that breadth, I tried to make it as accessible as possible, while teaching enough floating-point principles to make debugging make sense.

I honestly hope that everyone who uses floating point reads this.

All correct, for exact rationals. Racket's exact rational arithmetic tends to take about 1000x the amount of time floating-point arithmetic takes to compute similar functions, and creates a lot of garbage on the heap. It gets worse, though: with long-running computations, exact rationals' numerators and denominators tend to grow without bound, unless you explicitly round them to a fixed precision. If you take the latter path, you might as well use bigfloats, which wrap MPFR's multi-precision floats, and are faster.

Just looking at the Wu-Decimal page, though, I can't tell whether they're internally exact rationals or base-10 floats. If they're base-10 floats, they have all the same issues base-2 floats have. If they're internally exact rationals, I wonder what they do for division, which the set D isn't closed under.

It's not necessarily just you. I thought it was wrong when I first opened it. There may be something funny going on with the font - I think the "1" and "l" are switched.

Edit: Never mind, it copies/pastes correctly. The font is just different from what I'm used to.

...and which exercised the weird feature of some x86 processors that had something like 80-bit internal registers but did 64 bit double precision computations, and which allowed the garbage in the extra bits to contaminate the LSB, resulting in very slightly different behaviour in debug and release mode, which gave me fits for weeks...

FWIW, this is a compiler error. Most x86 processors have 80-bit extended floats, which allow 64-bit "pow" to be computed in software with low error (among other benefits). Some compilers "helpfully" compile for 80-bit mode with some combinations of compile options. They should never do this unless it's specifically asked for using a single command-line option, partly for the reason you discovered: it totally messes with replicability. It also messes with implementations of "log1p", Kahan summation, and other high-precision algorithms like double-double arithmetic.

If you ever come across this again, submit a bug report.

Right. I don't remember whether I said it in the talk, but that demo saturates the AGP bus, meaning that the engine can extract and write scene data at about 1.5 to 2 GB/Sec.

It's possible to put a lot more static content in each frame by uploading the vertex data to the card just once. That feature is on my to-do list.

More precisely, the problem comes from how certain Linux libraries and OS X have responded to OpenGL's new profile system.

An OpenGL context is roughly a 3D drawing area and its associated behind-the-scenes data. Via changes to OpenGL version 3.0 through 3.2, it became possible to ask for specific versions of OpenGL for each context. There are two kinds of contexts: "compatibility" contexts, which expose all OpenGL features up to the version obtained, and "core" contexts, which don't have deprecated features. For example, starting with 3.1, a core context won't draw quads - you have to split them into two triangles.

On Linux, Racket uses libgtkgl to get OpenGL contexts that are associated with GTK widgets. This library won't return anything but compatibility contexts, up to version 3.0.

On OS X, it's only possible to get an OpenGL 2.1 context or an OpenGL 3.2 or 3.3 core context.

There are a few ways to fix this.

1. The libgtkgl developers add support for core contexts and versions later than 3.0. I doubt this will happen. They're dragging their feet.

2. OS X adds support for compatibility contexts. Again, not hopeful.

3. We find some other way to get an OpenGL context on Linux that's associated with a GTK widget. There aren't many options.

4. I develop using OpenGL 2.1. I lose a lot of shading language features that way, though, and probably a lot of performance.

5. I develop multiple rendering paths. I hate this idea, but it may be what I have to do.