Monday, February 17, 2014

Superposition, Interference, and Audio Engineering

When musicians record in the studio, the will often record each instrument separately. Each recording would be stored in some sort of loss-less format, an example of which is .wav

A portion of a .wav file shown in Audacity
I'm not sure if the .wav file is a record of pressure over time or velocity over time, but either way it's a record of the sound wave received by the microphone. Each part (vocals, guitar, bass, drums, etc) will have one or more records and the Audio Engineer's job is to use superposition to combine all those parts into one file for the consumer.

For a demonstration of sound and superposition, I found a sample set of these separate recordings for Iron Maiden's "Run to the Hills" and used Audacity to combine them into three different files:

  • The complete song sample with all the parts
  • The song sample with all the parts except for the lead vocals (this is like a karaoke version)
  • An inverted version of the instruments-only song sample.
The normal Instrumental song and the inverted song side-by-side

I can then use Audacity to re-play those files in different combinations. I like to get the students to think about:

  1. Will the inverted instruments only file sound different to the sound wave when it's right-side-up?
  2. What will it sound like when the inverted instrumental track is played with the right-side-up track simultaneously? Audacity can load multiple files and play them all at once so we can test this out
  3. What will happen if I play the complete song and the inverted instrumental simultaneously?
If you'd like to run this demonstration you just need Audacity (or something similar) and the song files, which you can download here:

Thursday, February 13, 2014

Sinusoidal Components of a Square Wave

One of those mind-blowing things you learn studying Engineering is that functions can be expressed as a sum of sinusoids. The math is pretty well beyond most high school math and physics students but I have had some success presenting the idea and observing the phenomenon. I put together a quick simulation in excel that can be used to generate a sequence of higher-and-higher frequency sine waves that add up to a square wave.


You have to copy the entire column D, and paste it repeatedly into adjacent columns. You can keep going through the graphs into columns I, J, K, etc if you want.

Each column is a sine wave. As we move right through the columns, the frequency increase and the amplitude decreases. You can see all the sine waves together on the lower graph.


On the upper graph, we have the sum of all the superimposed waves. The more higher-frequency waves we add, the more square-like the sum becomes.

If you're curious, have a look at the formulas used to calculate the sine waves. You can also read more about the frequency components of sine waves here.

Standing Wave Formation Simulation

The latest version of Java has thrown a huge wrench into my classroom-machine. It won't allow me to run un-signed applets unless I add them to a whitelist. That's all well and good except that the permissions that my school assigned to my account prevent me from making changes to that whitelist. Grrrr.

Anyway, I can no-longer run many of my favorite physics applets in class, including this awesome simulation of a standing wave forming in a string with reflection.

From: Walter Fent
I've been learning a lot about VBA in Excel recently and decided to have a go at re-making the simulation in Excel. The result is a little rough-around the edges but it will work for my purposes:


You must enable macros to use the simulation. You can use the wavelength box to adjust the width of the waves. The sheet is protected, but there's no password so if you want to muck around you can unlock the sheet and play with the VBA code. I'm sure there are improvements to be made.

Saturday, January 18, 2014

OkTrends - The Math of Dating

OkTrends is a blog run by the folks at the matchmaking website OkCupid. Their website generates huge volumes of data on personalities, attraction, and sex and they've been crunching those numbers to see what interesting relationships pop out.

For example, in this graph Christian Rudder graphs how attractive people appear in their photos based on the time of day the photo was taken:

From OkTrends - Don't Be Ugly By Accident
In the graph, the blue line is the average attractiveness of photos grouped by time of day. Superimposed on that trend is another graph in yellow and brown of the height of the sun during the day and night. When the sun crosses the horizon that's sunrise and sunset. Mr Rudder is able to show evidence of Golden Hour; the hour after sunrise and before sunset when vivid colors fill the sky and make pictures more interesting.

There's tons of SL Math in this blog. Mr Rudder fits a sinusoidal curve to the attractiveness data in an attempt to show that photos taken in the afternoon and late at night are often most appealing.

