Last week I was in Denver for a large middle school STEM event. They had a large selection of workshops for well over 1,000 middle school girls. My co-worker Hilary Pike did three workshops while I took care of our booth. During a lull I had a chance to visit other booths and one of the booths I visited was by the American Council of Engineering Companies in Colorado. I picked up a bookmark that told about horsepower. Did you know that horsepower was based on James Watt finding that a work horse could lift a 1,000 pound weight 33 feet in 60 seconds? Neither did I. Well actually it is more complicated than that and there are actually a number of different ways to calculate horsepower. Visit Wikipedia at http://en.wikipedia.org/wiki/Horsepower for some additional information and links.
But for the time being let’s stick with this definition. If you want to figure out your own horse power you can do so by using your weight, and counting the steps you can climb in a minute. So if you are 100 pounds and climb 495 8-inch stairs in a minute that is one horsepower. The bookmark I picked up had this formula for figuring out how many steps one had to climb in in minute for one horsepower.
33,000 ÷ your weight = (answer)
(answer) x 1.5 = number of steps to climb
My fist inclination since I love math but am not overly fond of doing division and multiplication by hand was “hey I can write a short program to do that!” So I did. I translated that formula to C# as:
int iWeight = int.Parse(textBox1.Text); int ans = 33000 / iWeight; double dSteps = ans * 1.5; MessageBox.Show(dSteps.ToString());
That code takes a weight as string from a textbox and displays the number of steps to climb for one horsepower in a message box. In Visual Basic .NET it would be:
Dim iWeight As Integer = Integer.Parse(textBox1.Text) Dim ans As Integer = 33000 / iWeight Dim dSteps As Double = ans * 1.5 MessageBox.Show(dSteps.ToString())
Well you could do this just as well with a calculator or a spreadsheet.
So what kind of program is that? Pretty boring. So I started thinking about ways to make it more interesting. Perhaps a table? The very earliest computers were used to compute all sorts of tables. Of course back then computers took up whole rooms and so printing out tables was the way to go. But still I think there is some learning we can get from all this.
First off what if you don’t have 495 steps to climb? If you have fewer steps to climb you are likely not to take a whole minute to climb them. The obvious answer is to build a formula that takes the number of stairs you climb, the time you take to climb them and your weight into account and tells you how much horsepower you have generated. Yeah, algebra! So that’s what I did.
But you know it still seemed like building a table was a job for a spreadsheet. So to test my formula I built a spreadsheet. I put the number of steps in cell A1 and built a list of weights across the top and a list of seconds down the left side. By the way if you haven’t looked into Auto Fill in Excel you are missing a great shortcut. I then created the formula (no I’m going to leave figuring that out to you. Ask a Math teacher for help in you need it.) I used absolute addressing so that I could then just copy cells to fill out the spread sheet. And lastly I added conditional formatting to make cells that were more then one horsepower red, one horsepower to .70 horsepower in green and less than .70 horsepower in yellow. The results looked like this for 60 steps.
I think the coloring adds to the table. To me it makes things more clear at a glance. Using color in tables can be very helpful if not overdone.
So I started with a computer program that really was a better fit for a spreadsheet. Back when I started with computers we didn’t have spreadsheet programs which is probably why my mind still starts with “write a program.” This is something of a reminder to me to think a bit more about the right tools for the job. In between I was reminded yet again that algebra skills can turn out to be very useful when you have one formula but really need another one. And of course I had to throw in conditionally formatting to remind myself and others that the sort of things one learns in programming (conditionals in this case) often leads to useful thinking for other applications.
ACEC has a number of other interesting items – fun facts and activities – for students at their web site. Check it out.
There is a lot to think about and learn about in engineering and a lot of it is fun!