> Computers are said to be discrete devices, but then so are films and > videos discrete. Around 24 frames / sec is sufficient to create a > sensation of continuity i.e. no gaps in the action. Frame rates of 30 > and above are common. The color value of each pixel is controlled by > some 32 on-off toggles, or 255 * 255 * 255, where each integer 0 <= x > <= 255 is represented by 8-bits. Red, green blue (RGB). >
Oops. 8 bits per each of 3 colors (R, G, B) is only 24 bits, not 32 bits.
Another good algorithm to focus on, yes in K-12 STEM, not wait until college: Base64.
When you send that picture attachment by email, it's likely going via SMTP, a mail transfer protocol.
Guess what: binary files made of bytes will use each bit in every byte as significant.
But then: SMTP inherits from the days of 7-bit ASCII with the last bit a checksum parity check.
Problem: how to squeeze binary files of 8-bit bytes through a pipe that only accepts bytes with a first bit 0?
Answer: Base64, but in constructivist fashion we have them think it through with us. "What would *you* do?"
The goal is not to get the "one right answer" because there isn't one. A ballpark of strategies, from which one is chosen.
Base64 maps the 26 lowercase + 26 uppercase + digits 0-9 plus a few more symbols to give only 64 symbols.
That's right, the top two bits are left empty but since 8 * 3 = 6 * 4, you get all the info in 3 binary bytes squeezed into 4 base64 bytes.
And these latter are represented as printable characters in ASCII, the codec SMTP knows and loves.
Ergo: that binary file you attached *does* make it through a "text only" pipe, masquerading as printable (but unreadable) text.
You have learned something valuable about STEM today, i.e how the Internet works (lots of protocols) and how algorithms come to the rescue sometimes, almost deus ex machina (as if a god from the skies, praise Allah).
> Playing with RGB to control pixel colors is something to do early and > often in math class, if you have any access to recent technology. > > Pixels are another good example of discrete entities given the > appearance of continuity or "analog smoothness". This will inspire > some students to ask whether perceived reality might be considered > "discrete" at some level as well, and in terms of rods and cones, > neurons firing (or not) the answer is yes: there's usually a way to > take any analog phenomenon and model / represent it in digital terms. > > Kirby