From OkTrends - Don't Be Ugly By Accident
I'm planning to add this graph to my unit on sine and cosine. I imagine the discussion will be memorable

  • What does the trend suggest about good photos? 
  • Does the trend appear to be a good fit of the data?
  • What is the period of the graph? Would it have been reasonable to expect the period to be 24 hours?
  • If you were to perform the same study from scratch, how would you do it?

Finally, here's a graph comparing the number of (self-reported) sexual partners straight men and women have had to gay men and women:

From OkTrends: Gay Sex vs. Straight Sex
After thinking, "Wow, those trends are very similar," my next thought was, "Is that an Ogive?!" It seems like the only place I ever see Cumulative Frequency Charts is in IB exams but here's one in the wild!

Some questions I might ask students are:

  • Where do the two trends differ the most? What does that mean about the similarities and differences between the sexual habits of the gay and straight communities?
  • How many partners has the median straight/gay person had?
  • If this graph were to be turned into a frequency distribution, what shape would it have?
    • Followed up with: All of this data is self-reported. If respondents were to lie, what kinds of lies might they tell and how would that effect the shape of the expected distribution?
Some of the topics in the blog are a bit too racy for my classroom, but there are still a lot of useful gems. Honestly the whole thing is just fascinating.

Monday, October 28, 2013

Math Extension - Ancient Greek Geometry

Here's a fun puzzle I found out about recently. It's called Ancient Greek Geometry. The challenge is to create different shapes (like triangles, and circle patterns) using only a straight-edge and a compass. For example, here's a solution for a hexagon:

Hexagon Created Using a Straightedge and Compass
The program runs right in your browser and is easy to learn. Just point your students to the website (http://sciencevsmagic.net/geo/) and they'll figure out the rest.

There's also a number of other neat features from the same people at their website.

http://sciencevsmagic.net

Monday, October 21, 2013

f.lux - Use your montor's Color Temperature to help manage Sleep Schedules

We all know the importance of Sleep Schedules and getting enough sleep, especially to students. If not, check out this article discussing recent research on Sleep Deprivation and Academic Performance in Students. (SPOILER: Sleep deprivation inhibits learning).

Modern students face a double-whammy:
1)      We ask a lot from them
2)      They do their work on their computers

Together, these factors often lead our students to face their laptop screens up until they go to bed. According to this article discussing the relationships between screen brightness and sleep schedules, staring at a bright screen at night tricks your brain into thinking it’s daytime, preventing your brain from getting properly ready for bed and ruining your sleep schedule.

Enter f.lux, a program which will automatically adjust your screen’s color temperature during the day to mimic a sunset.



I've been using this program at home for years now and I love it. Before, I used to have to stop using my computer an hour before bed or I wouldn't feel tired. Now, I could fall asleep sitting up while reading at my computer. Best part: It’s free, so no harm in trying it. It takes about a day to get used to it and then you’ll wonder how you got by without it.

Tuesday, September 24, 2013

New Videos in Math SL and Physics HL Extension

I've been on vacation this week so I got off my butt and made a pair of videos on two topics that I find interesting.

First we have acceleration of a rocket with changing mass. In Physics HL we only ever deal with changing accelerations by looking at graphs but I wanted to go through the calculus to find the exact (well kinda) answer. In the end, probably due to some of the assumptions I made, I was off by a factor of 2.

In this video, I attempt to find the top speed of the Saturn V rocket if it were already free from earth's gravity and fully fueled.


Second we create an interesting shape by cutting into the side of a cylinder. Almost 10 years ago when I was still a university student on an internship, one of the drafters asked me what the volume of a circular cut out of the side of a cylinder would be. He already knew the answer, but I guess he wanted confirmation. I wasn't so great at calculus at the time and I didn't have any 3D software to help me visualize the shape so it took me three days to arrive at the answer. In the end I was surprised at how easy it was when you looked at the shape the right way.