Deprecated: Creation of dynamic property wpdb::$categories is deprecated in /var/www/twodee/blog/wp-includes/wp-db.php on line 668

Deprecated: Creation of dynamic property wpdb::$post2cat is deprecated in /var/www/twodee/blog/wp-includes/wp-db.php on line 668

Deprecated: Creation of dynamic property wpdb::$link2cat is deprecated in /var/www/twodee/blog/wp-includes/wp-db.php on line 668

Deprecated: Return type of WP_Theme::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-theme.php on line 554

Deprecated: Return type of WP_Theme::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-theme.php on line 595

Deprecated: Return type of WP_Theme::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-theme.php on line 535

Deprecated: Return type of WP_Theme::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-theme.php on line 544

Deprecated: Return type of WP_REST_Request::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/rest-api/class-wp-rest-request.php on line 960

Deprecated: Return type of WP_REST_Request::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/rest-api/class-wp-rest-request.php on line 980

Deprecated: Return type of WP_REST_Request::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/rest-api/class-wp-rest-request.php on line 992

Deprecated: Return type of WP_REST_Request::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/rest-api/class-wp-rest-request.php on line 1003

Deprecated: Return type of WP_Block_List::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-block-list.php on line 151

Deprecated: Return type of WP_Block_List::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-block-list.php on line 175

Deprecated: Return type of WP_Block_List::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-block-list.php on line 164

Deprecated: Return type of WP_Block_List::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-block-list.php on line 186

Deprecated: Return type of WP_Block_List::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-block-list.php on line 138

Deprecated: Return type of WP_Block_List::offsetExists($index) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-block-list.php on line 75

Deprecated: Return type of WP_Block_List::offsetGet($index) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-block-list.php on line 89

