Friday, October 28, 2016

Natural Information

I want to compare the number of combinations of n bits:

2n

with growing processes, like with accruing of capital with annual compounding

(1 + (i)/(100))n

or the especially interesting natural growing

ex = limn −  > ∞(1 + (1)/(n))nx = limm −  > ∞(1 + (x)/(m))m

Mathematics describes reality. So the similar formulas should have similar, though abstracted, realities: This similarity can be found in the context of information.

Note

I often use the variable - value pair. Value, though, has the connotation of additiveness. This is not implied in my usage, but also not excluded. Variable - state, or variable - element would be alternatives.

The key to compare them is to understand information in the shape of bits as a growing process.

The bit values are identifiable, have a real existence in the computer. Every bit variable in a set of bits is also identifiable. Let's not name the bit variables and bit values, though, but instead only look at the size of distinguishable bit value patterns. Every bit increases this size by 1 times what is there already. Let's denote this aspect of the bit by (1 + 1) to emphasize that an additional 1 is added to the one there already. The parentheses make this an operator, an element of the number set Q, the set where the number also includes the multiplication operation, thus making it an operator. The operator's effect is to duplicate the distinguishable multitude. n repeated applications of (1 + 1) produces a multitude of size

(1 + 1)n = 2n

Every new bit is compounded to the existing combinations.

The entry in this multitude is used to represent a real value in a real variable of size C < 2n. The information measure for a real variable, when dealing with bits, is the number of bits n = log2C needed to create the multitude of size C. This measure arises from the wish to create a multitude, using bit variables, that can be mapped to the values of the real variable. The real information is the size of the actual variable we map to.

Note

If we start from a number of variables, the exponential function gives the number of value combinations. If we start from a number of values, the logarithm gives the number of variables needed to represent it.

For interest calculation we look at an amount of money (the 1), which is deposited in the bank with interest i. After n years the 1 has grown to

(1 + i ⁄ 100)n = qn

q is not 2, normally just a little above 1. The corresponding "information" measure in a financial context of interest i would be the number of years, or whatever unit of compounding period one chooses to use.

The essential difference with respect to bit information is that what is added is a fraction of what is there. But then, fraction is actually just a matter of units.

The units of living organisms are cells and the ultimate units in the real world are the quantum particles. Both of them are small compared to the things around us. And with such small units one can also compound arbitrarily (infinitely) often:

limm −  > ∞(1 + (x)/(m))m = limn −  > ∞(1 + (1)/(n))nx = ex

In the first equality we see that, given a certain growth, varying the compounding steps amounts to varying the growth rate.

Note

Actually in the financial world the real compounding takes place in very small steps, just that the bank forwards them to the customer in larger units of time for several reasons.

x is the information in the natural information unit nat. Basically we split up the size of the variable to infinitely many infinitely small fractional variables, whose size are just a very little bit larger than 1.

What is special about ex is that its change is also ex. It is a consequence of the infinite amount of compounding steps and that ∞ − 1 = ∞:

(dex)/(dx) = ∞(1 + (x)/())∞ − 1(1)/() = (1 + (x)/()) = ex

So to summarize:

  • The actual information is the size of the real variable.
  • The logarithm x = logbC arises from the view of this size by combinations of constituent or representative variables like bits (b = 2), years (b = q), trits (b = 3), nats (b = e), digits (b = 10); cells, atoms, quantum particles, ...

This change of perspective is done very often in physics. We can think of it whenever we see an exponential function or a logarithm in a formula.

In programming the size of a program can also be measured

  • by the number of variables (assumed independent by a good design, and only those, which actually contain information, i.e. assume more than one value)

    This is a relevant measure for design and reviewing of source code.

  • the number of value combinations throughout the lifetime of the program

    This is a relevant measure when testing a program.

Note

Following these thoughts helps to feel at ease with the two ways to view information:

  • the number of representational variables (information measure)
  • the number of values (states) of the actual variable

Thursday, October 27, 2016

Relate health issues first to your diet

Relate health issues first to your diet

The human species started out of Africa and spread over the whole planet. At those times the human world population was small compared to today. The roaming and scattering was done in small groups. As with all species, once separated through distance, independent breeding and environmental differences in selection our development forked. But we all did quite well. The populations grew and some groups became peoples, the first civilizations burgeoned. This was facilitated by domesticating animals and farming the land. From there on we talk about history. But the time before, the prehistory, was a lot longer. It is there that genetic differences developed.

