I. Simple Vibrations

Introduction to Sine Waves and Simple Harmonic Motion

Sine waves (and cosine waves) describe Simple Harmonic Motion (SHM)  Simple Harmonic Motion is the most basic form of vibration that we observe in Physics.  The sine wave is a record of how the motion of a Simple Harmonic Oscillator (SHO) unfolds in time.  The vibration of a mass hung from a spring,  the back and forth motion of a simple pendulum, the motion of the end of one tine of a tuning fork are all examples of SHM.  This particular motion arises when the force that tends to restore the mechanical system to equilibrium is proportional to the displacement of the system from its equilibrium point.

Understanding the description of this kind of motion is the beginning step in understanding the more complex vibrations found in the various musical instruments we will study.

Instructions:  This Notebook is a tutorial in using various parts of Mathematica.  You should work through the examples in this notebook and then download the accompanying Mathematica notebook that contains a set of Homework exercises that you should complete and submit as homework.  You don't need to submit this notebook, but you do need to submit the accompanying one.

Sounds which are "musical" are based on a kind of waveform called a sine or cosine wave.  These waves are patterned by the mathematical function, Sine (or Cosine.)  A pure musical tone is a sine wave of a single frequency.  Physically, this kind of tone is caused by the vibration of a Simple Harmonic Oscillator. In Mathematica, a pure tone can be described by one of the mathematical expressions below:
	
				x = ASin[2π f t + ϕ]     or  x = ACos[2π f t + ϕ]
	
These expressions evaluate the displacement, x of the wave at some time, t, or, alternatively, describe the displacement of a Simple Harmonic Oscillator at time t.  Let's look at each of the pieces of the two expressions above to see how to make sense of these expressions and learn the meaning of the parameters, A, f, and t.  
		
	x:  x is the displacement at a particular value of t
	
	A:  'A' is number that is the Amplitude of the vibration

	Sin[ ] or Cos[ ]:  These are mathematical functions that evaluate to a number when given a number.

	f: The parameter 'f ' is a number that is the frequency of the wave.  The frequency is the number of times the vibration repeats itself every second

	(Note:  Frequency is related to the period (P) of the wave.  The period is the time required for one cycle of the vibration.  P=1/f)
	
	 t: t is the time of interest

	2π:  This number appears in the expression so that the number f really is the frequency as defined above
	
	ϕ:  ϕ is the initial phase angle.  It indicates the phase of the oscillation cycle that exists when the timing clock is started.

Evaluating Sines and  Cosines:

If you want to evaluate Sin[ ] or Cos[ ], just put a number inside the [ ] and push ⇧-⏎ to evaluate the expression.

To type the character, π, into your notebook,you have two options.You can select the π from the BasicInput or BasicTypesetting palette (you can find these under File->Palettes in the menu) or you can type EscpiEsc (you know when you've pushed an Esc because the character, , will appear when you do)

Here are a couple of examples

Sin[π/4]

Evaluate this one yourself  (Select the Cell bracket on the right and push ⇧-⏎)

Sin[π/3]

Experiment with your own values in the two cells below. (Put a number in the square brackets and  push ⇧-⏎)

Cos[ ]

Sin[ ]

B: Examples:  Plotting the Graphs of Vibrations

Introduction to the Plot function

Here are the rules for Plotting a graph of a function in Mathematica:

	Plot[function[t], {t, start, end}]
	
The best way is to learn by example.  Here is a graph of a Sin function with an amplitude of 10 and a frequency of 100 cycles per second as indicated by "10 Sin[2π 100 t]".  the variable is t, which runs from a starting value of 0 to an ending value of .02, as indicated by the "{t, 0, .02}" part.  Note that the place of the square brackets, the curly braces and the comma are important syntax rules to enable Mathematica to do the right thing!

I've named the first plot "sin0"  by the sin0= ... expression below.  This way, I can refer to each graph easily at a later time.

sin0 = Plot[10 Sin[2  π 100 t], {t, 0,  .02}]

Varying the amplitude

Here's another plot.  It's the same as the one below except that the amplitude is now half as much as before

sin1 = Plot[5 Sin[2  π 100 t], {t,  0,   .02}]

It's not obvious from looking at the two previous graphs that the amplitude of each wave is any different, because the vertical scale has been chosen by Mathematica in each case to fit the whole graph nicely into a box.

If we want to set the vertical scale ourselves we need to use the option PlotRange->{lower, upper} when we make our graph. Here's an example.

Show[sin1]

Here's the same thing with PlotRange specified.

Show [sin1,  PlotRange -> {-10, 10}]

You can also show all the graphs on the same set of Axes using the Show Command.  Mathematica will pick a PlotRange so that everything fits inside.  Here's an example.

Show[sin0,  sin1]

Varying the Frequency

What happens to the waveform if you double the frequency?  Evaluate the next cell to find out. How does the period change when frequency is doubled?

sin2 = Plot[10 Sin[2  π 200 t], {t, 0,  .02}]

Show[sin0,  sin2]

Varying the Phase

What happens to the waveform if you change the Phase?  Evaluate the next cell to find out.

sin3 = 
      Plot[10 Sin[2  π 100 t +  (π/4)], {t, 0,  .02}]

Show[sin0,  sin3]

C: Example:  Playing the Sounds of Vibrations

In order for this part to work, you need to have the computer's speakers turned on.  For best results, use headphones.

Introduction to the Play function

The Play function has the same syntax as the Plot function in Mathematica.  It allows you to hear what a waveform sounds like. The general usage of play is:
	
	Play[function[t],{t,start,end}]
	
When you issue this command, Mathematica plays the function from start to end.  The time is measured in seconds

Evaluate the next cell to hear the sound of a 880 Hertz tone for 2 seconds [Select the input cell and push ⇧-⏎ ]

Play[10 Sin[2  π 880 t], {t, 0, 2}]

You don't have to evaluate the Play command every time you want to hear the sound.  To repeat the sound, double click the little box with the "x" in it with your mouse and you should hear the sound

Try to plot and play some pure tones at different frequencies to see how they look and sound, and to practice using the Mathematica  Plot and Play commands