Deprecated: Return type of WP_Block_List::offsetSet($index, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-block-list.php on line 110

Deprecated: Return type of WP_Block_List::offsetUnset($index) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-block-list.php on line 127

Deprecated: Return type of WP_Block_List::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/twodee/blog/wp-includes/class-wp-block-list.php on line 199

Deprecated: Creation of dynamic property Automattic\Jetpack\Connection\Manager::$error_handler is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/vendor/automattic/jetpack-connection/src/class-manager.php on line 91

Deprecated: Creation of dynamic property WPCOM_REST_API_V2_Endpoint_Instagram_Gallery::$is_wpcom is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-instagram-gallery.php on line 23

Deprecated: Creation of dynamic property WPCOM_REST_API_V2_Endpoint_Mailchimp::$wpcom_is_wpcom_only_endpoint is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-mailchimp.php on line 17

Deprecated: Creation of dynamic property WPCOM_REST_API_V2_Endpoint_Tweetstorm_Gather::$wpcom_is_wpcom_only_endpoint is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-tweetstorm-gather.php on line 21

Deprecated: Creation of dynamic property WPCOM_REST_API_V2_Endpoint_Tweetstorm_Gather::$is_wpcom is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-tweetstorm-gather.php on line 22

Deprecated: Creation of dynamic property WPCOM_REST_API_V2_Endpoint_Gutenberg_Available_Extensions::$wpcom_is_site_specific_endpoint is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/gutenberg-available-extensions.php on line 20

Deprecated: Creation of dynamic property WPCOM_REST_API_V2_Endpoint_Memberships::$wpcom_is_wpcom_only_endpoint is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/memberships.php on line 23

Deprecated: Creation of dynamic property WPCOM_REST_API_V2_Endpoint_Memberships::$wpcom_is_site_specific_endpoint is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/memberships.php on line 24

Deprecated: Creation of dynamic property WPCOM_REST_API_V2_Endpoint_Subscribers::$wpcom_is_wpcom_only_endpoint is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/subscribers.php on line 15

Deprecated: Creation of dynamic property Automattic\Jetpack\Sync\Queue::$random_int is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-queue.php on line 38

Deprecated: Creation of dynamic property Automattic\Jetpack\Sync\Queue::$random_int is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-queue.php on line 38

Deprecated: Creation of dynamic property WPCOM_Widget_Goodreads::$shelves is deprecated in /var/www/twodee/blog/wp-content/plugins/jetpack/modules/widgets/goodreads.php on line 33

Deprecated: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in /var/www/twodee/blog/wp-includes/script-loader.php on line 348

Deprecated: Creation of dynamic property Advanced_Editor_Tools::$toolbar_classic_block is deprecated in /var/www/twodee/blog/wp-content/plugins/tinymce-advanced/tinymce-advanced.php on line 347

Deprecated: Creation of dynamic property Advanced_Editor_Tools::$toolbar_block is deprecated in /var/www/twodee/blog/wp-content/plugins/tinymce-advanced/tinymce-advanced.php on line 349

Deprecated: Creation of dynamic property Advanced_Editor_Tools::$toolbar_block_side is deprecated in /var/www/twodee/blog/wp-content/plugins/tinymce-advanced/tinymce-advanced.php on line 350

Deprecated: Creation of dynamic property Advanced_Editor_Tools::$panels_block is deprecated in /var/www/twodee/blog/wp-content/plugins/tinymce-advanced/tinymce-advanced.php on line 351

Deprecated: Creation of dynamic property Advanced_Editor_Tools::$used_block_buttons is deprecated in /var/www/twodee/blog/wp-content/plugins/tinymce-advanced/tinymce-advanced.php on line 354

Deprecated: Creation of dynamic property WP_Block_Type::$plan_check is deprecated in /var/www/twodee/blog/wp-includes/class-wp-block-type.php on line 333

Deprecated: Creation of dynamic property WP_Block_Type::$plan_check is deprecated in /var/www/twodee/blog/wp-includes/class-wp-block-type.php on line 333

Deprecated: Creation of dynamic property WP_Block_Type::$plan_check is deprecated in /var/www/twodee/blog/wp-includes/class-wp-block-type.php on line 333

Deprecated: Creation of dynamic property WP_Block_Type::$plan_check is deprecated in /var/www/twodee/blog/wp-includes/class-wp-block-type.php on line 333

Deprecated: Creation of dynamic property WP_Block_Type::$plan_check is deprecated in /var/www/twodee/blog/wp-includes/class-wp-block-type.php on line 333

Deprecated: Creation of dynamic property WP_Block_Type::$plan_check is deprecated in /var/www/twodee/blog/wp-includes/class-wp-block-type.php on line 333

Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/twodee/blog/wp-includes/wp-db.php on line 3030

Deprecated: Creation of dynamic property WP_Term::$object_id is deprecated in /var/www/twodee/blog/wp-includes/class-wp-term.php on line 198

Deprecated: Creation of dynamic property WP_Term::$object_id is deprecated in /var/www/twodee/blog/wp-includes/class-wp-term.php on line 198

Deprecated: Creation of dynamic property WP_Term::$object_id is deprecated in /var/www/twodee/blog/wp-includes/class-wp-term.php on line 198

Deprecated: Creation of dynamic property WP_Term::$object_id is deprecated in /var/www/twodee/blog/wp-includes/class-wp-term.php on line 198

Deprecated: Creation of dynamic property WP_Term::$object_id is deprecated in /var/www/twodee/blog/wp-includes/class-wp-term.php on line 198

Deprecated: Creation of dynamic property WP_Term::$object_id is deprecated in /var/www/twodee/blog/wp-includes/class-wp-term.php on line 198

Deprecated: Creation of dynamic property WP_Term::$object_id is deprecated in /var/www/twodee/blog/wp-includes/class-wp-term.php on line 198

Deprecated: Creation of dynamic property WP_Term::$object_id is deprecated in /var/www/twodee/blog/wp-includes/class-wp-term.php on line 198

Deprecated: Creation of dynamic property WP_Term::$object_id is deprecated in /var/www/twodee/blog/wp-includes/class-wp-term.php on line 198

Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383

Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383

Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383

Warning: Cannot modify header information - headers already sent by (output started at /var/www/twodee/blog/wp-includes/class-wp-block-list.php:14) in /var/www/twodee/blog/wp-includes/feed-rss2.php on line 8
experiments – teaching machines https://twodee.org/blog Thu, 29 Nov 2018 19:13:02 +0000 en-US hourly 1 https://wordpress.org/?v=5.7.1 Prior Art https://twodee.org/blog/16901 https://twodee.org/blog/16901#respond Thu, 29 Nov 2018 19:13:02 +0000
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383

Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
https://twodee.org/blog/16901 [...]]]> A year ago I made a little widget for visualizing the additive color mixing of RGB triplets. I had been teaching a course on front-end web development, and I wanted a tool to illustrate mixing that was easier to access than the traditional many-chambered Venn diagram.

Just this week I discovered that my widget is identical to the illustrations of painter Charles Hayter in his book A New Practical Treatise on the Three Primitive Colours Assumed as a Perfect System of Rudimentary Information, published in 1826.

Figure 1: Hayter’s illustrations on tricolor theory.

See Figure 3 in Figure 1.

]]>
https://twodee.org/blog/16901/feed 0
RGB Widget https://twodee.org/blog/15918 https://twodee.org/blog/15918#respond Sat, 06 May 2017 04:01:45 +0000
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383

Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
http://www.twodee.org/blog/?p=15918 [...]]]> I was sitting in a talk today when something made me think of how we represent colors in terms of red, green, and blue intensities. We often illustrate how these components mix together with a Venn diagram of three circles. The intersection of red and green is yellow, the intersection of green and blue is cyan, and the intersection of blue and red is magenta. The intersection of all is white.