In the long prehistory time humans adapted genetically to their environment, especially in what we ate. The tribes following the herds to the north fed on meat mostly, especially during the long winters. Those in the warm regions ate more plants and fruits because they were available either throughout the year or at least during summer.

When the populations grew, the peoples spread and met again: They waged war, fought for resources, mixed genetically again. These are time periods we learned to survey in our history education, periods of 2, 3 thousand years. That is no time compared to the hundreds of thousand of years before that. That is no time for genetic adaption, which counts in generations. The history time accounts for a hundred generations, the prehistory time for 10000 generations.

The history time brought us in today's small world for the 7 billions of us. We now can reach every spot of the world within a day. We mixed up and we mix up more than ever today, genetically, culturally and, in regard to the topic, especially in food culture.

We may be born into a "homogeneous" culture, but actually might not be so much in a genetic sense, because the mixing went on for some time already. So we start to live in a food culture that is good for some of us, but is bad for others. Some of us can drink milk and eat sweets throughout their life, others get intolerant to the lactose in the milk and can't eat fruits when they become adults. Others report issues when eating meat.

Health issues were not very much linked to food throughout history, because there was not the awareness brought by through the scientific method. Surely some individuals found out by observing themselves and couldn't explain why everybody else seemed to have no problems at all. Still today diets are advertised as the good diet for all. But it is not the case. We are different in what we can eat and in what we can't, even if we live side by side.

Were I was born people have a saying: "You eat what is on the table". I was born on a little mountain farm and I know of grandfathers who had stomach issues and died early. These people lived before the modern world had reached the village. They lived of the farming, and a lot of it was grain. The land was quite split already and rather small. So one had to be parsimonious to get along though the winter. One could not slaughter too often and so one ate grain products mostly. Their health issues were not associated to what they ate. They themselves were not aware of it and the people around them would also not have accepted special food for one of them.

All people have a long history of natural genetic selection behind them and are or were well adapted to their environment. This means that they also felt well, felt lively and full of energy. The fast change, compared to evolutionary times, in the food culture though cultural mixing and systematic creation of new food products, made some of us feel tired most of the times.

If you have health issues, mentally scan your diet first and do trial and error with food until you feel better. Observe your digestion.

A doctor will not see how you feel day in, day out. In general one cannot give away responsibility to others, also not to a doctor. Doctors often don't search carefully, because they don't have time, because they are in a routine to walk people through their practice. Don't become a congestion of the health system and don't waste money for doctors or health gurus.

But what is a health issue in the first place? If you feel tired and can't concentrate although you have slept enough, you might think, that's the way you are. But think again, think of what you ate, Tiredness is the first symptom and can last for decades, possibly accompanied by red eyes or light skin issues. The next symptoms show a lot later, maybe when you are 40. You get swollen eyes, more visible skin issues. But then your inner organs and all the rest of your cells have a long time of suffering behind them and have spent their very resourceful ability to cope with the poisonous milieu you have kept them for too a long time.

That is a big problem about eating related issues. It takes a long time until the symptoms become serious. So people tend to neglect them.

Take the first signs serious. I've heard that from an old professor who was shaking like hell while lecturing. Ultimately the nerves are the most precious part that will cease functioning: shaking, dementia an the like. Of course everything will cease functioning finally at one time. It is just that eating related issues tend to be a slow decline.

Sunday, August 21, 2016

Geometric Algebra

The basic building block of information is a variable. Let M be the number of values (objects,elements) (extent) in one variable and N the number of values in another variable. This could be the number of unit lengths on the sides of a rectangle, but it could also be the number of different values in a column of a database table. A joint selection will have MN values to choose from, i.e. the extent of the joint variable is MN. That is the origin of multiplication. It is applied to rectangles in elementary school, but in physics education (i.e. description of the world) we later on encounter products of various kinds, like s = vt and p = mv and so on (s, t, m, v, p being extents of variables). The idea that allows us to do this is the abstract notion of information, and, specifically regarding multiplication, of the number of possibilities to jointly fix values of more variables. If s is the extent (length) of a line swept by a point and t is the extent of another line swept by the pointer on a clock, then v = s ⁄ t is a (reduced, relational) extent, that needs to be multiplied again by t to regain the original extent s. Physicists quite creatively introduce many helper variables of such kind and work with them using the rules of algebra of numbers. Over the history they reached certain obstacles that necessitated the addition of new numbers, of which the most unintuitive one is the addition of the imaginary numbers. But they are used all over physics. So to understand the complex numbers is crucial in order to understand the modern description of nature.

