Butterflies in Polar Coordinates

A butterfly outline drawn from a trigonometric function in polar coordinates.
A butterfly outline drawn from a trigonometric function in polar coordinates.

I was looking for mathematical functions I could use to shape guitar bodies, and I came across Hubpages’ user calculus-geometry‘s beautiful page on how to generate butterfly outlines using functions in polar coordinates.

The butterfly above was generated using the function:

r(θ) = 12 – sin(θ) + 2 sin(3θ) + 2 sin(5θ) – sin(7θ) + 3 cos(2θ) – 2 cos(4θ)

The code I used (using VPython) is:

from visual import *

''' the main function '''
def r(theta):
    #r = 1+cos(theta)
    
    #Archimides' sprial
    #r = 0.5*(theta) 
    
    #heart: http://jwilson.coe.uga.edu/EMT669/Essay.ideas/Heart/Hearts.html
    #r = 5*sin(theta) - sin(5*theta)
    
    #butterfly: http://calculus-geometry.hubpages.com/hub/Butterfly-Curves-in-Polar-Coordinates-on-a-Graphing-Calculator
    #r = 8-sin(theta)+2*sin(3*theta)+2*sin(5*theta)-sin(7*theta)+3*cos(2*theta)-2*cos(4*theta)
    r = 12-sin(theta)+2*sin(3*theta)+2*sin(5*theta)-sin(7*theta)+3*cos(2*theta)-2*cos(4*theta)

    return r

'''convert to rectangular coordinates'''
def xy(r, theta):
    x = r * cos(theta)
    y = r * sin(theta)
    return vector(x, y)


path = curve(color=color.green, radius=.2)


theta = 0.0

print pi, theta, r(theta) , xy(r(theta), theta)

while theta <= 2*pi:
    rate(100)
    theta += 0.01
    path.append(pos=xy(r(theta), theta))
    


Sculpting the Guitar

Sanding and sculpting the guitar bodies was loud, dusty and took a while.

Sculpting the guitar body.
Sculpting the guitar body.

The shape of an electric guitar’s body does not matter that much–they’ve even been made out of 2×4 (inches) pieces of wood–, so there’s a lot of room for creativity when sculpting your guitar’s shape. There’s a little more restriction for the guitar bodies from the guitarbuilding project because they come with cutouts for the electronics that have to be avoided. However, your main limitation is time.

Even with the big rasp, sculpting is not easy, especially since some of the types of wood used for the bodies can be quite hard. The darker strip in mine was particularly difficult.

I chose to carve out two parts of the body. First, it’s a lot more comfortable if the bit where the guitar tucks into your ribs is curved and smoothed; second, shaving down the area where your strumming forearm comes across the guitar makes the strings easier to get to.

Once the sculpting was done, I used a router to round all the other edges.

Routing the edges with a table router.
Routing the edges with a table router.

Necks, Fretboards, and Scale Length

Pluck a string on a guitar and the sound you hear depends on how fast it vibrates. The frequency is how many times it vibrates back and forth in each second. An A4 note has a frequency of 440 vibrations per second (one vibration per second is one Hertz).

The vibration frequency of a guitar string depends on three things:

  • the mass of the string
  • the tension on the string (how tight it’s pulled)
  • and, the length of the string.

Guitar string sets come with wires of different masses. The guitar has little knobs on the end for adjusting the tension. For building the guitar, you have the most control over the last last parameter, the length of the string, which is called the scale length. Since the guitar string masses are pretty much set, and the strings can only hold so much tension, there are limits to the scale length you can choose for your guitar.

In a guitar, the scale length only refers to the length of the string that’s actually vibrating when you pluck the string, so it’s the distance between the nut and the bridge. For many guitars this turns out to be about 24.75 inches.

For a guitar, the scale length is the length of the strings that are free to vibrate.
For a guitar, the scale length is the length of the strings that are free to vibrate.

Frets

To play different notes, you shorten the vibrating length of the string by using your finger to hold down the string somewhere along the neck of the instrument. The fret board (which is attached to the neck) has a set of marks to help locate the fingering for the different notes. How do you determine where the fret marks are located?

Well, the music of math post showed how the frequency of different notes are related by a common ratio (r). With:

 r = \sqrt[12]{2}

So given the notes:

Note Number (n) Note
0 C
1 C#
2 D
3 D#
4 E
5 F
6 F#
7 G
8 G#
9 A
10 A#
11 B
12 C

Since the equation for the frequency of a note is:

 f_n = f_0 \; r^n

we can find the length the string needs to be to play each note if we know the relationship between the frequency of the string (f) and the length of the string (l).

It turns out that the length is inversely proportional to the frequency.

 l = \frac{1}{f}

So we can calculate the length of string for each note (ln) as a fraction of the scale length (Ls).

 l_n = \frac{1}{f_n}

substituting for fn gives:

 l_n = \frac{1}{f_0 \; r^n}

but since we know the length for f0 is the scale length (Ls) (that inverse relationship again):

 l_n = \frac{1}{\frac{1}{L_s} \; r^n}

giving:

 l_n = \frac{L_s}{r^n}

When we play the different notes on the guitar, we move our fingers along the neck to shorten the vibrating parts of the string, so the base of the string stays at the same place–at the bridge. So, to mark where we need to place our fingers for each note, we put in marks at the right distance from the bridge. These marks are called frets, and we’ll call the distance from the bridge to each mark the fret distance (D_n). So we reformulate our formula to subtract the length of the vibrating string from the scale length of the guitar:

 D_n = L_s - \frac{L_s}{r^n}

Showing the fret distance.
Showing the fret distance.

The fret marks are cut into a fret board that was supplied by the guitarbuilding team, which we glued onto the necks of our guitars. We did, however, have to add our own fret wire.

Placing the fret wire into the fret cuts. The wire still needs to be fully pressed in.
Placing the fret wire into the fret cuts. The wire still needs to be fully pressed in.

The team also has an activity for students to use a formula (a different one that’s recursive) to calculate the fret distance, but the Excel spreadsheet fret-spacing.xls can be used for reference (though it’s a good exercise for students to make their own).

The Math of Music

Mark French has an excellent YouTube channel on Mechanical Engineering, including the above video on Math and Music. The video describes the mathematical relationships between musical notes.

Given the sequence of notes: C, C#, D, D#, E, F, F#, G, G#, A, A#, B, C.

Let the frequency of the C note be f0, the frequency of C# be f1 etc.

The ratio of any two successive frequencies is constant (r). For example:

 \frac{f_1}{f_0} = r

so:

 \frac{f_1}{f_0} = \frac{f_2}{f_1} = \frac{f_4}{f_3} = \frac{f_{12}}{f_{11}} = r

We can find the ratio of the first and third notes by combining the first two ratios. First solve for f1 in the first equation:

 \frac{f_1}{f_0} = r

solving for f1,

 f_1 = f_0 \; r

now take the second ratio:

 \frac{f_2}{f_1} = r

and substitute for f1,

 \frac{f_2}{f_0 \; r} = r

which gives:

 \frac{f_2}{f_0} = r^2

We can now generalize to get the formula:

 \frac{f_n}{f_0} = r^n

or

 f_n = f_0 \; r^n

where,

  • n – is the number of the note

From this we can see that comparing the ratio of the first and last notes (f12/f0) is:

 \frac{f_{12}}{f_0} = r^{12}

Now, as we’ve seen before, when we talked about octaves, the frequency of the same note in two different octaves is a factor of two times the lower octave note.

Click the waves to hear the different octaves. The wavelengths of the sounds are shown (in meters).




So, the frequency ratio between the first C (f0) and the second C (f12) is 2:

 \frac{f_{12}}{f_0} = 2

therefore:

 \frac{f_{12}}{f_0} = 2 = r^{12}

so we can now find r:

 r^{12} = 2

 r = \sqrt[12]{2}

Finally, we can now find the frequency of all the notes if we know that the international standard for the note A4 is 440 Hz.

Mark French has details on the math in his two books: Engineering the Guitar which is algebra based, and Technology of the Guitar, which is calculus based.

Building a Guitar

Guitar bodies.
Guitar bodies.

This week I’m learning how to build an electric guitar–from scratch (or almost). Tom Singer, a professor in design and manufacturing at Sinclair Community College in Dayton, Ohio, is the lead on an NSF funded project to bring guitar building into schools.

