Math Camp I: Recursion and such

The past two years I’ve taught at a summer math camp for high school students. In 2010 I assisted with a class on chaos and fractals. This year I assisted with a computers class. I’m planning to do a couple of posts about the class. This is the first of those posts.

The computer class that I helped teach focused on hardware, but also included some software topics. My main role was teaching programming. I should point out that I am not really a programmer. I’m a mathematician who uses some programming in his work. I’ve never had a programming class. Nevertheless, I hope that I was able to get some of the basics across to the students.

I first introduced programming to the students by describing a simple language for manipulating a cube, the goal being to get the cube in a prescribed orientation. More on that in a later post.

We did our programming in two languages: Python (which you can try in your browser at: Try Python) and Alice. Both are freely available. In Python we did some simple procedural programming (I had them code up a function that computes the factorial of a number and another that runs the Collatz algorithm). One of the students was able to produce a factorial algorithm very quickly. Here is his python code:

def factorial(n):
    if n == 0:
        return 1
        return n * factorial(n-1)

It surprised me that he used recursion, though I think he has had some programming experience in the past. Most of the other students had had no prior programming experience and were having a hard time producing a factorial function. This also surprised me. This was my first time teaching programming, so I had little intuition for where the students might get hung up.

Alice is a drag-and-drop object-oriented language for manipulating characters in a 3-D virtual world. We mostly let the students explore Alice on their own as their interests dictated. One student wrote a very simple first-person shooter game.

In any case it was hard to get any of the kids very interested in programming. If I go back next year and assist with this same class, then I think I would like to have some compelling problems or mini-projects that would grab the kids attention and require them to do some programming. Suggestions anyone?

This entry was posted in computers, teaching. Bookmark the permalink.

2 Responses to Math Camp I: Recursion and such

  1. Chad says:

    You might want to look at the Processing language. Kind of an all in one development environment and language that offers a lot of visual and audio capabilities that might be more interesting for kids. it’s intended for graphic arts type applications so it’s pretty easy to pick up the basics.

    PS…Loved the posts about teaching your kids the basics of computing.

    • toomai says:

      Chad, Thanks. I’ll have to look into the Processing language. I hadn’t heard of it before.

      Glad you liked the posts about computer basics with my kids.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s