Note

Geometric algebra is a conceptually more intuitive approach to complex numbers and quaternions.

When one does not want to specify the number of combination of jointly fixing more variables, but only fix them to create a context, one uses vectors.

In an n dimensional space two vectors still only define a plane. The possible combinations swept by the vectors is the area of the parallelogram enclosed by the vectors. Let's reduce this to the multiplication - area of rectangle analogy by decomposing the vectors into orthogonal components along () and vertical () to an arbitrary direction in the same plane.

(a + a)(b + b) = ab + ab = ab − ba
  • The components in the same direction don't enclose any area and are 0 therefore
  • The last step shows that the two area terms have opposite direction. If we take first in both cases, i.e. give the area the same direction, then  − 1 encodes the direction.
  • Opposite direction is needed to make the product 0, if both a and b have the same direction, because in this case they would not enclose any area.

Isn't this the best analogy to the product of the sides of a rectangle? It is, but with the difference that a and b here are not perpendicular. When a and b point in the same direction, the product becomes 0. So this product contains both, the rectangle product and the relative direction, more specifically ab − ba = ab(cosθasinθb − cosθbsinθa) = |a||b|sin(θb − θa). This shows the anticommutativity of this product.

For two variables (area and relative direction) one needs two other variables to maintain the information. Therefore this outer product (ab) is accompanied by an inner product (or dot product) ab + ab = ab(cosθacosθb + sinθasinθb) = |a||b|cos(θb − θa).

Note

The outer product corresponds to the cross product usually taught at school. But look for duality for more.

Only both of these two complementary products determine |a||b| and θ. The geometric product is the combination of these products and serves as natural extension of the rectangle product to vectors and as such it is written without symbol. It results in a (scalar + area):

  • Parallel components are multiplied and added to give a scalar.
  • Vertical components are multiplied and subtracted to give a directed area.

So for two vectors we have

ab = ab + ab = (1)/(2)(ab + ba) + (1)/(2)(ab − ba)

The outer product makes a new kind of magnitude (area is different than length) and therefore points to a new direction not part of the other n variables forming the basis of an n-dimensional vector space. In general the vector space is extended by outer products of 2, 3, ..., n vectors, called bivector, trivector or generally grade k vectors or k blades.

Also a scalar is include, because it is linked via the scalar multiplication and it results from the inner product.

There are (nk) different k-vectors. For example in 3D-space there are 3 = (32) plane direction and thus bivectors.

There is only one n-vector, as there is only one scalar. Therefore this is called a pseudoscalar.

The scalar and the k-vectors from grade 1 to grade n make up all we need to describe a fixation of a set of variables and their relative orientations. This is called a multivector. Vector is for the combination of base variables. And multivector also includes the derived variables, i.e. the outer products. Because we have the 0, a base variable is also a vector and a vector is also a multivector.

Algebraic closure, i.e. having the result again in the same set, is important, because we can reuse the same operations or algorithms over again. Normally this is at the cost of losing information. It is an abstraction of information. This information then needs to be stored outside, which normally means less storage space, though. E.g. a number without a unit still needs to be made sense of via the separately stored units. It is tedious to carry along units in all calculations.

In geometric algebra closure is achieved via keeping the different results in a multivector, which stores the number for each grade separately. So for n base variables we have 2n component variables of the multivector (2n numbers) (E.g. 3D it is 8: α, a, b, c, ab, ac, bc, abc). To assert this closure we need to define how two general multivectors multiply and for that we still need to specify how to multiply grade combinations ArBs, not just two vectors. This can be done by reducing vectors to orthonormal components whose geometric product is eiej = δij + (1 − δij)eiej, i.e. we have either a scalar 1 or the wedge product. The result of ArBs depends on which ei each combination of the (ns) and (nr) components have in common and thus annihilate. Those who do not annihilate augment the dimension of the wedge product.