For someone new to additive color, this diagram of circles presents too much information at once. So, instead of listening to the speaker, I thought about ways to simplify the illustration. Here’s a first attempt, in which we consider only the combination of all three intensities:

]]>
https://twodee.org/blog/15918/feed 0
Morse on Arduino https://twodee.org/blog/14947 https://twodee.org/blog/14947#respond Mon, 27 Jun 2016 15:21:46 +0000
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383

Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
http://www.twodee.org/blog/?p=14947 [...]]]> A few months ago, my seven-year-old son and I took a long car trip together. To redeem that time of extended idleness, we listened to The Mysterious Benedict Society, a novel about four orphans who team up against a mad scientist trying to take over the world. They regularly communicate with Morse code.

My son and I decided that we’d learn Morse code this summer. We’ve been sending each other messages to decode, and we practice recognizing letters using an app that I wrote for my phone.

This past weekend, we decided to write a Morse code flasher. Given a message, we’d flash an LED to emit the dots and dashes of the message’s Morse code translation. I had my son sit at the computer, and I plugged in an Arduino. I told him what code to write, and he typed it in. He picked the message to broadcast. Can you tell what it is?

This is the Arduino sketch that we wrote:

#define LETTER_DELAY 4000
#define WORD_DELAY 3000

void dash() {
  digitalWrite(13, HIGH);
  delay(3000);
  digitalWrite(13, LOW);
  delay(500);
}

void dot() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(500);
}

void t() {
  dash();
  delay(900);
}

void h() {
  dot();
  dot();
  dot();
  dot();
  delay(900);
}

void e() {
  dot();
  delay(900);
}

void c() {
  dash();
  dot();
  dash();
  dot();
  delay(900);
}

void a() {
  dot();
  dash();
  delay(900);
}

void i() {
  dot();
  dot();
  delay(900);
}

void s() {
  dot();
  dot();
  dot();
  delay(900);
}

void n() {
  dash();
  dot();
  delay(900);
}

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  t();
  h();
  e();
  delay(WORD_DELAY);

  c();
  a();
  t();
  delay(WORD_DELAY);

  i();
  s();
  delay(WORD_DELAY);

  n();
  i();
  c();
  e();
  delay(WORD_DELAY);
}

We started with functions dot and dash. Then we wrote functions t, h, e, c, a, i, s, and n. Though there are shorter ways to write this (make a table of each letter and its encoding, and then loop through the message, looking up the Morse sequence in the table and calling dash and dot appropriately), this approach was one that my son understood pretty clearly. Honestly, I really like this example for motivating procedural decomposition and code reuse. I may have to use it in our introductory programming course!

My son and I haven’t written a lot of code together, but he’s often watched me. He took to it pretty well and caught on to several patterns and rules: parentheses must balance (he marveled at the highlighting the IDE did when we closed off a pair), lines must end in semicolons, and durations had to be expressed in milliseconds (he corrected a place where we had entered seconds). He wondered why the words were colored differently, what case should be used for different strings of text (OUTPUT vs. digitalWrite), and what void meant. I let my son pick all the durations, and I intended for us to use constants to make them easy to change, but our time was cut short by a birthday party!

When I code with my son, I observe what I think is one of the primary benefits of blocks programming languages like Scratch: typing is excruciatingly slow at this age. My son does not know where the letters are. He did catch on to the Shift key pretty quickly, but we still saw a number of 90s instead of ()s, which he mostly self-corrected. Copy and paste came in handy! He asked why the keyboard had two commas. I asked him to type both, and he pointed out that one was an apostrophe.

I’m excited for the fall so I can send my son secret messages in his lunch.

]]>
https://twodee.org/blog/14947/feed 0
Comparing High-dimensional Objects https://twodee.org/blog/14771 https://twodee.org/blog/14771#respond Mon, 09 May 2016 12:57:46 +0000
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383

Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
http://www.twodee.org/blog/?p=14771 [...]]]> Lots of researchers have studied children’s perceptions of the size of multidimensional objects. Children compare two lines with reasonable accuracy, but how about comparing two rectangles of differing aspect ratios? Or two containers of liquid, one short and squat, the other tall and narrow?

