Tuesday, January 31, 2012

Thick Lenses

The simplified model found for thin lenses can be generalized for thick lenses. In this case the each focal point has its own lens plane associated with it. Its location along the optical axis is where the focal rays meet with their parallel rays. These two planes are known as the principal planes of the lens. The rays from a point source that preserve the angle of transmission through the lens cross the optical axis at two "nodal" points. So a thick lens has six cardinal points associated with it that includes two sets of focal, principal and nodal points.

For further reading on lenses and optical systems one can look at these references,

Jurgen R. Meyer-Arendt, Introduction to Classical and Modern Optics, 4th ed., 1995, p. 50

Miles V. Klein, Optics, 1970, p. 80

Grant R. Fowles, Introduction to Modern Optics, 2nd ed., 1975, p.297

Monday, January 30, 2012

The Simple Lens 2

Using the same rules for rays passing through the focal points one can derive similar results for a diverging lens. A parallel ray from the tip of the object will appear to diverge from the focal point on the left. A ray headed towards the the focal point on the right will end up traveling parallel to the optical axis. Again there are two pair of similar triangles which are associated with the focal points. Assuming o and h are initially known we get two equations for the unknowns i and y from the proportions for the triangles.

Solving for y and equating the two expressions gives another thin lens formula which is the same as the one for the converging lens if we negate the values for i and f. Again multiplying the thin lens formula by i give an expression for i/f which can be used to simplify the formula for y.

Although the position of the image has changed the magnification is again m = i/o which tells up that a line drawn through the tips of both the object and the image will pass through the center of the lens.

The Simple Lens

Knowledge of the action of a simple lens helps us to understand how optical instruments work. We start with the definition of the focal length, f, which is the distance along the optical axis from the plane of a converging lens to the point where rays initially parallel to the axis meet. The path that the light takes is reversable so a ray passing through the focal point will end up traveling parallel to the optical axis. To determine how the lens will produce an image of an object we draw an arrow of height, h, on the diagram a distance, o, to the left of the lens plane. Using the rules for the rays passing through the two focal points we find that they meet at a point which is a distance, i, from the lens plane and a distance, y, below it.

Given that o and h are known we can solve for i and y. On both sides of the lens the two pair of triangles formed by the rays passing through the focal points are similar so their sides are proportional. Using these triangles we get two equations involving the two unknowns, i and y. Solving each for y and equating the results gives an expression which reduces to the thin lens formula, 1/i + 1/o = 1/f. We can use this formula to find i/f in order to simplify the first expression for y. The result tells us that the two ratios i/o and y/h are equal. These ratios give the quantity, m, by which the object is magnified to produce the image. The quantity, m, is referred to as the magnification.

These ratios also tell us that a ray passing through the optical axis at the plane of the lens will not be deflected so a ray from the tip of the object passing through center of the lens will also pass through the tip of the image. This fact was used to measure the altitude of the Sun at the Summer Solstice while using a single object lens from a small telescope.

How to Observe an Eclipse Safely

The are a number of links with advice on how to safely observe an eclipse. The cardinal rule is NEVER look at the Sun directly without protection against harmful UV rays. Check out these websites,

The Exploratorium

Stanford Solar Center

NASA Eclipse website

esa.org pdf

Hermit Eclipse

Sky & Telescope

For the more advanced amateur astronomer there is the book, How to Observe the Sun Safely by Lee Macdonald. It's also available in a kindle edition.

Sunday, January 29, 2012

Annular Solar Eclipse May 20-21, 2012

There will be an annular solar eclipse visible from the western United States on May 20, 2012 at about 06:30 pm PDT (May 20, 01:30 UT). (Check nasa.gov for more details.)


The centerline will sweep across Northern California, Nevada, Utah, Arizona, New Mexico and parts of Texas.

Projection & Barrel Transformations Animation

I used gifpal to do an animation of the image transformations.

The intended 1 second delay between images wasn't saved.

Thursday, January 26, 2012

Correcting Perspective Distortions

NIO, my camera assistant, was a little upset when he heard about Kodak's problems last week and wanted to help out if he could. We agreed that a blog on how the "music intervals image" was corrected might help some.

I captured the original image by just holding the camera over the book that it was in and the distortion is quite obvious. There are a number of contributing factors such as the relative position of the camera and the distortion produced by the telephoto lens.

I used the quadratic transformation method previously used for the determination of the coordinates of the Sun's image on graph paper at the time of the Summer Solstice to correct for some of the image's distortion. To find the needed transformation I obtained the pixel positions, X, of the line intersections from the original image. The positions of these intersections in the book were measured to the nearest millimeter and rescaled, X', to better match the image positions. Note that the first point which was the upper left intersection was arbitrarily chosen to coincide with that in the original image.

The transformation doesn't give interger positions which are needed for the corrected image so the 2D interpolation method was used to obtain a pixel value for the corrected image using the nearest know pixels in the original image. This was the first image posted in the blog.

As you can see there was still some barrel distortion present. I found that pre-distorting the corrected image positions before transforming to the position needed to interpolate the pixel value did a good job in straightening out the image. The distortion factor turned out to be 3%.

The result of both transformations is the image below and is the correction posted.

The 2D interpolation does a good job of preserving lettering without adding gaps that might be caused by stretching the image to fit the new pixel grid. One can see the images at full resolution by clicking on them. Also, the effects of the two-step transformation process can be better seen by rapidly switching between consecutive images in an image viewer. The first transformation appears to reposition the image and the second straightens out the lines.

Why are two transformations needed? It could be that the first gives a better fit for the center while the second works better on the edges. The second correction is nonlinear while the first involves only linear coefficients.

I don't know if you can do this in Photoshop but the process does give more useful images.

Supplemental (Jan 29): You can do perspective cropping and lens distortion corrections with Photoshop.

Friday, January 20, 2012

Review and Analysis

The first attempt to find the formula for the sum of two sine waves of different frequencies produced an erroneous result but we were able to determine that the amplitude was a function of half the difference in frequencies and the effective frequency of the combination was the average to the two original frequencies. Using a formula from trigonometry we were able to get an exact solution for the case where the original amplitudes were equal. Finally we were able to express the sum of the two frequencies as the product of the two cosine functions and a remainder for one of the frequencies.

The original attempt shows that although a false assumption usually gives erroneous results it can in some cases yield a useful approximation. And we found that we can check to see if two mathematical expressions are equal to one another by evaluating them over a set of values.

The formula that was found is quite useful in explaning the beats that result when two nearby tones are combined. Besides its use for sound the formula also has practical application in electronics where it is used for such things as modulating radio frequencies, converting one frequency to another and detecting radio frequencies. Light is another example where two waves can interfere with each other. And the wave functions associated with moving particles in quantum mechanics exhibit interference phenomena which is analogous to the beating of two waves.

For a discussion on the vector addition of sine waves see A Course in Electrical Engineering (1922) by Chester Laurens Dawes, p. 19.

Tuesday, January 17, 2012

The List of Intervals

I found a list of the intervals of the just scale in an old popular science book that I read as a child. It's part of my early experience with music and I had forgotten about it.

The table is from the article, Musical Sounds, and is found on p. 215 of The Book of Popular Science, Vol. 5 (1958) by The Grolier Society.

Edit (Jan 18): Corrected image a little more for distortion.

Saturday, January 14, 2012

Phobos-Grunt Reentry on Sunday

It's heads up this Sunday. Phobos-Grunt is less than 24 hours away from reentering the Earth's atmosphere according to RIA the Russian news agency. The track for the possible debris impact zone is slowly narrowing as the time of reentry approaches. A recent post by @riascience on Twitter is,

"New #Roscosmos prediction for #PhobosGrunt decay date/time: Jan 15 14.36 UTC - 22.24 UTC"

The actual time of reentry is dependent on changing conditions in the upper atmosphere. One can get updates on the spacecraft descent and reentry at the following sites.

Spaceflight 101 Phobos-Grunt


Orbit Ops

The images at Orbit Ops Photos give updates on the spacecraft's altitude. The density of the atmosphere starts to rapidly increase as one descends down to about 80-90 km and the atmospheric drag then becomes significant. @riascience has been posting images of the location of the possible debris field along the spacecraft's track.

The website Zarya which covers Russian spaceflight and is maintained by a fellow of the British Interplanetary Society has been following recent predictions of the reentry time. One can see the uncertainties for the time is decreasing.

Thursday, January 12, 2012

Mixing Two Tones (Take 3)

Instead of using ω0 as the reference frequency for the superposition one can use ϖ = ½(ω0 + ω) and derive a new expression for the sum. The computing both expressions over a number of beats one finds that there difference is zero.

So the epicycles were the result of using ω0 as the reference frequency which resulted in a steady increase of phase φ = ½Δωt.

In general one can simplify the above result a little more.

There is a steady tone at the reference frequency ω0 and one at the average of the two frequencies ϖ which is the one that fluctuates in amplitude. When a and b are equal the steady tone is not present and one just hears the warbling tone. The second term shifts in phase and amplitude relative to the first. That's the "epicycle".

Try listening to the shorter intervals such as the tone or semitone in the Wikipedia particular number article. There's a bit of a quaver present. One could also try simultaneously playing two neighboring keys on a piano or notes on a guitar.