We can also use the following formula only valid for vector times r-vector, but which can be repeatedly applied.

aAr = aAr + aAr = (1)/(2)(aAr − ( − 1)rAra) + (1)/(2)(aAr + ( − 1)rAra)

Here the dot part reduces the grade by one

aAr = a⋅∧ak = ( − 1)k + 1aaki ≠ kai

and the wedge part increases it by one.

Application

The pseudoscalar unit I comprises all base vectors. I2 is -1 for n=2,3 and in general it transforms a r-vector into a (n-r)-vector. This is called a duality transformation. In 3D it can be used to go from a blade to the vector normal to the plane, which is the traditional cross product (v1 × v2 =  − I(v1v2))

For n=2: e1I = e1(e1e2) = e2 and Ie1 = (e1e2)e1 =  − e2. I = e1e2 is the imaginary unit. It makes one dimension into two dimensions: e1(a + bI) = ae1 + be2.

For n=3: e2e3 = i, e1e3 = j, e1e2 = k result in the quaternions with i2 = j2 = k2 = ijk =  − 1.

Reflection on a plane of unit normal vector n:  − nan =  − n(an + an)n =  − n(aI + a) = an − an

Rotation by 2θ is a composition of two reflections: mnanm = RaR. With (nm)2 = (nm − nm)(nm − mn) =  − sin2θ we have

R = nm = nm + nm = cosθ − (mn)/(sinθ)sinθ = e − Bθ

If unit vector a should be rotated to unit vector b, let n be the unit vector between a and b:

a’ = bnanb = RaR R = bn = b(a + b)/(|a + b|) = (1 + ba)/((2(1 + ab)))

These are just elementary applications to demonstrate the usefulness of geometric algebra. See [1] and [2] for a more comprehensive account.

Software

There is a python simpy implementation with a good documentation. Since Simpy version 1.0 it is separately on github. bookGA is a succinct book on geometric algebra.

Here an example:

import sys

from sympy import symbols,sin,cos,sqrt
from galgebra.ga import Ga

(o3d,ex,ey,ez) = Ga.build('e*x|y|z',g=[1,1,1])

(r,th,phi,alpha,beta,gamma) = symbols('r theta phi alpha beta gamma',real=True)
(x_a,y_a,z_a,x_b,y_b,z_b,ab_mag,th_ab) = symbols('x_a y_a z_a x_b y_b z_b ab_mag theta_ab',real=True)

I = ex^ey^ez

a = o3d.mv('a','vector')
b = o3d.mv('b','vector')
c = o3d.mv('c','vector')
ab = a-b

ab_norm = ab/ab_mag

R_ab = cos(th_ab/2) +I*ab_norm*cos(th_ab/2)
R_ab_rev = R_ab.rev()

e__ab_x = R_ab * ex * R_ab_rev
e__ab_y = R_ab * ey * R_ab_rev
e__ab_z = R_ab * ez * R_ab_rev

R_phi = cos(phi/2)-(ex^ey)*sin(phi/2)
R_phi_rev = R_phi.rev()

e_phi = (R_phi * ey * R_phi.rev())

R_th = cos(th/2)+I*e_phi*sin(th/2)
R_th_rev = R_th.rev()

e_r = (R_th*R_phi*ex*R_phi_rev*R_th_rev).trigsimp()
#cos(phi)*cos(theta)*e_x + sin(phi)*cos(theta)*e_y + sin(theta)*e_z
e_th = (R_th*R_phi*ez*R_phi_rev*R_th_rev).trigsimp()
#-sin(theta)*cos(phi)*e_x - sin(phi)*sin(theta)*e_y + cos(theta)*e_z
e_phi = e_phi.trigsimp()
#-sin(phi)*e_x + cos(phi)*e_y
[1]New Foundations of Classical Mechanics, David Hestenes
[2]Geometric Algebra for Physicists, C.J.L.Doran and A.N.Lasenby

Geometric Algebra