Based on a some experiments I read in Duckworth’s The Having of Wonderful Ideas, I decided to try out an activity on two of my own children. Each receives the same number of cubic blocks. Each is to independently build a rectangular prism out of those blocks, with no knowledge of the other’s choice of dimensions. Then we compare the two structures.

While they are building, I secretly hope they build structures of different dimensions. To increase the chances of this, I need to provide a number of blocks that can be decomposed into three factors—height, width, and depth—in many different ways. For example, 8 blocks can be composed into prisms of three possible configurations: 8x1x1, 4x2x1, and 2x2x2. I had guesses about which numbers would be good choices, but I thought proving their goodness with a program might help me strengthen my Haskell muscle a bit.

First I made some data types to help me model the problem. Triplet represents the three dimensions of a prism, while VolumeAndTriplets is the pair of a volume and its list of possible dimensions that multiply up to that volume. I implemented compare to help me select our the volumes with the most number of possible triplets, favoring smaller volumes over larger ones in the case of a tie:

type Triplet = (Int, Int, Int)
data VolumeAndTriplets = VolumeAndTriplets Int [Triplet] deriving (Eq)

instance Ord VolumeAndTriplets where
  (VolumeAndTriplets volume1 triplets1) `compare` (VolumeAndTriplets volume2 triplets2) =
    if ntriplets1 == ntriplets2 then 
      volume1 `compare` volume2
    else
      ntriplets2 `compare` ntriplets1
    where ntriplets1 = length triplets1
          ntriplets2 = length triplets2 

instance Show VolumeAndTriplets where
  show (VolumeAndTriplets n triplets) = show n ++ " has " ++ show (length triplets) ++ " triplets: " ++ show triplets

From there, I wrote factorVolume to compute the list of possible dimensions for a single volume. List comprehensions were a good fit for this task:

-- Compute list of all triplets that multiply to a given volume.
factorVolume :: Int -> [Triplet]
factorVolume volume = [(a, b, c) | a <- [1..volume], b <- [1..a], c <- [1..b], a * b * c == volume]

Running factorVolume 24 produces the following list:

[(4,3,2),(6,2,2),(6,4,1),(8,3,1),(12,2,1),(24,1,1)]

Since I wanted to choose among many volumes, I wrote factorVolumes to map over a list of possible volumes and produce a list of volumes and their triplet lists:

-- Compute all possible triplet lists up to a given volume.
factorVolumes :: Int -> [VolumeAndTriplets]
factorVolumes upper = map (\volume -> VolumeAndTriplets volume (factorVolume volume)) [1..upper]

Running factorVolumes 10 produces the following output:

1 has 1 triplets: [(1,1,1)]
2 has 1 triplets: [(2,1,1)]
3 has 1 triplets: [(3,1,1)]
4 has 2 triplets: [(2,2,1),(4,1,1)]
5 has 1 triplets: [(5,1,1)]
6 has 2 triplets: [(3,2,1),(6,1,1)]
7 has 1 triplets: [(7,1,1)]
8 has 3 triplets: [(2,2,2),(4,2,1),(8,1,1)]
9 has 2 triplets: [(3,3,1),(9,1,1)]
10 has 2 triplets: [(5,2,1),(10,1,1)]

Now I wanted to find the volumes up through 64 with the most factors:

main = (putStr . unlines . map show . take 10 . sort) $ factorVolumes 64

This gave me the following output:

60 has 10 triplets: [(5,4,3),(6,5,2),(10,3,2),(10,6,1),(12,5,1),(15,2,2),(15,4,1),(20,3,1),(30,2,1),(60,1,1)]
48 has 9 triplets: [(4,4,3),(6,4,2),(8,3,2),(8,6,1),(12,2,2),(12,4,1),(16,3,1),(24,2,1),(48,1,1)]
36 has 8 triplets: [(4,3,3),(6,3,2),(6,6,1),(9,2,2),(9,4,1),(12,3,1),(18,2,1),(36,1,1)]
64 has 7 triplets: [(4,4,4),(8,4,2),(8,8,1),(16,2,2),(16,4,1),(32,2,1),(64,1,1)]
24 has 6 triplets: [(4,3,2),(6,2,2),(6,4,1),(8,3,1),(12,2,1),(24,1,1)]
40 has 6 triplets: [(5,4,2),(8,5,1),(10,2,2),(10,4,1),(20,2,1),(40,1,1)]
54 has 6 triplets: [(6,3,3),(9,3,2),(9,6,1),(18,3,1),(27,2,1),(54,1,1)]
56 has 6 triplets: [(7,4,2),(8,7,1),(14,2,2),(14,4,1),(28,2,1),(56,1,1)]
30 has 5 triplets: [(5,3,2),(6,5,1),(10,3,1),(15,2,1),(30,1,1)]
32 has 5 triplets: [(4,4,2),(8,2,2),(8,4,1),(16,2,1),(32,1,1)]

