Monday, October 10, 2016

Fast Fourier Series

1. Digital Audio

Pulse code modulation (PCM) is the most common type of digital audio recording, used to make compact disks and WAV files.
 
In PCM recording hardware, a microphone converts sound waves into a varying voltage. Then an analog-to-digital converter samples the voltage at regular intervals of time. For example, in a compact disc audio recording, there are 44100 samples taken every second.
The data that results from a PCM recording is a function of time. How does this work?
Imagine that you were very small and could fit into your friend's ear drum. Suppose also that you could see things in very slow motion and that you could record the position of the ear drum once every 44100th of a second. Your eyes are so good that you can notice 65536 distinct positions of the ear drum's surface as it moves back and forth in response to incoming sound waves.
f your friend is listening to the sound of a flute, and you write down the positions of the ear drum that you notice, then you would have a digital PCM recording - a series of numbers.
If you could later make your own ear drum move back and forth in accordance with the thousands of numbers you had written down, you would hear the flute exactly as it originally sounded. We have gone from:
rich sound with fundamentals and harmonics
→\displaystyle\rightarrow numbers
→\displaystyle\rightarrowrich sound with fundamentals and harmonics
To be able to convert from the series of numbers to sound, we need to apply the Fourier Transform.

2. Frequency Information as a Function of Time

Prisms

One analogy for the type of thing a Fourier Transform does is a prism which splits white light into a spectrum of colors.
White light consists of all visible frequencies (red, orange, yellow, green, blue, indigo and violet) mixed together (much like the information on a CD has sounds of all frequencies mixed together) and the prism breaks them apart so we can see the separate frequencies (much like the CD player splits apart the sound frequencies so they can be amplified and sent to the speakers).

White light is split into individual frequencies by a prism

Cochlea

In our inner ears, the cochlea enables us to hear subtle differences in the sounds coming to our ears. The cochlea consists of a spiral of tissue filled with liquid and thousands of tiny hairs which gradually get smaller from the outside of the spiral to the inside. Each hair is connected to a nerve which feeds into the auditory nerve bundle going to the brain. The longer hairs resonate with lower frequency sounds, and the shorter hairs with higher frequencies. Thus the cochlea serves to transform the air pressure signal experienced by the ear drum into frequency information which can be interpreted by the brain as tonality and texture.

The cochlea transforms sound waves into electrical signals.
The Fourier Transform is a mathematical technique for doing a similar thing - resolving any time-domain function into a frequency spectrum. The Fast Fourier Transform is a method for doing this process very efficiently.

3. The Fourier Transform


As we saw earlier in this chapter, the Fourier Transform is based on the discovery that it is possible to take any periodic function of time f(t) and resolve it into an equivalent infinite summation of sine waves and cosine waves with frequencies that start at 0 and increase in integer multiples of a base frequency f0=1T\displaystyle{{f}_{{0}}=}\frac{1}{{T}}f​0​​=​T​​1​​, where T is the period of f(t)\displaystyle f{{\left({t}\right)}}f(t). The resulting infinite series is called the Fourier Series:
f(t)=a02+∑n=1∞(an cosnt+bnsinnt)\displaystyle f{{\left({t}\right)}}=\frac{{a}_{{0}}}{{2}}+{\sum_{{{n}={1}}}^{\infty}}{\left({a}_{{n}}\ \cos{{n}}{t}+{b}_{{n}} \sin{{n}}{t}\right)}f(t)=​2​​a​0​​​​+​n=1​∑​∞​​(a​n​​ cosnt+b​n​​sinnt)
The job of a Fourier Transform is to figure out all the an and bn values to produce a Fourier Series, given the base frequency and the function f(t).
In our CD example, which has a sampling rate of 44100 samples/second, if the length of our recording is 1024 samples, then the amount of time represented by the recording is 102444100=0.02322\displaystyle\frac{1024}{{44100}}={0.02322}​44100​​1024​​=0.02322 seconds, so the base frequency f0 will be
1T=441001024=43.066 Hz\displaystyle\frac{1}{{T}}=\frac{44100}{{1024}}={43.066}\ \text{Hz}​T​​1​​=​1024​​44100​​=43.066 Hz.
If you process these 1024\displaystyle{1024}1024 samples with the FFT (Fast Fourier Transform), the output will be the sine and cosine coefficients an and bn for the frequencies
43.066 Hz\displaystyle{43}.{066}\ \text{Hz}43.066 Hz,
2×43.066=86.132 Hz\displaystyle{2}\times{43}.{066}={86}.{132}\ \text{Hz}2×43.066=86.132 Hz,
3×43.066=129.20 Hz\displaystyle{3}\times{43}.{066}={129}.{20}\ \text{Hz}3×43.066=129.20 Hz, etc.
Read More

