Message Boards Message Boards

Writing letters (of alphabet) with kids

Posted 9 years ago

Here is an activity I did with my kids, to have some fun programming together doing something they know, or at least have some vague idea of what it is. For them, as preschoolers, writing letters. They at least know what it should look like. Trial and error is part of the fun.

We would start with a blank grid, pick a letter to do, choose a color and begin with the question "What is the first thing you do to draw letter E?"

Graphics[{Blue, Thickness[.01]}, Axes -> True, GridLines -> Automatic, PlotRange -> {{0, 7}, {0, 7}}, ImageSize -> 200]

blank grid

They would say draw a line and I'd ask where the lines go and we are off and running. Making circular arcs requires understanding the angular argument, but otherwise the coding is easily explainable.

first line

Through trial and error, we eventually reached this.

Graphics[{Blue, Thickness[.01], Line[{{1, 1}, {1, 5}}],  Line[{{1, 5}, {4, 5}}], Line[{{1, 3}, {4, 3}}],   Line[{{1, 1}, {4, 1}}]}, Axes -> True, GridLines -> Automatic,  PlotRange -> {{0, 7}, {0, 7}}, ImageSize -> 200]

E

Sometimes there was the opportunity to use a Table to try out parameters.

changing y

One of the nice things is that part of the resulting code resembles natural language.

With[{y = 3}, Graphics[{Orange, Thickness[.01], Line[{{1, 1}, {3, 6}}],  Line[{{3, 6}, {5, 1}}], Line[{{1, y}, {5, y}}]}, Axes -> True, GridLines -> Automatic, PlotRange -> {{0, 7}, {0, 7}},  ImageSize -> 200]]

I encourage you to try the attached notebook. Let me know what you think.

Attachments:
POSTED BY: Todd Rowland
4 Replies

Cool. Let me know how it goes.

POSTED BY: Todd Rowland

Right, I forgot about that. It's neat how one can go from making basic Graphics to machine learning even with kids who don't even know how to read yet.

It could be that doing numbers is better than letters because there is an example just sitting around for classifying digits at the end of the documentation of Classify (which is just a small line of code).

One tangent here is that I hope to hear more from Jesse about his classifier project (but at this stage maybe email is a better medium) and another tangent is that at last year's summer school to model brain diseases Laura Sainz Villalba used that digit classifier.

I am not sure what the optimal syntax is for Wolfram Alpha but close to making letters with graphics is this geometrical query "line from 1,1 to 1,6 and circle at 2,5 of radius 1" Maybe someone else knows of something better?

POSTED BY: Todd Rowland
POSTED BY: Jesse Friedman

You could probably automate the letter verification if you rasterized them and used a small Classify. Then you'd have a whole letter-learning program in just a few dozen lines of code!

On the subject of natural language processing, here's a very simple parser for a series of lines specified in string form:

d = "line from {1,1} to {3,6}; line from {3,6} to {5,1}; line from {1,3} to {5,3}";
Graphics[Join@{Orange, Thickness[.01], 
   Line /@ (ToExpression /@ 
      StringSplit[StringSplit[d, {"; line from ", "line from ",";"}], 
       " to "])}, Axes -> True, GridLines -> Automatic, 
 PlotRange -> {{0, 7}, {0, 7}}, ImageSize -> 200]

capital letter A made with simple natural language processing

I seem to recall that Wolfram|Alpha integration can take some simple graphics instructions and return a Graphics object, but I don't remember the correct syntax.

POSTED BY: Jesse Friedman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract