Harald Kirsch

genug Unfug.

$\def\v#1{\mathfrak{#1}} \def\vx{\v{x}} \def\vy{\v{y}} \def\vz{\v{z}} \def\mA#1#2{a_{#1 #2}} \def\ma#1#2{a^{#1}_{#2}} \def\t#1{\tilde #1} \def\tx{\t{x}} \def\ty{\t{y}} \def\d#1{\partial #1} \def\dd#1{\partial_{#1}} \def\pderiv#1{\frac{\partial}{\partial #1}} $

2017-11-11

An Explanation of Time

Contents

$ \def\Vec#1{\mathbf{#1}} \def\vt#1{\Vec{v}_{#1}(t)} \def\v#1{\Vec{v}_{#1}} \def\vx#1{\Vec{x}_{#1}} \def\av{\bar{\Vec{v}}} \def\vdel{\Vec{\Delta}} $

Watching a Movie

Movies are comprised of a sequence of pictures. Showing pictures in quick succession creates the impression of a continuous sequence of events taking place. Slow motion reduces the frequency of pictures. Down to a certain limit motion still looks smooth, but then we start noticing that there are individual pictures shown. Yet for the following argument this is not important. The point is that we can slow down the frame rate ever more, even down to zero. At this point a last picture is shown, frozen on the screen. The next picture of course still exists, but will not be shown.

What is the time coordinate in the film. It is discrete and given by the sequence numbers of the pictures. The sequence of pictures defines the sequence of events taking place. When it comes to the last frame shown, where we decided to stop the film, local time in the film does not proceed anymore, simply because time is equivalent to frames shown and the next frame is never shown.

For observers in the movie theater it is irrelevant that there are potentially more pictures to show. There was a last frame and that was that. More will not happen.

Time in Physics

The movie with its slow motion and arbitrary stop can help to understand time in physics. The bold transfer from the discrete time co-ordinate of the film to continuous time in physics works as follows:

  1. Time is a sequence of events, a sequence of things happening.
  2. If events follow each other slower, time runs slower.
  3. If no more events follow, if things stop happening, time does not proceed.

The following paragraphs try to explain why this can be a viable way of looking at time in physics.

Time in physics, as far as we know, is continuous, not discrete. But there are many examples in mathematics and physics where the limit of discrete points results in a continuum. In the same way we can imagine that points in time is are individual events, yet they comprise a continuum.

In this view, time is implicitly given by a continuous sequence of events or states of the world. You could even say that time has no existence in itself. It is "only" a measure of how fast the states of the world follow each other.

Special and General Relativity tell us that time slows down in moving objects or under high gravity. How does this translate into the "continuous sequence of states of the world" view? Easy: the events follow slower onto each other than before. Similar to a film in slow motion. The time between the frames is longer than before.

Oh wait, what? Time between frames gets longer for slow motion, but how does this translate into the time in physics? How can there be more time between states of a continuum of states if the continuum of state is time?

The answer is the same as for the movie: we are talking about two time axes. In the movie, one axis is the frame number. The other is the observer's time axis as given by the observer's stop watch that shows a longer time between frames in slow motion. The same is done in physics, where a difference is made between the local time on a moving object or an object under gravity and the observer's time.

So we have two time axes, the one of the observer and the one of the object being observed. For the film it is easy to see how things happen slower. What about special or general relativity? What constitutes the longer time between world states, what makes world states follow each other slower — at least from the vantage point of the observer?

What are individual world states anyway? This is a difficult question, so we start with simplified world. Take a game of chess. A state is defined by the positions of all the pieces on the board. Look at the board now and look at the board some time later during which the players are thinking, not moving any piece. The state is the same — because nothing has changed. The important word is "change". While it is difficult to fully describe states of the world, it is easy to grasp that they are different due to change.

How do states of the world change? Again we fall back to a simple model. Consider a group of $n$ photons-in-a-mirrored-box and assume that they are point particles. Each photon has the (three dimensional) velocity $\Vec{v}_i$ with the absolute value being the the speed of light $c=|\Vec{v}_i|$. The average value of these velocities is \begin{align} \av &= \frac{1}{n}\sum_{i=0}^{n-1} \Vec{v}_i . \end{align} If the box moves at the speed of light, all photons move in the same direction and their $\Vec{v}_i$ are all identical. In this case $\av$ is also the same and in particular $|\av|=c$. On the other hand, if the box does not move we have $|\av|=0$.

When all the velocities are identical, does the world state of this small world change? Well, the photons are moving at the speed of light through space, so this constitutes a change, doesn't it? The anser is "no", because this takes the world around the photons into account. If you blind out the world around and only look at the group of photons now and 5 minutes later, nothing has changed. Their positions relative to each other are the same. Like on the unchanged chess board we can say that the world state of the group of photons did not change at all.

Put another way: the state changes only if the photon velocities are not all identical. Intuitively, if one photon of a billion has a slightly different direction than all the others, the rate of change is smaller than when the box has stopped and the photons are bouncing about in arbitrary directions within the box. The more the velocities differ, the bigger is the rate of change. One way to measure this totalled difference of pairwise photon velocities are the averaged squared differences \begin{equation} \frac{1}{n^2} \sum_{i<j} (\v{i}-\v{j})^2 \;, \end{equation} which is the same as the variance of the set of velocities.

For the following, note that a sum $\sum_{i,j=0}^{n-1}$, if symmetric in $i$ and $j$, can be viewed as summing the elements $(i,j)$ of a symmetric matrix. As such it can be taken apart into twice the sum over the lower left triangle of the matrix plus the diagnoal like $\sum_{i<j} \dots + \sum_{i}\cdots$. And remember that $|\v{i}|^2=\v{i}\v{i}=c^2$.

Lets add the average velocity squared of the photons in the box and proposed measure for the rate of change, the variance of the velocities: \begin{align} \av^2 + \frac{1}{n^2} \sum_{i<j} (\v{i}-\v{j})^2 &= \frac{1}{n^2}\sum_{i,j=0}^{n-1} \v{i}\v{j} &+ \frac{1}{n^2} \sum_{i<j} c^2-2\v{i}\v{j}+c^2\\ &= \frac{1}{n^2} \left( \sum_{i<j} 2\v{i}\v{j} + \sum_{i=0}^{n-1} \v{i}^2 \right) &+ \frac{1}{n^2} \sum_{i<j} c^2-2\v{i}\v{j}+c^2\\ &= \frac{1}{n^2} \left( \sum_{i=0}^{n-1} c^2 + \sum_{i<j} 2c^2\right)\\ &= c^2 \label{eq:start} \end{align} There is a tradeoff between moving by average velocity, $\av^2$, and changing state as measured by velocity variance, $1/n^2 \sum_{i<j} (\v{i}-\v{j})^2$, because together they always add up to $c^2$. The two extreme cases are:

  1. If all $\v{i}$ are identical, the average speed is $c$, and the rate of change is zero.
  2. If the average is zero, the rate of change is at its maximum, $c^2$.

Lets compare this to the formula from Special Relativity according to which 4 dimensional velocity through space-time is equal to the speed of light $c$: \begin{equation} \left(\frac{c\,d\tau(t)}{dt} \right)^2 + \Vec{v}^2 = c^2. \label{eq:v4} \end{equation} The $\tau$ denotes local time on the moving object, while $t$ is the time for the observer and $\Vec{v}$ is the velocity of the object with respect to the observer. For the ensemble of photons in a box we have $\Vec{v}=\av$, so we can equate (\ref{eq:start}) and (\ref{eq:v4}). Dropping the $\av^2=\Vec{v}^2$ we get \begin{equation} \left(\frac{c\,d\tau(t)}{dt} \right)^2 = \frac{1}{n^2} \sum_{i<j} (\v{i}-\v{j})^2 \end{equation}

The left side describes how time proceeds locally on a moving object, in this case the ensemble of photons. On the right we have the variance of these photons' velocities as a measure of their state change.

