(Translated by https://www.hiragana.jp/)
Pat'sBlog: binary
Showing posts with label binary. Show all posts
Showing posts with label binary. Show all posts

Saturday 15 January 2011

Math and Poetry

My beautiful wife Jeannie is a poet, so I like the idea that the connections between math and poetry goes back a long way. It might surprise you to know that :
1) The first use of binary numbers
2) The first recorded illustration of what we now call Pascal's Arithmetic Triangle
3) The Fibonacci sequence
All appeared first in a book on Sanskrit poetry around 2000 BC, Pingala's "Chandahsutra".

Poetry in Sanskrit, and it seems in some modern languages, poems are described by the pattern of long and short syllables. Very little is known about the author's life, and in fact it seems that anything that is stated in one ancient text is contradicted by another.
What we know about the work comes from an upgrade of the text created by a 10th century mathematician named Halayudha.

Describing short and long syllables seems a natural stimulus for binary notation. Instead of zero's and ones, Pingala used (or we suspect that he used) symbols for syllables which were Guru (heavy-given two beats) or Laghu (light-given one beat).

To illustrate that there could only be eight line patterns with three syllables he lists them: LLL, LLH, LHL, HLL, LHH, HLH, HHL, HHH.

I think there is still some doubt about whether Pingala actually made a diagram similar to the arithemtic triangle (which they called meruprastāra) or if that was added by Halayudha. In any event, it seems quite easy to see that for n= 2,3,4 etc syllables, and count the number of short syllables we get

1 1 short or long
1 2 1 short short, short long, long short, long long
1 3 3 1

and the triangle is born.

But if you decided to count the number of lines by length (remember heavy syllables last twice as long as light ones)..

There can only be one line of length one, it has a single light accent.
There is also only one line of length two, a single heavy accent.
But for length three you can get two different types, HL, LH, or LLL
And by now you expect that somehow there will be five patterns for length four. Sure enough LLLL, LLH, LHL, HLL, HH.... and we have the Fibonacci sequence.

It is easy to see that the number of patterns of length N, would be all the patterns of length n-2 followed by a heavy accent, plus all the patterns of length n-1 followed by a light accent. This is just the recursive definition of a Fibonacci sequence.

And in honor of the Woman I love, and the 4000 year association between the things we love, here is a poem she wrote years ago in Japan. It was inspired by a friend, Idell Tong, who was in charge of something planned around the school. When Jeannie asked her how it was going, she replied, "Well, you know my philosophy, If you have a spare minute, worry." That became this:


TIME WELL SPENT
The Walls of your world are crumbling.
Your wrinkled brow is beaded with sweat,
All the plans you made are disintegrating,
Got a minute? FRET!

When the boss's deadline is looming,
You know your rat is losing the race,
And your best is just not good enough.
Now's the time to PACE!

You're stuck in rush hour traffic,
Urging the taxi driver to hurry,
He gives you the glance of annoyance.
Just sit back, scowl, and WORRY!

The BIG event is scheduled,
Here you are with nothing to do,
All the presentations are perfect.
Don't rest on your laurels....STEW.

Wednesday 21 January 2009

Mental Binary to Octal and Another Clock Problem Solution




Two brief items of interest, both very different. In my last blog I wrote about the problem sent by my good friend from Japan, Al Harmon.

How long after 7:00 will the second hand bisect the angle formed by the other two hands?
I gave the first answer, time wise, bisecting the obtuse angle between the hands. Al reminded me that there was, of course, another bisecting time after the second hand passed the hour hand... and supplied his answer, which is below if you want to work the problem out yourself.

A second problem came up from a question asked at the Math Forum. I occasionally answer questions on the T2T (Teacher to Teacher) web site at the Math Forum and came across an interesting question the other day which asked me how to convert a binary number to base eight. As a brief example, convert the binary number 1010010111011 to base eight... wait... mentally, no calculator, no pencil and paper... start now!

The Clock Problem
Al sent me his answer of 47.9327 seconds after the hour. I worked it out this way.... (and fortunately got the same answer.)

With the hour hand to the second hand as one of the two congruent angles and the angle from the minute hand passed the 12 to the minute hand... the first angle would be simply the angle of the second hand minus the hour of the minute hand, or in terms of T seconds, 6T- (210+T/120). The angle from the second hand to the 12 position on the clock would be 360-6T degrees, and the minute hand would be another T/10 degrees beyond the 12 position where it had started. Adding these two gives the angle between minute and second to be 360 - 59T/10
When we set these equal to each other and simplify we have 360 - 59T/10 = 719T/120 - 210. Transposing the like terms we get 570 = 1427T/120 and multiplying by the reciprocal of the fractional coefficient I got T=47+ 1331/1427
seconds ... checking the angles... at 7:00,47.932726 the hour hand is at 210 +47.932726 /120 = 210.3994394 degrees. The second hand is at 6(47.932726 ) = 287.596356 degrees so the angle between them is 77.1969166 degrees. The minute hand has moved T/10 degrees so it is at 4.7932726 degrees positive from the 12 position, and the second hand is 360- 287.596356=72.403... adding the minute hand gives the same angle as the first to six digits, so I'm calling that a solution.

Convert a binary number to base eight, mentally.
I realized that this conversion was really easy and the same idea could be used for any conversion from one base to some base that was an integer power of it... I don't remember the actual probelm, but suppose it was 1010010111011 (typing semi randomly)... The trick is to simply divide it into periods of three (starting from the right) 1 010 010 111 011 . Now for each period or part of a period (like the first one) simply convert that three digits to base ten (which for numbers less than eight, and all three digit binary numbers must be, is also the value in base eight)... and replace directly... so
1 010 010 111 011 is replaced by
1 2 2 7 3 which is the base eight value for the same number. and of course you could go back from base eight to base two by just reversing the directions, replace each digit of the base eight number with a binary equal.

You could do hexadecimal by marking off periods of four digits in the same way...

If the task was to convert base 3 to base 9 you would just take groups of two digits
2012 in base three is (20 12 ) 20 in base three just means two times three, so we replace 20 with a six.. and 12 is a three with two ones, so we replace it with a five to get 65 (base nine) = 2012 base three...
If you are a little rusty in converting bases, here is the conversion of any base to base ten ...
the place values in base ten are 1, 10, 100, 1000, etc working from right to left... you should recognize these as powers of 10... ie 10^0, 10^1, 10^2, etc... for any other base it works the same way... for base two the place values are 1, 2, 4, 8, 16... and for base three it would be 1, 3, 9, 27, 81, .... Base eight used above would be 1, 8, 64, 512...

To find the decimal expression for a number in another base, just multiply each digit times its place value and add the products together. 2012 base three is 2(27)+0(9)+1(3)+2 = 59 ; so I should get the same thing if I check 65 in base nine... 6(9) + 5 = 59.... (one right in a row!!!)

To express 12273 base eight in base ten we do 1(8^4) + 2(8^3)+ 2(8^2) + 7(8)+ 3... a big number, and I leave it to you to check that that is equal to what you get if you convert the binary 1010010111011 to decimal.