Despite this program telling me that 60 blocks would be the volume most likely to produce prisms of differing dimensions, we don't own a set of blocks large enough. Instead, I gave each son 24 blocks. They went to separate locations in the house. My 7-year-old built a 6x2x2 structure quickly, and my 5-year-old went through several attempts. At first, he didn't use all the blocks. His next structure wasn't a rectangular prism—all the blocks were in disarray. I told him they needed to be tightly packed to look like a box, and his third attempt was a 6x4x1 prism.

Then I sent one boy away and asked the remaining to compare the two structures. Was the 5-year-old's structure bigger than, smaller than, or the same size as the 7-year-old's? My 5-year-old said his was bigger. My 7-year-old said the 5-year-old's was bigger, qualifying "bigger" as "wider." Thus, they were in agreement.

At this point, I got out a couple of vases while they weren't looking. One was short and squat and the other tall and narrow. I filled each with 2 cups of water. Showing them to my sons, I asked, "Suppose you were really, really thirsty. Which of these would you rather drink out of?" My 5-year-old said the short and squat one because it held more. With both the prisms and the vases, to him width and depth were the most salient dimensions. If the width and depth were more, the difference in height was disregarded. My 7-year-old guessed that they contained the amount, seeing that the narrow width of the second vase squeezed the water upward. My 5-year-old didn't agree.

We emptied the short and squat vase. We placed a rubber band around the tall narrow one marking the level of the water, and then poured its contents in the short and squat one. The water reached a much lower height than the rubber band. I asked my 5-year-old, "Is that the same amount of water that was just in the tall vase?" He said yes. I asked, "How high would the water be if I poured it out on the kitchen floor?" He said, "Not even an inch."

Then we revisited the prisms made out of blocks. I asked, "What do you think about the sizes now?" My 7-year-old said that they were the same. "How do you know that?" I asked. He counted the blocks and found 24 in each.

We closed the experiment by talking about how we can't always trust our eyes when it comes to comparing objects of many dimensions. My 7-year-old suggested that we can be more accurate by counting.

]]>
https://twodee.org/blog/14771/feed 0
Combining Temperatures https://twodee.org/blog/14766 https://twodee.org/blog/14766#respond Sat, 07 May 2016 00:42:14 +0000
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
http://www.twodee.org/blog/?p=14766 [...]]]> I’ve been reading Eleanor Duckworth’s The Having of Wonderful Ideas, and I can’t go a page in the book without reading about an experiment that I want to try on my children. Last night I tried one about combining temperatures on my older sons, who are seven and five years old.

Knowing that my seven-year-old is often right about things, leaving little opportunity for others to be right, I first directed this question at my five-year-old: “Suppose you have two identical pots, each filled with 100-degree water. You pour both into a bigger pot. What’s the temperature of the water now?” My five-year-old son answered without a moment’s hesitation, “They are the same, so the temperature would be the same.”

My seven-year-old son said that the temperature would be 200 degrees. I asked him what the temperature of the human body was. He said 360 degrees. I said, “No, that’s how many degrees are in a circle.” He said 229 degrees. I told him human bodies were around 98.6 degrees, near enough to 100 degrees. We then talked about boiling, which happens at a little above 200 degrees. I then asked him, “What would happen if I drank a glass of 100-degree water? Would that be a good idea or a bad idea?” He said it would be bad idea, so I went and heated up some water to 105 degrees and drank it all in one gulp in front of him. I did not die.

We then talked through the problem some more. I hunted around for similar phenomena to help him understand what happens when you combine temperatures. I started with color: “What happens when you paint red on red?” He said it gets darker and thicker. That metaphor didn’t really help. I paused, not sure where to head next. I gave up on metaphors and went back to temperature.

We talked about water freezing below 32 degrees and ice melting above 32 degrees. “What happens if you put five 10-degree ice cubes next to each other?” He answered that the temperature goes up to 50 degrees. But he paused and pictured the resulting puddle of melted ice cubes, which didn’t make sense to him. “They stay 10 degrees,” he concluded.

Next I asked what would happen if we put an object that was 10 degrees next to an object that was 20 degrees. He said that one object would jump to the temperature of the other. “Which object would change?” I asked. He wasn’t sure. “What happens when you put an ice cube on the counter?” He answered, “It melts.” I asked, “What happens to the counter?” He recalled from his experiences, “It gets cold.” After a brief moment, he concluded, “Both objects would be 15 degrees.”

]]>
https://twodee.org/blog/14766/feed 0