Monday, May 24, 2021

Number 1

Number 1

I had other topics pending that I expected to talk about before this, and also earlier. But these months my new job got my attention away from the blog. I may comment on this in a future post -or not.

So, what brought me back? Well a problem that I've pondering over since about 4 years ago when teaching Computer Science at a High School level (Grades 9 to 12). The problem shows up in CS very early: What does repeatedly right-shifting a binary number represent? In essence, the (integer) logarithm in base 2, yes. But, division is a concept well controlled by any grade 9 student. Why not then introduce the logarithm already then?

We would need to 1) show how the laws of (integer) logarithms can be justified from repeated division, 2) show how can we calculate the general logarithm by only using integer logarithms, and, finally, 3) show the geometric description of the logarithm. These days I realized how 2) looks like. Hence this post.

Initially, I thought it could be more or less straightforward to derive the usual properties of the logarithm from those of the integer logarithm. Also, the idea of visualizing the logarithm and exponentiation as paths towards/away from 1 was appealing. After trying building the logarithm from its integer version, that seems now misguided. It is straightforward to introduce and justify (almost) all of the properties using the integer logarithm for powers of the same base. But in general that won't work: ilog25=2,ilog35=1,ilog23=1 and clearly ilog25ilog35ilog23. However, the visualization as paths is straightforward.

I already wrote some time ago a few posts on the topic elsewhere. As I said back then, I like the number 1. It seems a dull choice and many may go for other more mysterious numbers like 4, 8 or 24. But there are some key elementary concepts that hinge on 1.

One of these concepts is the basic operations of multiplication and of division. Another (related) pair of concepts are the Logarithm and Exponentiation. The basic idea may be stated as what are the “paths” that lead to 1.

Geometry of Division and multiplication

Let's first view this last statement graphically.

Fig.1 Geometric construction of Multiplication and Division

 

 Point U defines the unit of measure on axis Px, while U is its counterpart on axis Py. Then multiplying A times C yields point AxC, while the quotient B/C is given by  the point BoC. It is implicitly understood that all measures are in units of OU.

Hence, for 0<a<1,b>c>1, both, repeated multiplication of a times c, as well as repeated division of b by c can each be seen as a path towards 1.

The same construction rules show, that limnan=0,limncn=. Thus exponentiation corresponds to paths that go away from 1. What operation do the paths of repeated divisions/multiplications without crossing 1 correspond to ?

 

Note: This geometric construction of multiplication and division is valid in a projective space. Indeed, while the previous figure seems to show the constructions paths parallel (in an Euclidean sense) to either UU or CU, the whole construction has been made as a projective construction with the line of infinity far enough.



The Logarithm

The paths following repeated multiplication or divisions without crossing the unit lead to what we call the logarithm. Already from a geometric point of view, the logarithm seems "opposed/inverse" to exponentiation. 

The Integer Logarithm ilog

How many times can we divide b by c without crossing the unit U? or How many times does the "division-path" bounces off the Py axis? Ans: ilogcb

How many times can we multiply a times c without crossing the unit U? or How many times does the "multiplication-path" bounces off the Py axis? Ans: ilogca

We will convene that when talking about multiplication paths, we will give the answer a negative sign. Hence, for the values of Fig.1, ilogca=1 while ilogcb=2: dividing the BoCC further by c would lead to a values smaller than the unit.

General Properties of the Integer Logarithm

From the definition the following properties follow:

0.- ilogca<0 when c>1,a<1

1.- ilogc1=0  If we divide/multiply the unit by c, we immediately move away from it. So, no paths available.

2.- ilog1a is undefined as we can both, multiply or divide a by 1 infinitely many times giving thus both and . In PR we could evtl say it's the point at infinity.

3.- If c<0 or a<0 then ilogba is undefined. It's either impossible to lead a path towards 1 (when a<0<b) or totally meaningless (b<0).

The following are not clear-cut derivable from the definition, but seem quite plausible:

4.- ilogbmn=ilogbm+ilogbn. Let's see why: Be k=nm,i=iLogbn,j=ilogbm, all integers. For simplicity sake, we’ll assume that the logarithms are exact. ilogbk corresponds to dividing the rectangle area by b. The side n can be cut by b i times. That still leaves a rectangle of area m. This can be divided by b j times before the resulting area gets below 1. Hence the original area can be divided i+j times by b. qed.

5.- ilogba=1/ilogab

bla, bla, bla (I'll come back to this later. Right now, just wanted to get all this off my head)

Calculating the Logarithm using only Integer logarithms

Let's first state the result:

Be a,bR+,1<b<a, then
logba=l0+1l2+1l4+1l6+1
Where l0ilogba is the integer logarithm of a in base b and l2i are all integer logarithms as well.

We will now clarify and justify this expression as a continuous fraction.

Be b0b and b1a. Then
bi1bil2i+l2i+1=1bi+1=bi1bil2i
with l2iN, 0<l2i+1<1 and 1<bi<bi1.

From the definitions of logarithm and integer logarithm there are l1 and b1 such that
abl0+l1=1,0<l1<1b1abl0<bb1b0l1=1

To calculate l1logb0b1=1logb1b0 and we proceed the same way as before. Hence logb1b0=l2+l3, where 0<l3<1 and l2=ilogb1b0.


 In this last figure, point A lies right off the limits of the picture. The red dot-dashed line shows repeated division by B, without crossing the unit U. This leads to b1. Now do the swapping Ab and bb1 and repeat. This leads to b2. Each time count the number of bounces off the Py axis (the one containing U): That's gonna be l2i. In this case, therefore, l0=3,l2=2.

Either some bi hits the unit and the process ends, or it never stops. In this first case, the result of logba is a rational number; in the second, an irrational (and transcendental) number.

In short, using just the operations of  (repeated) multiplication and (repeated) division, given two numbers, b,xthe logarithm Log_b(x) is defined by paths leading towards 1, while the exponentiation bx, by paths leading away from 1.

What can I say. I like "seeing" things and this geometric view is something fun.

Further Geometric Intuition 

I think there is way more intuition to uncover from a geometric view of the logarithm. I hope to describe some of it another time soon. For now, let me collect here some plots I had done and posted elsewhere before.



Note added in proof

Of course, I had to find only now, that this is Daniel Shanks' algorithm for the logarithm published back in ... 1954 (https://www.jstor.org/stable/2001992 or https://www.ams.org/journals/mcom/1954-08-046/S0025-5718-1954-0061464-9/S0025-5718-1954-0061464-9.pdf) !

I still think that explicitly referring to the integer logarithm, as repeated division, adds a clear pedagogical value to it. Further so, if the geometric construction is shown.

Furthermore, for all pairs 0<a,b the logarithm logba can be thought as the continuous, projective "path" (as repeated rescaling) from a to 1 parameterized by b.

This is more of a wish list, or reminder of a vague idea, that would require to be made more precise.

On Google you can find a video from Mathematica showcasing the continuous fraction expression for a logarithm. See also this tweet or this site

I found about Shanks on https://exstrom.com/blog/abrazolica/posts/logarithm.html

Some ideas for when I need a distraction

Only on an Euclidean setting we get the usual values of log as obatin by any calculator. What does the same continuous fraction corresponds to in a Projective space?  E.g. RP2 or S2

Likely more interesting would be the case of HP or HP2, where we loose the commutativity but still retain associativity, and thus, Desargues theorem, which is the only one needed for this construction to work.