Math Problem 191 – the forgotten function machine

September 21, 2009

I built a function machine ( give it a dollar and an integer n and it spits out f(n) ) but now I can’t remember what the function f is?  I remember that it’s a polynomial and that the coefficients are all non-negative integers ( just like last week’s n5 + 2 n4 + 0 n3 + 1 n2 + 3 n + c) but I don’t even remember the degree of the polynomial!

Now that's what I call a function machine!!

What is the least amount of money I can put into this machine to recover the forgotten polynomial f inside?  Explain.

Advertisements

Math Problem 188 — The Grumpy Ants

August 31, 2009

Four ants live on the four sides of a rectangle with sides of length 20 and 13 (one ant on each side).  They have had a falling out and can no longer stand the sight of each other.  As such, they wish to erect walls (line segments) inside the rectangle so that no ant, no matter where it is along its side, will ever see any of the other three.  The ants also want to do this with the minimum total length of material possible.

Four ants on the sides of a rectangle

What is the shortest total length of wall you can find that will effectively screen each ant from the three others?  Explain.

A Musician’s Guide to Fourier Series

April 21, 2009

One of the beautiful tools of Differential Equations, and one that often gets lost in the last two harried weeks of the semester, is the ability to synthesize any function on an interval using only a family of trig functions.

An Introduction to Fourier Series.

It is as if you were cooking, and the recipe called for three tablespoons of the rather unusual ingredient –x ln x.  Not surprisingly, when you look in the cupboard, you don’t have any.  So you look in the back of the cookbook for possible substitutions (like using applesauce instead of butter), and it says, instead of using x ln x on the interval [0,1], you can use

0.375 sin(πx)  +  0.072 sin(2πx)  +  0.038 sin(3πx)  +  0.019 sin(4πx)  +  …

You can see how well this fits in the graph below which includes the first six terms.  The blue curve is the original and the red curve is our synthetic approximation.  Including more and more terms allows us to approximate the original function arbitrarily closely.  If you would like to try and find a better approximation by hand, you can try out the spreadsheet that produces this figure.  Online here!  Just slide the sliders to adjust the coefficients!

-x lnx in blue, and our six mode approximation in red

In our differential equations class, we can determine the coefficients exactly by looking at the projection (or shadow) of the original function on each of the sine-terms.  This is an integral calculation where we simply find the area under the product of the original function and the each individual sine term.  The resulting series is called a Fourier series, after the mathematician (and Egyptologist) Joseph Fourier, who first wrote such a series down.

A Musical Interpretation.