The basic building block of information is a variable. Let M be the number of values (objects,elements) (extent) in one variable and N the number of values in another variable. This could be the number of unit lengths on the sides of a rectangle, but it could also be the number of different values in a column of a database table. A joint selection will have MN values to choose from, i.e. the extent of the joint variable is MN. That is the origin of multiplication. It is applied to rectangles in elementary school, but in physics education (i.e. description of the world) we later on encounter products of various kinds, like s = vt and p = mv and so on (s, t, m, v, p being extents of variables). The idea that allows us to do this is the abstract notion of information, and, specifically regarding multiplication, of the number of possibilities to jointly fix values of more variables. If s is the extent (length) of a line swept by a point and t is the extent of another line swept by the pointer on a clock, then v = s ⁄ t is a (reduced, relational) extent, that needs to be multiplied again by t to regain the original extent s. Physicists quite creatively introduce many helper variables of such kind and work with them using the rules of algebra of numbers. Over the history they reached certain obstacles that necessitated the addition of new numbers, of which the most unintuitive one is the addition of the imaginary numbers. But they are used all over physics. So to understand the complex numbers is crucial in order to understand the modern description of nature.

Note

Geometric algebra is a conceptually more intuitive approach to complex numbers and quaternions.

When one does not want to specify the number of combination of jointly fixing more variables, but only fix them to create a context, one uses vectors.

In an n dimensional space two vectors still only define a plane. The possible combinations swept by the vectors is the area of the parallelogram enclosed by the vectors. Let's reduce this to the multiplication - area of rectangle analogy by decomposing the vectors into orthogonal components along () and vertical () to an arbitrary direction in the same plane.

(a + a)(b + b) = ab + ab = ab − ba
  • The components in the same direction don't enclose any area and are 0 therefore
  • The last step shows that the two area terms have opposite direction. If we take first in both cases, i.e. give the area the same direction, then  − 1 encodes the direction.
  • Opposite direction is needed to make the product 0, if both a and b have the same direction, because in this case they would not enclose any area.

Isn't this the best analogy to the product of the sides of a rectangle? It is, but with the difference that a and b here are not perpendicular. When a and b point in the same direction, the product becomes 0. So this product contains both, the rectangle product and the relative direction, more specifically ab − ba = ab(cosθasinθb − cosθbsinθa) = |a||b|sin(θb − θa). This shows the anticommutativity of this product.

For two variables (area and relative direction) one needs two other variables to maintain the information. Therefore this outer product (ab) is accompanied by an inner product (or dot product) ab + ab = ab(cosθacosθb + sinθasinθb) = |a||b|cos(θb − θa).

Note

The outer product corresponds to the cross product usually taught at school. But look for duality for more.

Only both of these two complementary products determine |a||b| and θ. The geometric product is the combination of these products and serves as natural extension of the rectangle product to vectors and as such it is written without symbol. It results in a (scalar + area):

  • Parallel components are multiplied and added to give a scalar.
  • Vertical components are multiplied and subtracted to give a directed area.

So for two vectors we have

ab = ab + ab = (1)/(2)(ab + ba) + (1)/(2)(ab − ba)

The outer product makes a new kind of magnitude (area is different than length) and therefore points to a new direction not part of the other n variables forming the basis of an n-dimensional vector space. In general the vector space is extended by outer products of 2, 3, ..., n vectors, called bivector, trivector or generally grade k vectors or k blades.

Also a scalar is include, because it is linked via the scalar multiplication and it results from the inner product.

There are (nk) different k-vectors. For example in 3D-space there are 3 = (32) plane direction and thus bivectors.

There is only one n-vector, as there is only one scalar. Therefore this is called a pseudoscalar.

The scalar and the k-vectors from grade 1 to grade n make up all we need to describe a fixation of a set of variables and their relative orientations. This is called a multivector. Vector is for the combination of base variables. And multivector also includes the derived variables, i.e. the outer products. Because we have the 0, a base variable is also a vector and a vector is also a multivector.

Algebraic closure, i.e. having the result again in the same set, is important, because we can reuse the same operations or algorithms over again. Normally this is at the cost of losing information. It is an abstraction of information. This information then needs to be stored outside, which normally means less storage space, though. E.g. a number without a unit still needs to be made sense of via the separately stored units. It is tedious to carry along units in all calculations.