Mixing Two Tones (Take 2)

The previous solution for mixing two tones was only an approximation. Using a result from trigonometry one can show that the sum of two cosine functions of equal magnitude is proportional to the produce of the cosines of half the sum and half the difference of the two original frequencies.

The beats correspond to the peaks of the absolute value of the amplitude function. The frequency of the oscillations is average of the reference frequency ω0 and the second frequency ω. The result is closer to what one would expect.

Allowing negative values for the amplitude results in a second oval in the phase diagram which is the mirror image of the one for positive amplitudes.

The previous solution appears to be missing a small term of the same frequency of the single cosine function since the amplitude is repeatedly distorted. The error results from assuming that the solution only affects the amplitude and phase of a cosine function. When the coefficients of a sine and a cosine function are constants one can easily calculate the phase. Apparently this doesn't work properly when the coefficients are also function of time.

Tuesday, January 10, 2012

Mixing Two Tones

What happens when two simple tones occur simultaneously? To find out we can start with a reference tone, f0, and add a second tone, f1 = f0 + Δf, of a slightly higher frequency. The corresponding angular frequencies are ω0 = 2πf0 and ω1 = 2πf1 = ω0 + Δω. When two cosine functions are added the result is a sum of a cosine term and a sine term which are functions of ω0 and amplitude factors A and B that are functions of Δω. These can be combined into a single wave of varying amplitude and phase, A' and φ respectively.

The second representation of the combined wave can also be split up into cosine and sine terms and the two sets of amplitudes can be used to solve for A' and φ.

To simplify the calculation of A' and φ we can write down formulas for A2 + B2 and AB.

Using the results of the derivation we can compute the result when two pitches of tones C and D of the same amplitude are combined and plot the result. The amplitude of the resulting wave is also a sinusoidal function.

The amplitude, A', is affected by the fluctuating phase but is a periodic function of the time. The period is inversely proportional to the difference of frequencies. As one decreases the interval between the two tones they will "beat" more slowly. So C and D beating together will be more easily discernable than C and E.

When the two original cosine terms are of the same amplitude the change in phase is a nearly linear function of time.

Doing a polar plot of the amplitude, A', versus phase, φ, results in a circular motion that repeats itself with the same period as the amplitude. If the amplitude of the reference wave is increased relative to that of the second the oval will move farther out from the center. The size and shape of the oval does not change with changes in the relative frequencies of the two initial waves change but it is affected by changes in the relative amplitudes. When the oval moves farther from the center the swings in phase are reduced as a result.

So we see that Harmonics has its own version of epicycles.

Supplemental (Jan 11): The difference in frequencies just "rescales" time for the amplitude function A' and phase function φ.

Monday, January 9, 2012

Using Sexagesimals for subdivision of the octave

The first subdivison of the octave works out quite nicely by using sexagesimals. The value of the √2 = 1;25 to the first sexagesimal place or 1 5/12. Going 1/12 to either side of it gives 4/3 and 3/2 whose product is 2.

The ratios are 1, 4/3, 3/2, 2 which fit the proportion 6:8:9:12. Early music theory contains the subdivision of the octave into forths and fifths. Aristoxenus who is a revisionist of the Pythagorean theory discribes some rather complicated subdivisions of the octave with fractions of a tone. The lyre, an early stringed instrument, was known in ancient Mesopotamia and early music theory was most likely passed on by tradition.

Supplemental: √2 was known to 3 sexagesimal places in ancient Babylon. Theon of Alexandria published a method for extracting square roots arithmetically. Nicomachus, a Pythagorean, wrote a Manual on Harmonics and an Introduction to Arithmatic which contained a study of superparticular numbers. Two other ancient string instruments are the pandura and the monochord.

Friday, January 6, 2012

Missing Intervals?

I tried inverting the ranking function to get an estimate of the missing items on the hypothetical list. The estimates turn out to be about 13/12 for the "second" and 1 for the "first".

Checking the intervals a, b and c found for the subdivision of the octave one finds that the first two are seconds and the third squeeks in as a first according to the empirical ranking function. Following the same system of nomenclature used for the other intervals the smaller second is a minor and the larger one a major. Adding these items to the hypothetical list appears to complete it.

The constant is somewhat arbitrary in the ranking function some other value may work better. What seems to be clear is that ranking proceeds from smaller intervals to larger ones.

Supplemental (Jan 7): The ranking mechanism is really important. A simple one would be to rank the intervals by size using decimal or hexagesimal division of the ratios. Two digit accuracy is enough to get the correct ranking. The tone and semitone have separate names and aren't really missing.