Arc Length of a Curve - Metal Roof Sheet


Corrugated iron and aluminum alloy are used extensively throughout the world as a versatile building material. Bending the material into a regular wave pattern gives it greater strength than if a flat sheet is used.
Another example of a light, thin and weak sheet that is made much stronger by having regular folds is corrugated cardboard, used for protecting goods in transit.

To make corrugated iron, you need to bend a wide flat sheet into waves. The resulting corrugated sheet is then narrower, of course.
The corrugations are commonly in the form of a sine curve.

This panel has a finished width of 106.7 cm, a period of 10.67 cm (distance from the top of each wave to the top of the next), and has amplitude 1.35 cm (height from the mid-point of the wave to the top of a crest).
How wide should the flat sheet be to give us a corrugated sheet of width 106.7 cm?

We model the corrugations using the curve
y = 1.35 sin 0.589x
This has the required amplitude 1.35 and period 10.67.
(Within the sine expression, we use 2π/10.67 = 0.589 for the coefficient of x. 
 We'll find the width needed for one wave, then multiply by the number of waves.

Approximate answer: Next, let's approximate the length of the curve so we've got a rough idea what our exact length should be. (It's always good practice to estimate your answer first, and in this topic, it helps us understand the concept better).
We plot the points O (0, 0), A (2.65, 1.35), B (5.33, 0), C (7.99, -1.35) and D (10.65, 0), which are key points on the curve (at the mid-points, maximum and minimum values), and join the line segments.


We then use Pythagoras' Theorem to find the length OA:
OA=2.652+1.352=2.97\displaystyle{O}{A}=\sqrt{{{2.65}^{2}+{1.35}^{2}}}={2.97}OA=√​2.65​2​​+1.35​2​​​​​=2.97
The distances AB, BC, CD are all equal, so we can say:
OA + AB + BC + CD = 4 × 2.97 = 11.88
So we expect the curved distance OD to be around 12 cm.

 

 

 

 

 

Exact value

We'll use calculus to find the 'exact' value. But first, some background.
We zoom in near the center of the segment OA and we see the curve is almost straight.
For this portion, the curve EF is getting quite close to the straight line segment EF.

For this zoomed-in section, we have:

curved length EF =r≈∫ab12+0.572=1.15\displaystyle={r}\approx{\int_{{a}}^{{b}}}\sqrt{{{1}^{2}+{0.57}^{2}}}={1.15}

General Form of the Length of a Curve


If the horizontal distance is "dx" (or "a small change in x") and the vertical height of the triangle is "dy" (or "a small change in y") then the length of the curved arc "dr" is approximated as:
dr≈dx2+dy2\displaystyle{d}{r}\approx\sqrt{{{\left.{d}{x}\right.}^{2}+{\left.{d}{y}\right.}^{2}}}dr≈√​dx​2​​+dy​2​​​​​

Now, if we move point E very close to point F, we will have a very good approximation for the length of the curve in that local region.

We need to add all those infinitesimally small lengths. We use integration, as it represents the sum of such infinitely small distances. We have for the distance between where x=a\displaystyle{x}={a}x=a to x=b\displaystyle{x}={b}x=b:
length=r=∫ab(dx)2+(dy)2\displaystyle\text{length}={r}={\int_{{a}}^{{b}}}\sqrt{{{\left({\left.{d}{x}\right.}\right)}^{2}+{\left({\left.{d}{y}\right.}\right)}^{2}}}length=r=∫​a​b​​√​(dx)​2​​+(dy)​2​​​​​
By performing simple surd manipulation, we can express this in more familiar form as follows.
The arc length of the curve y = f(x) from x = a to x = b is given by:
length=r=∫ab1+(dydx)2dx\displaystyle\text{length}={r}={\int_{{a}}^{{b}}}\sqrt{{{1}+{\left(\frac{{{\left.{d}{y}\right.}}}{{{\left.{d}{x}\right.}}}\right)}^{2}}}{\left.{d}{x}\right.}length=r=∫​a​b​​√​1+(​dx​​dy​​)​2​​​​​dx
Of course, we are assuming the function y=f(x)\displaystyle{y}= f{{\left({x}\right)}}y=f(x) is continuous in the region x=a\displaystyle{x}={a}x=a to x=b\displaystyle{x}={b}x=b (otherwise, the formula won't work).
Read More

Volumes of Solid of Revolution - Watermelon ft. Archimedes,Newton and Leibniz



A watermelon has an ellipsoidal shape with major axis 28 cm and minor axis 25 cm. We have to Find its volume.
Historical Approach: Before calculus, one way of approximating the volume would be to slice the watermelon (say in 2 cm thick slices) and add up the volumes of each slice using V=πr2h\displaystyle{V}=\pi{r}^{2}{h}V=πr​2​​h.
Interestingly, Archimedes (the one who famously jumped out of his bath and ran down the street shouting "Eureka! I've got it") used this approach to find volumes of spheres around 200 BC. The technique was almost forgotten until the early 1700s when calculus was developed by Newton and Leibniz.
We see how to do the problem using both approaches.

Volume using historical method:


Because the melon is symmetrical, we can work out the volume of one half of the melon, and then double our answer.
The radii for the slices for one half of a particular watermelon are found from measurement to be:
0,6.4,8.7,\displaystyle{0},{6.4},{8.7},0,6.4,8.7, 10.3,11.3,\displaystyle{10.3},{11.3},10.3,11.3, 12.0,12.4,12.5.\displaystyle{12.0},{12.4},{12.5}.12.0,12.4,12.5.
The approximate volume for one half of the melon using slices 2 cm thick would be:
Vhalf=π×[6.42+8.72+10.32+11.32+12.02+12.42+12.52]×2\displaystyle\text{V}_{{\text{half}}}=\pi\times{\left[{6.4}^{2}+{8.7}^{2}+{10.3}^{2}+{11.3}^{2}+{12.0}^{2}+{12.4}^{2}+{12.5}^{2}\right]}\times{2}V​half​​=π×[6.4​2​​+8.7​2​​+10.3​2​​+11.3​2​​+12.0​2​​+12.4​2​​+12.5​2​​]×2
=π×8040.44×2\displaystyle=\pi\times{8040.44}\times{2}=π×8040.44×2
=5054.4\displaystyle={5054.4}=5054.4
So the volume for the whole watermelon is about
5054.4×2=10109 cm3=10.1 L\displaystyle{5054.4}\times{2}={10109}\ \text{cm}^{3}={10.1}\ \text{L}5054.4×2=10109 cm​3​​=10.1 L.
In the following section, we see how to find the "exact" value using the volume of solid of revolution formula.

 "Exact" Volume (using Integration):

We are told the melon is an ellipsoid. We need to find the equation of the cross-sectional ellipse with major axis 28 cm and minor axis 25 cm.
We use the formula (from the section on ellipses):
x2a2+y2b2=1\displaystyle\frac{{{x}^{2}}}{{{a}^{2}}}+\frac{{{y}^{2}}}{{{b}^{2}}}={1}​a​2​​​​x​2​​​​+​b​2​​​​y​2​​​​=1
where a is half the length of the major axis and b is half the length of the minor axis.
For the volume formula, we will need the expression for y2 and it is easier to solve for this now (before substituting our a and b).
x2a2+y2b2=1\displaystyle\frac{{{x}^{2}}}{{{a}^{2}}}+\frac{{{y}^{2}}}{{{b}^{2}}}={1}​a​2​​​​x​2​​​​+​b​2​​​​y​2​​​​=1
b2x2+a2y2=a2b2\displaystyle{b}^{2}{x}^{2}+{a}^{2}{y}^{2}={a}^{2}{b}^{2}b​2​​x​2​​+a​2​​y​2​​=a​2​​b​2​​
a2y2=a2b2−b2x2=b2(a2−x2)\displaystyle{a}^{2}{y}^{2}={a}^{2}{b}^{2}-{b}^{2}{x}^{2}={b}^{2}{\left({a}^{2}-{x}^{2}\right)}a​2​​y​2​​=a​2​​b​2​​−b​2​​x​2​​=b​2​​(a​2​​−x​2​​)
y2=b2a2(a2−x2)\displaystyle{y}^{2}=\frac{{{b}^{2}}}{{{a}^{2}}}{\left({a}^{2}-{x}^{2}\right)}y​2​​=​a​2​​​​b​2​​​​(a​2​​−x​2​​)
Since a=14\displaystyle{a}={14}a=14 and b=12.5\displaystyle{b}={12.5}b=12.5, we have:
y2=12.52142(142−x2)\displaystyle{y}^{2}=\frac{{{12.5}^{2}}}{{{14}^{2}}}{\left({14}^{2}-{x}^{2}\right)}y​2​​=​14​2​​​​12.5​2​​​​(14​2​​−x​2​​)
=0.797(196−x2)\displaystyle={0.797}{\left({196}-{x}^{2}\right)}=0.797(196−x​2​​)
NOTE: The a and b that we are using for the ellipse formula are not the same a and b we use in the integration step. They are completely different parts of the problem.
Using this, we can now find the volume using integration. (Once again we find the volume for half and then double it at the end).
Vhalf=π∫014y2dx\displaystyle\text{V}_{{\text{half}}}=\pi{\int_{{0}}^{{14}}}{y}^{2}{\left.{d}{x}\right.}V​half​​=π∫​0​14​​y​2​​dx
=π∫0140.797(196−x2)dx\displaystyle=\pi{\int_{{0}}^{{14}}}{0.797}{\left({196}-{x}^{2}\right)}{\left.{d}{x}\right.}=π∫​0​14​​0.797(196−x​2​​)dx
=0.797π∫014(196−x2)dx\displaystyle={0.797}\pi{\int_{{0}}^{{14}}}{\left({196}-{x}^{2}\right)}{\left.{d}{x}\right.}=0.797π∫​0​14​​(196−x​2​​)dx
=2.504[196x−x33]014\displaystyle={2.504}{{\left[{196}{x}-\frac{{{x}^{3}}}{{{3}}}\right]}_{{0}}^{{14}}}=2.504[196x−​3​​x​3​​​​]​0​14​​
=2.504[196(14)−1433]\displaystyle={2.504}{\left[{196}{\left({14}\right)}-\frac{{{14}^{3}}}{{{3}}}\right]}=2.504[196(14)−​3​​14​3​​​​]
=2.504×1829.33\displaystyle={2.504}\times{1829.33}=2.504×1829.33
=4580.65 cm3\displaystyle={4580.65}\ \text{cm}^{3}=4580.65 cm​3​​
So the watermelon's total volume is 2×4580.65=9161 cm3\displaystyle{2}\times{4580.65}={9161}\ \text{cm}^{3}2×4580.65=9161 cm​3​​ or 9.161 L\displaystyle{9.161}\ \text{L}9.161 L. This is about the same as what we got by slicing the watermelon and adding the volume of the slices.
Read More