For fun and formula simplification, we note that the square root of the variance is the standard deviation $\sigma$ of an ensemble, so we can also write \begin{equation} c\frac{d\tau}{dt} = \sigma(\v{0},\dots,\v{n-1})\;. \end{equation}

It is tempting to speculate that the ensemble of photons is a good role model for the real world, by assuming that

  1. time is (nothing but) a measure of the (rate of) change in physical systems,
  2. the rate of change is governed by all the physical processes that proceed at the speed of light,
  3. all change in a physical system can ultimately be attributed to processes with a direction and proceeding at the the speed of light, i.e. can meaningfully have an $\v{i}$ with $|\v{i}|=c$ ascribed to them.

To summarize: \begin{align} \text{rate of state change} &= \text{photon velocity's standard deviation}\\ &= \text{progression of local time} \end{align}

Open Ends

For a photons-in-a-box world we have seen that the progression of local time is given by how different the photon velocities (i.e. their directions) are. Smaller differences in the velocities intuitively mean a smaller rate of change. And this is formally equal to a slower progression of local time.

Does this have any meaning for the real world?

  • photon is role model for change
  • photon as a point particle is only half the truth, can we do the above with phtons as a wave?
  • max rate of change given by $c$
  • SR: moving reduces possibility for change
  • GR: gravitation reduces possibility for change
  • check entropy$\lt$variance bound: which, with the above remotely looks like the progresseion of time $d\tau/dt$ limits entropy (hmm, of what)
$\def\v#1{\mathfrak{#1}} \def\vx{\v{x}} \def\vy{\v{y}} \def\vz{\v{z}} \def\mA#1#2{a_{#1 #2}} \def\ma#1#2{a^{#1}_{#2}} \def\t#1{\tilde #1} \def\tx{\t{x}} \def\ty{\t{y}} \def\d#1{\partial #1} \def\dd#1{\partial_{#1}} \def\pderiv#1{\frac{\partial}{\partial #1}} $

2016-07-02

Time as a Derived Quantity

$ \def\Vec#1{\mathbf{#1}} \def\vt#1{\Vec{v}_{#1}(t)} \def\v#1{\Vec{v}_{#1}} \def\vx#1{\Vec{x}_{#1}} \def\av{\bar{\Vec{v}}} \def\vdel{\Vec{\Delta}} $

Some time ago I wrote down an interesting derivation of the local time in a box filled with photons to be the same as the average delta velocity between the photons in the box. In particular, local time $d\tau$ is related to the velocity $\v{B}$ of the box and the average velocity $\av$ of the photons as follows: \begin{equation} \left(\frac{c\,d\tau(t)}{dt} \right)^2 = c^2- |\Vec{v}_B|^2 \approx c^2 - \av^2 = \frac{1}{n^2} \sum_{i<j} (\v{i}-\v{j})^2 , \label{eq:start} \end{equation} where the $\v{i}$ are the velocities of the photons in the box, of course with $|\v{i}|=c$, the speed of light.

While I find this already quite remarkable, I think it is possible to go even one step further and, at least formally, get rid of the coordinate time $t$ alltogether. If we call $\vx{i}$ the position of a photon in the box, then clearly $\v{i}=d\vx{i}/dt$. Inserting this into equation \eqref{eq:start}, we get \begin{equation*} \left(\frac{c\,d\tau(t)}{dt} \right)^2 \approx \frac{1}{n^2} \sum_{i<j} \left( \frac{d\vx{i}-d\vx{j}}{dt} \right)^2 \end{equation*} Lets define $\vdel_{ij}=\vx{i}-\vx{j}$. If we invoke the notion of the differential of a function, we can further simplify this last equation to: \begin{equation} c^2 d\tau^2 \approx \frac{1}{n^2} \sum_{i<j} (d\vdel_{ij})^2 \end{equation} This can be interpreted as saying that (the square of) small increments of the local time, $d\tau$, in a box of photons, is equal to the average of (the square of) small changes in the mutual distance of the photons in the box.

I wonder if this has anything to do with the timeless physics that Barbour has in mind. The formula seems to indicate that the flow of local time is just a secondary effect of a bunch of photons not all having identical velocity vectors. Because if they have, $d\tau$ becomes zero.

2015-11-14

Monq.jfa faster again

The implementation of a deterministic finite automaton (DFA) has one central component: transition tables. Each node of the DFA contains one. It maps the incoming character to an outgoing edge, or rather to another node of the DFA, namely the target node of the transition by this character. The fastest implementation is an array indexed by the incoming character. For a character ch and a transition table trans this is just one array access:

trans[ch]

Many transition tables are, however, extremely sparse with sometimes only a handful characters leading out of a node. In this case, using the full array of $2^{16}$ character values is an extreme waste of main memory. From the beginning monq optimized these array based transition tables such they only contain entries for the range of characters between the first and the last character used. Retrieving the transition then looks like

trans[ch-firstChar]

which is only minimally slower than storing the full array. But when only a few characters between the first and the last used character indeed have a transition, this still is a big waste of main memory. Therefore there was always a second implementation for the transition table, that only stores the available transitions and searches for the selected one with a binary search.

For every node, the decision between the two implementations was based on an estimated memory footprint. And the smaller one was always chosen.

In version 1.4 of monq I introduced a parameter that allows to trade memory usage for speed. If it is set high enough, no transition table will use a binary search. And the good news: my performance tests show that for the use case of searching a number of words in a long text, a speedup between 20% and 40% is possible.

(all times in seconds)
no. words 3 4 11 17 26 35
$\Delta t$ regex 9 12 28 42 68 82
$\Delta t$ monq 40 47 49 54 55 56
$\Delta t$ monq with StringBuilder 24 24 26 27 29 30
$\Delta t$ monq trading memory for speed 21 22 23 25 25 25

2015-11-07

Monq.jfa even faster with StringBuilder

As mentioned in the previous article, my revived DFA class library for Java dates back from the time of Java 1.4. It always made heavy use of StringBuffer. Now I found the time to complete replace all instances of StringBuffer with StringBuilder and rerun the performance test reported in the previous article. Here is the table again with the new data:

(all times in seconds)
no. words 3 4 11 17 26 35
$\Delta t$ regex 9 12 28 42 68 82
$\Delta t$ monq 40 47 49 54 55 56
$\Delta t$ monq with StringBuilder 24 24 26 27 29 30

Now the break even, where monq takes over java.util.regex, is already at around 11 words. But I am looking already at some profiling results to see if this can be improved even more.

2015-11-01

Monq.jfa performance comparison with java.util.regex

Recently I found the time to revive the Java package for deterministic finite automata (DFA), that I wrote many years ago at the EBI: Monq.jfa.

The software dates from times when Java was version 1.4 and generics where not yet available, but I noticed that it is quite complete with regard to functionality, and the test coverage shows that most of it is exercised in tests.

My biggest surprise though came from a performance comparison with java.util.regex. While java.util.regex uses "only" nondeterministic finite automata (NFA) and should therefore naturally be slower than a DFA implementation, I expected that implementation tricks and algorithmic developments in the last 10 years had improved its speed such that my DFA implementation provides no real gain anymore. But, as is often case: it depends.

I downloaded Wikicorpus 1.0, and combined 10 of the files into one file of around 210 MB with 35 million words, according to wc -w. The task was to count the appearance of a number of words. The gist of the implementation with java.util.regex is as follows:

Matcher matcher = Pattern.compile("word1|word2|... ").matcher(...);
while (/*input available*/) {
  if (matcher.find(start)) {
    Counter cnt = result.get(matcher.group());
    cnt.increment();
  }
  /* advance start */
}

The class Counter is merely a wrapper around an int with the increment() method. For brevity I leave out the details of buffering and looping over the input which is read in chunks.

For monq.jfa the central code looks like

  CounterAction cntAction = new CounterAction();
  Nfa nfa = new Nfa().or("word1").or("word2")...;
  Dfa dfa = nfa.compile(...);
  new DfaRun(dfa).setIn(...).filter();

The CounterAction is a callback which is called inside the filter() method for each matche found in order to count it.

I tested with an increasing number of randomly picked words, where the was one of them with a total count of 2.2 million times and the most frequent. The table below shows running times with an increasing number of words.

(all times in seconds)
no. words 3 4 11 17 26 35
$\Delta t$ regex 9 12 28 42 68 82
$\Delta t$ monq 40 47 49 54 55 56

When I started the measurements with three words, I was disappointed to see that all the lines of code seem to be useles: java.util.regex is 4 times faster. But then I remembered why monq.jfa was implemented in the first place: to filter text for whole dictionaries of strings or even regular expressions. Therefore I started adding words and, hey, the table shows the trend. As soon as your dictionary exceeds around 20 words, the DFA shows its strength.

In fact, starting from 17 words and onwards, the DFA implementation exhibits nearly the theoretical limit behavior, whereby the running time depends on the input length only, not on the complexity of the regular expression. Given that at the EBI we were using dictionaries with several thousand words, it seems monq.jfa was just the right thing to use. ☺

2015-10-26

Linux Mint with Cinnamon

My old Laptop, a Lenovo T500, served me well for many years now. And it could have served me further, if I had not bought an Android 10" tab 2 years ago. Uuuuhu, how can this be related?

Well, the tab was intended for the casual surfing on the web and sometimes to waste some time with a small game. Yet, when surfing the web, I like to give feedback, and not just by clicking a button with a thumb on. Rather I tend to write, and write lot. But this is a complete pain with the on-screen keyboard on a pad. And not only the writing. I came to he conclusion that the general idea of touching with your fingers on the screen you want to read is a silly idea except for the most constraint situations.

So I decided to buy one of these 12.5" laptops, an Asuspro BU201. While it is of course larger than the tab, it is still light and small enough to carry through the house and use on the couch, if necessary --- in particular so compared to the T500 monster brick.

I got it from ixsoft.de with Linux Mint pre-installed with the Cinnamon desktop environment selected. Everthing worked just as it should so far. Compared to Xfce, Cinnamon looks a bit nicer, more sleek, more modern, but keeps all the benefits described over there as compared to Ubunutu Unity or Gnome-3. Fully configurable, for example to ludicrous settings like having F12 close windows and a double click on the title bar move the window to the background. — Very nice.

2015-03-17

A mechanistic explanation of Time

$ \def\Vec#1{\mathbf{#1}} \def\vt#1{\Vec{v}_{#1}(t)} \def\v#1{\Vec{v}_{#1}} \def\av{\bar{\Vec{v}}} $

If you search the Internet for an explanation of what time is, there are a lot of sites with a lot of words basically saying that they cannot say anything about time. Here I have a different approach in that I ask you to compare two simple formulas and let you draw your own conclusions.

The speed of light

Given an observer whose local time is $t$ and an observed object passing by with a velocity of $\Vec{v}(t)\in\mathbb{R}^3$, Special Relativity tells us that for the proper time $\tau$ of the object the following holds: \begin{equation}\label{eq:srt} c^2 = |\Vec{v}(t)|^2 + \left(\frac{c\,d\tau(t)}{dt} \right)^2 \end{equation} where $c$ is the speed of light and $|\cdot|$ denotes the absolute value of a vector.

The term $d\tau/dt$ could be called the speed of aging of the object with respect to the observer. If the object is at rest with respect to the observer, i.e. $|\Vec{v}(t)|=0$, then $d\tau/dt = 1$, meaning the observer and the object age with the same speed.

The other extreme case is where the relative velocity approaches the speed of light $c$ and $d\tau/dt\to 0$ meaning that with respect to the observer, the object is not aging anymore.

Average velocity of an ensemble of points

The second formula describes the average velocity of an ensemble of $n$ points. For each point particle $0\leq i<n$, its velocity shall be $\vt{i}$. Further, all absolute values of the velocities shall be identical, namely $|\vt{i}|=c$. The average velocity of the ensemble is then \begin{equation} \av(t) = \frac{1}{n}\sum_{i=0}^{n-1} \vt{i} . \end{equation} For brevity we leave out the dependence on $t$ for now as we compute the difference $c^2-\av^2$. \begin{align} c^2-\av^2 &= c^2 - \frac{1}{n^2} \left(\sum_{i=0}^{n-1} \v{i}\right)^2 \\ &= c^2 - \frac{1}{n^2} \sum_{i,j=0}^{n-1} \v{i}\v{j} \\ \end{align} The last sum is symmetric in $i$ and $j$ and therefore contains each pair $\v{i}\v{j}$ twice, except where $i=j$. The latter, quadratic terms are extracted from the sum to arrive at: \begin{align} c^2-\av^2&= \underbrace{c^2 - \frac{1}{n^2}\sum_{i=0}^{n-1} \v{i}^2}_{(A)} - \frac{1}{n^2}\sum_{i<j} 2\v{i}\v{j} \end{align} Since $\v{i}^2=|\v{i}|^2=c^2$, the terms denoted as $(A)$ in the formula can be written as \begin{align} (A)&= c^2 -1/n^2\cdot n c^2 \\ &= c^2(1-1/n) \\ &= \frac{n-1}{n}c^2 \\ &= \frac{1}{2} n (n-1) \frac{2c^2}{n^2} \end{align} The term $1/2 n(n-1)= 1/2 (n^2-n)$ is the number of elements in the lower right half of a square matrix without the diagonal elements and is therefore the same as $\sum_{i<j} 1$, which we multiply by $\frac{2c^2}{n^2}$ and plug it into $(A)$ to get \begin{align} c^2 -\av^2 &= \sum_{i<j}\frac{2c^2}{n^2} - \frac{1}{n^2}\sum_{i<j} 2\v{i}\v{j}\\ &= \frac{1}{n^2} \sum_{i<j} c^2-2\v{i}\v{j}+c^2 \\ \scriptsize \text{(since $c^2=\v{i}^2$)}\qquad &= \frac{1}{n^2} \sum_{i<j} (\v{i}-\v{j})^2 . \label{eq:final} \end{align} What does this last equation mean? Remember, we are talking about an ensemble of $n$ point particles all moving at the speed of light. Lets envisage the particles trapped in a box with $n$ sufficiently large and their movements sufficiently random, then the velocity of the box, $\Vec{v}_B$ is a close approximation to $\av$, the average over the particle velocities.

Putting it together

Suppose the box is the observed object we talked about in the first section. Then, by comparing equation \eqref{eq:srt} with the last equation \eqref{eq:final}, we get \begin{equation} \left(\frac{c\,d\tau(t)}{dt} \right)^2 = c^2- |\Vec{v}_B|^2 \approx c^2 - \av^2 = \frac{1}{n^2} \sum_{i<j} (\v{i}-\v{j})^2 \end{equation}

  1. On the far left we have the term which describes the flow of time in the box with respect to the observer.
  2. On the far right we have a purely mechanical term, the average delta velocities of the point particles in the box.

Does this make sense?

Here comes the part that I have to leave to the reader, except that I throw in my opinion anyway: it does make a lot of sense to me. Consider the box moving faster and faster, until it reaches the speed of light. What happens to the point particles in the box? Since they move also at the speed of light along with the whole box, the delta velocities $\v{i}-\v{j}$ have to converge to zero. Consequently the relative positions of the points inside the box become constant: the content of the box is kind of frozen, nothing changes anymore. This is the situation where also $c\,d\tau/dt=0$, meaning that proper time comes to a halt.

My conclusion is that (proper) time is nothing but the integrated average of change happening in a closed system. For a (closed) system of point particles, change is simply the delta velocity between points.

Open questions

Of course there are many. My priority one question is whether a similar derivation is possible for a system "filled" with a changing field, such that $d\tau/dt$ turns out to be equal to some measure of change of the field.