Supplemental (Jan 9): The list of intervals is the correct one for the just diatonic scale.

Ranking Intervals

I've been going through Rayleigh's The Theory of Sound and have been trying to make sense of the intervals refered as thirds, fourths, fifths, etc. and tried ranking them logrithmicly which gives the correct order for them in a list. Trial and error led to a ranking function which seems to correlate well with the numbers,

rank(r) = 7·[log2(9/8) + log2(r)]

This is just an empirical formula that works for the intervals listed. The 9/8th term suggests that the ranking is shifted by a tone and the factor 7 suggests 7 steps to an octave. Using 8 steps and no offset doesn't work for the thirds. I have to admit that I am not well informed on the history of the nomenclature of these intervals.

Tuesday, January 3, 2012

Comparison of Ptolemy and Helmholtz Ratios

For a better comparison of the steps in frequency with each other one can plot the log of the relative frequency, logf, versus the number of a note. The formula for logf used to compare the steps in relative frequency is,

logf = 12·log2(f/f0)

Ptolemy's ratios seem to alternate above and below the equitempered line a bit better and may be better balanced but the ear is the ultimate judge. One also needs to take into consideration the sound of the chords.

Supplemental (Jan 5): Note that the intervals of the scales are determined by the lower C of the scale and only A is affected by switching from Ptolemy's ratios to Helmholtz's. If A is fixed at A = 440 Hz for both scales then only A would be unchanged by switching scales and all the other notes would end up being out of tune. One can see how the standard for A causes problems for the older scales and music based on them. It becomes a nuisance. I'd rather not get into an involved discussion of world standards and regimentation at this time but I do think that musicians, and others in addition, should be granted more latitude. Unnecessary constraints run contrary to liberty and tend to be repressive. We should value those who reduce the level of chaos over those who would add to it or redistribute it.

The C Major Scale in Terms of Harmonics

What would be the best musical scale? That's a difficult question. For the equitempered scale all the steps are of equal size but the ratios of the frequencies and therefore the harmonics are slightly off. The image below shows a plot of the harmonic versus the number of a note. The scale is based on A440. From the harmonics one can see that some notes were missing from Helmholtz's sequence of ratios. When these harmonics are included we get the sharps and flats that are found on a piano keyboard. The dotted line shows the equitempered scale. The points are the location of the notes when we round to the nearest harmonic. Note the familiar pattern of tones and semitones on this scale.

To the right of the plot are the frequencies, f, that Helmholtz gives for the notes and their equitempered equivalents f'. Below f' are the corresponding harmonic values h'. Rounding these to the nearest integer we get the set of harmonic numbers, h''', that we found previously. One sees that Helmholtz's scale is a fairly good approximation to the equitempered scale and it may be the best that one can do with a set of simple ratios. Note that the missing harmonics would also give good values for the frequencies of the flats and sharps on this scale.

The good fit indicates that the sequence of factors involving the steps a, b and c in Helmholtz's sequence of ratios is probably better than that of Ptolemy's.

Subdivision of the Octave

How did we arrive at at a music scale with seven notes in an octave? The process seems to have been more Art than Science. The Pythagoreans new that the octave couldn't easily be bisected into two equal proportional steps. The reason for this is that for step, x, two steps would equal an octave and we would have x2 = 2 or x = √2 = 1.414... For the octave between C256 and C512 the midpoint would be at a frequency of 362.039... Hz. Looking at the plot below one sees that 4/3 is a reasonably good approximation for √2 but slightly smaller. Following this reasoning we arrive at the concept of the tetrachord.

For the tetrachord the step is x = 4/3 and two steps would be x2 = 16/9. The missing factor need to complete the octave which doubles the frequency of the initial note is a = 2*9/16 = 9/8. So we see that the octave can be split up into two tetrachords and a "tone" of 9/8. If we now try to subdivide the tetrachords using the tone as our "unit" we find that it does not subdivide the tetrachord evenly. One division leaves a remaining factor of 32/27 which is approximately evenly divided by 12/11.

So we can try to divide the tetrachord into two approximately equal steps b and c which will be in the neighborhood of 12/11. Examining the factors of 32/27 we see that it can be divided into b = n/9 and c = 32/3n.

Solving for n we find that it is approximately equal to 10 which gives b = 10/9 and c = 16/15. The product abc = 4/3, the step corresponding to the tetrachord. The order of the factors in a tetrachord does not affect the total step so a number of possibilities are possible.

Looking closely we see that one of Ptolemy's scales is similar but not quite the same as Helmholtz's.

Using the correct arrangement of factors we arrive at Helmholtz's sequence of ratios.

One can check Wikipedia for more information about the mathematician John Wallis.