In geometric algebra closure is achieved via keeping the different results in a multivector, which stores the number for each grade separately. So for n base variables we have 2n component variables of the multivector (2n numbers) (E.g. 3D it is 8: α, a, b, c, ab, ac, bc, abc). To assert this closure we need to define how two general multivectors multiply and for that we still need to specify how to multiply grade combinations ArBs, not just two vectors. This can be done by reducing vectors to orthonormal components whose geometric product is eiej = δij + (1 − δij)eiej, i.e. we have either a scalar 1 or the wedge product. The result of ArBs depends on which ei each combination of the (ns) and (nr) components have in common and thus annihilate. Those who do not annihilate augment the dimension of the wedge product.

We can also use the following formula only valid for vector times r-vector, but which can be repeatedly applied.

aAr = aAr + aAr = (1)/(2)(aAr − ( − 1)rAra) + (1)/(2)(aAr + ( − 1)rAra)

Here the dot part reduces the grade by one

aAr = a⋅∧ak = ( − 1)k + 1aaki ≠ kai

and the wedge part increases it by one.

Application

The pseudoscalar unit I comprises all base vectors. I2 is -1 for n=2,3 and in general it transforms a r-vector into a (n-r)-vector. This is called a duality transformation. In 3D it can be used to go from a blade to the vector normal to the plane, which is the traditional cross product (v1 × v2 =  − I(v1v2))

For n=2: e1I = e1(e1e2) = e2 and Ie1 = (e1e2)e1 =  − e2. I = e1e2 is the imaginary unit. It makes one dimension into two dimensions: e1(a + bI) = ae1 + be2.

For n=3: e2e3 = i, e1e3 = j, e1e2 = k result in the quaternions with i2 = j2 = k2 = ijk =  − 1.

Reflection on a plane of unit normal vector n:  − nan =  − n(an + an)n =  − n(aI + a) = an − an

Rotation by 2θ is a composition of two reflections: mnanm = RaR. With (nm)2 = (nm − nm)(nm − mn) =  − sin2θ we have

R = nm = nm + nm = cosθ − (mn)/(sinθ)sinθ = e − Bθ

If unit vector a should be rotated to unit vector b, let n be the unit vector between a and b:

a’ = bnanb = RaR R = bn = b(a + b)/(|a + b|) = (1 + ba)/((2(1 + ab)))

These are just elementary applications to demonstrate the usefulness of geometric algebra. See [1] and [2] for a more comprehensive account.

Software

There is a python simpy implementation with a good documentation. Since Simpy version 1.0 it is separately on github. bookGA is a succinct book on geometric algebra.

Here an example:

import sys

from sympy import symbols,sin,cos,sqrt
from galgebra.ga import Ga

(o3d,ex,ey,ez) = Ga.build('e*x|y|z',g=[1,1,1])

(r,th,phi,alpha,beta,gamma) = symbols('r theta phi alpha beta gamma',real=True)
(x_a,y_a,z_a,x_b,y_b,z_b,ab_mag,th_ab) = symbols('x_a y_a z_a x_b y_b z_b ab_mag theta_ab',real=True)

I = ex^ey^ez

a = o3d.mv('a','vector')
b = o3d.mv('b','vector')
c = o3d.mv('c','vector')
ab = a-b

ab_norm = ab/ab_mag

R_ab = cos(th_ab/2) +I*ab_norm*cos(th_ab/2)
R_ab_rev = R_ab.rev()

e__ab_x = R_ab * ex * R_ab_rev
e__ab_y = R_ab * ey * R_ab_rev
e__ab_z = R_ab * ez * R_ab_rev

R_phi = cos(phi/2)-(ex^ey)*sin(phi/2)
R_phi_rev = R_phi.rev()

e_phi = (R_phi * ey * R_phi.rev())

R_th = cos(th/2)+I*e_phi*sin(th/2)
R_th_rev = R_th.rev()

e_r = (R_th*R_phi*ex*R_phi_rev*R_th_rev).trigsimp()
#cos(phi)*cos(theta)*e_x + sin(phi)*cos(theta)*e_y + sin(theta)*e_z
e_th = (R_th*R_phi*ez*R_phi_rev*R_th_rev).trigsimp()
#-sin(theta)*cos(phi)*e_x - sin(phi)*sin(theta)*e_y + cos(theta)*e_z
e_phi = e_phi.trigsimp()
#-sin(phi)*e_x + cos(phi)*e_y
[1]New Foundations of Classical Mechanics, David Hestenes
[2]Geometric Algebra for Physicists, C.J.L.Doran and A.N.Lasenby