I may have a tin ear when it comes to music, but there is quite the interest in guitar playing at the Fulton School at the moment–all the way from the elementary kids to the high schoolers–so I thought it would be a good catch-the-imagination mechanism for use in math and science.

Bodies

A guitar body, ready to become MY guitar.
A guitar body, ready to become MY guitar.

First we got to choose a guitar body. The guitarbuilding team had a fair collection of guitar shapes for the group in the workshop to choose from. The shapes are cut from 1.75 inch thick woo. To get the elegant layered patterns you see above, they laminate about half a dozen different types of wood. This may make for beautiful guitars, but the different densities and hardnesses of the wood have to be considered when working with them. The darker colored woods in the guitar body above were much harder to shave and sand than the lighter colored material.

Note to self: Indeed, if I remember to get hold of some scrap pieces of the different woods, I can probably make up a nice density measuring project. Indeed, it would be nice to have students graph the relationship between density and hardness. Wood hardness is measured on the Janka scale. I suspect there is a positive relationship, but I’d like to see if we could determine the shape of the curve.

Not all of the guitar bodies are beautiful laminates, however. Some, of a single type of wood, are the best candidates for painting. Others are hollowed out, and can be played acoustically as well as plugged in.

Neck and Fretboard

Today I learned what a fretboard is. Apparently it’s a separate piece with the gradational markings that’s attached to the neck.

Bodies, fretboards and necks.
Bodies, fretboards and necks.

The necks were all of maple, if I remember correctly, but the fretboards were made of different types of wood. Each was a single piece of wood, but the wood’s hardness and affects the “brightness” of the sound produced by the guitar.

So now it’s time to sculpt and sand the body, and put all the pieces together.

Viewing the Night Sky with Stellarium

Jupiter shines above the moon. Image generated for St. Louis, MO, USA at 9:30pm on May 31, 2014 using the program Stellarium.
Jupiter shines above the Moon. Image generated for St. Louis, MO, USA at 9:30pm on May 31, 2014 using the program Stellarium.

I received an urgent email last night from a student who, while in the car last night, noticed a bright object above the moon. Was it a planet as her mom suggested? And if so which one? And do planets generate their own light or are we just seeing reflected light?

The last question was the easiest. The planets don’t generate light. You need something big and hot and fusiony, like a star, to generate light.

To figure out what the bright object was I did an internet search for star charts, and came across the Texas Astronomical Society’s webpage “Star Charts for Beginners“, which pointed me to the excellent, free program Stellarium.

You can use Stellarium to generate labeled images of the sky for almost any time, date, and place.

It looks like Jupiter could be seen above the Moon last night.

Dandelion Season

Preparing the flowers for frying.
Preparing the flowers for frying.

The last two weeks have been peak dandelion season here in eastern Missouri, so I’ve been experimenting with the culinary uses of the flowers.

Dipped in batter and fried, the flower heads did not taste like much. Probably too much seasoning and too much batter. It was good advice to cut off as much of the green outer covering (the sepals) because they are bitter. However, if you cut too close to the base of the petals they fall out all over the place, which is good if you want to collect just the petals.

Dandelion flower fritter.
Dandelion flower fritter.

Collecting the petals only is great if you’re trying to make dandelion wine (I’m adapting the second recipe from here), except that I’m only using petals (2 quarts). I keep the same amount of sugar (3 lbs), oranges (4), water (1 gallon), and yeast (winemaker’s). This is the appropriate timing for this project since we just covered the differences between aerobic respiration and fermentation.

Two quarts (about 4 liters) of dandelion flowers for making a gallon of wine.
Two quarts (about 4 liters) of dandelion flowers for making a gallon of wine.

The Chicken Coops are Here

Finding the right place for the chicken coops.
Finding the right place for the chicken coops.

Now that we’re at the end of the academic year, our middle school business’ chicken coops have finally arrived (they were on back order). The kids had some fun finding the right spot for the coops, and we staked out an area for fencing; we plan to clip the birds’ wings.

Although, the coops came pre-assembled, the students needed to make some final adjustments.

Figuring out how the coops work.
Figuring out how the coops work.
Delineating the area for fencing.
Delineating the area for fencing.

Tomorrow, during math, they’ll be finding the perimeter so we can order fencing, and finding the area so we can know how much space we’ll have per bird.