When you pluck a string on a guitar, what do you hear?  Well, if this is the bottom E string on your guitar, and you listen carefully, you can hear not only the fundamental E2, but many overtones or harmonics as well (E3, B4, E4, G#4, B5, etc.).  Each of these tones corresponds to a particular vibrational mode of the string.  For the fundamental mode, the string is still only at the ends – every other point on the string moves transversely back and forth, with the biggest motions right in the middle.  The first overtone has an unmoving node right in the middle, and has the biggest motions ¼ and ¾ of the way down the string.  Spatially, this mode has twice the frequency of the fundamental mode, and in fact, this profile vibrates back and forth twice as fast as well – and so rings up an octave above the fundamental.  The next mode has two nodes and vibrates with three times the frequency of the fundamental.  Note however, that this is not twice the frequency of the previous node (but rather “half again”) and so we do not hear an octave above the previous tone, but rather a major fifth.  Snapshots of these modes are shown in the table below.

 E2 E3 B4 E4

How much of each harmonic you hear depends on how you pluck the string.  If you pluck it near the middle, you will hear a very pure sound without much influence from the harmonics.  If you strike it near an end, you will hear a much tinnier sound where the overtones are much more prominent.  The sound you hear is actually influenced by where and how you strike the string!

Now….

Suppose you bend a taut guitar string into exactly the shape of a graph y = f(x) that you are interested in.  When you release the string, what do you hear

It turns out that you can actually hear the Fourier coefficients as the volume of the harmonics of the vibrating string.

The function f(x) can be written as a superposition of the individual modes (the “basis functions” in mathematical terminology) – and when we release the string, each mode vibrates with its own frequency, and we can hear each of those individual vibrations as a separate pitch.  Also, because the frequencies of the harmonics are all integer multiples of the fundamental, in the absence of damping the string actually returns to exactly its original shape after one period (roughly 1/82nd of a second for the E2 string.)

The Take-Home Message.

So, in a math test, if you are asked to find the Fourier Sine series of a given function, you could find the coefficients one-by-one by computing integral-upon-integral.

Or… you could just get out your guitar, carefully shape the string, let it go and listen for the volume of the various harmonics!

Links.

• If you want to try fitting Fourier coefficients by hand, I’ve put together a spreadsheet here.  Just adjust the sliders to “tune” the coefficients for the first six basis functions.

http://www.usna.edu/Users/math/rkjackso/Java/Fourier_xlnx.xls

• There is also a nice java applet online for those who would like to listen to the shapes of various strings.  Just click the sound checkbox and choose “Mouse = Shape string” in the drop down box.

http://www.falstad.com/loadedstring/

Problem of The Week 187: Bernie’s Bank and Trust

April 20, 2009

After learning about compound interest, you decide to put \$10 in Uncle Bernie’s Bank and Trust and then have yourself cryogenically frozen for 10 million years – hoping to wake up rich!  Uncle Bernie’s Bank has two investment options:

• 1. The Stable Mattress Account: each year, this will return exactly what you put in.
• 2. The Silver Dollar Special: each year, the bank will flip a fair coin. If it comes up tails, you lose all the money in the account; but if it comes up heads, you triple the money in the account.

Initially, neither option appeals to you.  You certainly don’t want just 10 bucks at the end of 10 million years. But with the special, if the bank doesn’t flip heads 10 million straight times (and really, what are the chances?), you will end up with nothing

Fortunately, Uncle Bernie offers you the following arrangement.  Each year, on January 1, the bank will rebalance your accounts to your specifications: putting P% of your money in the Stable Mattress Account and the remainder, 100P%, in the Silver Dollar Special, for your choice of P.

What value of P should you pick to maximize the amount of money you have in the bank when you thaw in 10 million years?

Problem of the Week 186: Quite a Quadralateral

March 30, 2009

What is the area of the largest planar region that can be bounded by four sticks (line segments) of lengths 19, 59, 20 and 09?

You can overlap them however you like but, please, don’t break the sticks!

A Guide to Bungee Jumping

March 5, 2009

Setup:  Suppose a midshipman (6 feet tall, weighing 160 pounds) intends to jump off of a 206 foot high bridge.  He has his choice of bungee cords to tie to his feet – each is 100 feet long, but with varying degrees of stiffness.  How stiff a cord should he choose (what k value?) so that he just gets the crown of his head wet in the river below?

The physics: For a first run through, we will ignore air resistance.

The main difference between this problem and the typical spring problems we have tried is the behavior of the cord when the object (or midshipman) it is supporting is above the cord’s natural unweighted length.  A spring will, whether an object is above or below equilibrium, push or pull the object toward the equilibrium position.  A bungee cord, however, will simply go slack when the object it is holding is above the equilibrium position – it provides no push at all!  As such, we get a piecewise restoring force,

$r(x) = \left\{\begin{array}{ll} 0 & x<0 \\ -kx & x \ge 0\end{array}\right.$

where x is oriented downward, as usual, and x = 0 is 100 feet below the bridge (where the bungee cord is at its natural length).  See the figure below.

Figure 1: Coordinates for the bungee jumper (care of Zill and Cullen, 6th edition)

If the only forces on the bungee jumper are gravity and the restoring force of the bungee cord, then Newton’s Second Law of Motion can be written as the differential equation

$5x^{\prime\prime} = 160 + r(x)$.

Recall that a person weighing 160 pounds near the earth’s surface has a mass of 5 slugs.

Question 1:  How long is the midshipman in freefall?  That is, how many seconds pass before the jumper feels any force at all from the bungee cord around his ankles?

Response: In this regime, r(x) = 0, and so the differential equation reduces to about the simplest one can imagine

$x^{\prime\prime} = 32$.

Assuming the jumper gingerly steps off the bridge at time t = 0, we have initial conditions x(0) = -100 ft and x′(0) = 0 ft/s.  One could use annihilators, etc., and the full power of our differential equations course to solve this equation, or one could channel the inner calculus geek and quietly integrate twice to find

$x(t) = -100 + 16 t^2$.

x is equal to zero when t = 2.5 seconds.

Question 2:  How stiff should the cord be so that the jumper just dunks the crown of his head into the water?

Response:  After t = 2.5, the jumper feels the restoring force of the bungee cord, and the differential equation becomes

$x^{\prime\prime} = 32 - 0.2 kx$ ,

where k depends upon the particular bungee cord we choose.  Note that our initial conditions here come from the previous calculations:  x(2.5) = 0 and x′(2.5) = 80 ft/s.  This is a second order, nonhomogeneous equation, and now we can unapologetically find a solution using the method of undetermined coefficients (annihilators):

$x(t) = \frac{160}{k} - \frac{160}{k}\cos\left(\frac{\sqrt{k}}{\sqrt{5}}\left(t-2.5\right)\right)+\frac{80\sqrt{5}}{\sqrt{k}}\sin\left(\frac{\sqrt{k}}{\sqrt{5}}\left(t-2.5\right)\right)$.

Since our jumper is 6 feet tall, and the bridge is 206 feet tall, he will just dampen the top of his head when the bungee cord stretches to exactly 100 feet beyond its natural length.  In this case, we want the amplitude of the oscillation to be 100 – 160/k.   So we can set

$100 - \frac{160}{k} = \sqrt{\frac{160^2}{k^2} + \frac{5*80^2}{k}}$.

Squaring both sides, the k2-terms cancel and we are left with a linear equation in k.  Solving, we find that k = 6.4 pounds/foot.

Note that with no damping force, the bungee jumper continues to oscillate, alternately moistening his brow and then crashing back into the bottom of the bridge, indefinitely.  He follows a traditional parabolic path when x is less than 0 (and there is slack in the cord), and a sinusoidal path when x is greater than 0 (and the cord is taut).

Figure 2: The motion of the undamped bungee jumper.

Extra Credit:  Suppose the bungee jumper knows that the force of air resistance in his case is numerically equal to his instantaneous velocity.  Including the damping force of air resistance allows for the use of a less stiff (lower k) bungee cord.  (See Figure 3, below.)  Extend the analysis above to determine what k-value cord the jumper can use to once again just dampen the crown of his head?

Figure 3: The motion of the damped bungee jumper.

Problem of the Week 185: Public Key Cryptography

March 4, 2009

In a Public Key Cryptosystem, an individual publishes a public key (a modulus n and an exponent e) and keeps secret a private key (an exponent d).  The modulus $n$ is the product of two large primes, p and q.  You could crack this system if you could find p and q, but factoring large numbers is notoriously difficult.

For instance, my public key is (n=3599, e=7). It is safe because 3599 is such a large number that no one else can factor it.  If they could, they could then construct my private key d, since I simply chose d so that the product de has remainder 1 when divided by (p-1)(q-1).

Anyone can send me an encrypted message (that even they themselves can’t decrypt) in two easy steps using the public key.

1. You convert your message to numbers using a simple letter-number cipher: A=01, B=02,…, Z=26 (and a space is 00).  For instance “BZ” becomes “0226”. Since my modulus n is only 4 digits long, I can only handle two letters at a time.
2. Now compute the remainder left when you divide the number you wish to encrypt, 226, raised to the power of the public exponent, 7, by the public modulus, 3599.  My Voyage 200 calculator says that remain(226^7,3599) is 795 or “0795”.  This number is the encrypted message that you then send me!!

Then, only I (since I alone know the factors of 3599, and therefore the private key d) can decode the message.

1. I find the remainder left after raising your encoded 0795 to the power of my private exponent, d, and dividing by 3599.  Because d was chosen so cleverly (thanks, Fermat), this gives me back 226.  Padding with zeroes to get four digits yields “0226”.
2. Now I go to the letter-number cipher and see that you sent me “BZ”.  Thank you!

Here’s an encrypted message.  If you can crack it, maybe you should do what it says….

2718  3055  0478  1646  3551  0482  0775