Wednesday, December 15, 2010

Download Time

I kept reading about all the fun everyone was having with the ProjectEuler thing, so I thought I'd give it a try. I thought it was pretty easy until I got to that one problem where they ask you to add up all the multiples of 3 or 5 that are less than 1000. I hear that people are using Python and letting the computer do the number crunching.

So, I think to myself, "Self, you took Pascal about 20 years ago back when RAM was measured in single digits and you said 'bless you' if someone said, 'gigahertz.' in college and absolutely hated that freaking class came out a better person because of it. This may be something you don't have time for, I mean you have 5 kids. Wake the heck up an enriching experience. And besides...Pascal...Python, they both start with Ps yeah, that's probably the only thing they have in common. You got this, man. G'head, give it a try."

I go to the Python site and read every thing I can to figure out which version would best suit me. (There's a lot to choose from, you know.) I can't find anything anywhere. It's all so confusing. Please. Someone. Give me a nudge in the right direction.

So I take a shot in the dark and go with v.2.7.

Anyway, this isn't really about Python. It's about the video I grabbed while downloading the program. I'm going to have my kids wrestle with it after break.

I may not ever find the solution to that really difficult problem about multiples of 3 and 5, but at least I got a lesson out of it.

6 comments:

Sue VanHattum said...

I used to program, but it was a while ago. I don't know python (or any of the other languages people talk about these days). When I got to a problem in Project Euler that needed some serious number crunching, I used Excel. I got though a number of problems that way.

You might be able to do the question you mentioned without any programming, though.

Pete Welter said...

Great example. The progress bar brought up another idea. I've been thinking how in most Algebra I curricula I've seen functions are introduced but then sort of dropped with no real reason for their use other than the f(x) notation. I've been thinking that introducing the need for composition of functions taking an idea from programming a progress bar might be useful.

As you know, much of what happens in code is transforming one piece of data to another using a series of logical blocks. In the case of the progress bar, you could model the entire thing using mathematical functions.

Consider the mapping from the byte downloaded : total bytes ratio to the length of the progress bar. There is the decimal of that calculation, it's transformation into a percentage, the mapping of that percentage onto a graphical bar whose length may not be a nice number, and maybe the transformation of the location of the bar to it's location in the window. Each of these steps could be modeled in a different mathematical function, whose composition would give the location of the end of the current progress.

(For a vertical progress bar which goes up as progress occurs, you could toss in the idea that for computer screens 0,0 is generally the left,top and y increases downward, so the progress needs a function to flip it.)

None of these transformations is all that difficult in themselves, and having the graphical representation gives concreteness to the example.

Sue VanHattum said...

I wasn't getting the point - why would the progress bar be a good classroom topic? But I like what you suggest Pete. I want to focus on functions when I teach Intermediate Algebra next semester.

David, is this the sort of thing you had in mind, or do you have other directions you want to take this?

Phil Wagner said...

Hi there,
I maintain resources for getting started with Python especially for Education here http://brokenairplane.blogspot.com/p/programming-resources.html

You might want to start here http://brokenairplane.blogspot.com/2010/08/computer-science-programming-intro.html

You downloaded the correct Python especially if you decide to get into some cool stuff with VPython. Also Python and Pascal have many similarities so you should be fine.

I can show you how to do the multiples problem in Python but it sounded like you wanted to figure it out for yourself so let me know if you or your readers want any help with this or Programming in the Classroom.

Great blog, I spent all morning checking out your posts, really enjoyed it. Keep up the good work!

David Cox said...

Sue
I had my tongue firmly planted in cheek with regards to the multiples problem.

The question I had in mind for the download time was simply, "How long is it going to take?" which is the exact question I find myself asking every time I try to download something.

Peter
Thanks for the suggestion.

untilnextstop said...

Hey David, I actually solved that problem using math alone. I did all the calc by hand with help of a four-function calc and some tricks about adding arithmetic series. The only other problem I could do at a quick glance was the multiples-of-numbers-less-than-20 one.

I'm trying not to have to program to solve these other ones. Ambitious??