Wednesday, 11 November 2009

Measuring life

Life is measured not in years but in a number of dreams of youth you have let go.

Friday, 2 October 2009

Thesis of darkness

In an evolving system only around one twelfth of substance contributes to the observable cause and consequence relations, the rest is darkness.
  • Dark matter and dark energy in physics.
  • Dark DNA in biology – junk or non-coding DNA.
  • Dark money in economics – money made by promises, in opposite to visible coin, plastic, and digital money.
  • Dark information – unexplainable sequences of events.

Wednesday, 30 September 2009

Wealth and Income

An interesting observation. I and many of my friends have to work to pay our debts. We are intelligent proletarians. A proletarian is a person who possessing neither capital nor production means, must earn his living by selling his labour. A non-proletarian may work, but he does not have to in order to support his living. We are paying out mainly our mortgages, which are mainly the loans for the houses we live in. And most of the value of the houses is the land. So basically we work hard to pay out the land we live on. That makes me ponder.

A simple model. A number of people are willing to buy a resource which is not producible by labour, for example, land. The market price for the land rises up to the level of the limit of competitive abilities of those people. If the people are desperate they borrow from the bank some kind of paper. By doing this they sell their future labour. The owner puts this paper back to the bank, and the bank cancels the paper. When future comes, people have to work to pay back the borrowed paper producing a lot of consumable products. If the amount of products is more than enough, they have to produce all kinds of luxuries to please the owners of the bank and the resource previous owners. When the demand for the resource declines, the prices fall, leaving years of hard labour spent on something, which those people not really required at the first place.

I always suspected that the slavery era has not ended. It transformed. People, who have to work and earn for living, pay taxes. They pay taxes directly through their income and indirectly through businesses they work for, and through the sale taxes. But some who do not have to work usually pay much less taxes, because their lives are businesses with tax deductible expenses. Am I a supporter of this kind of system? Would a simple solution as taxing wealth (not wealth taxing) instead of personal income make all people happier? That makes me ponder.

Tuesday, 14 April 2009

Bomb Problem (part II)

Assume that point A is at location -1 and point B is at 1. If one source produced both A and B and the next shot is expected to be produced by the same source, then the best fit is the normal distribution with mean 0 and dispersion 1: N(0,1,x) - gives the maximum probabilities for points A and B. On the other hand, if different sources produced A and B, the best guess would be that the third shot is normally distributed with one of the sources F(x). Now since no information present about whether one or two sources produced A and B, give the same chances to either way:


For F(x), give the same chances to points A and B:


And the best guess for F(y,x) would be N(y,(x-y)/2,x), because the only information about the dispersion for F(y,x) is the distance between x and y, and the dispersion (x-y)/2 is the best fit. Note, that the function F(y,x) is not proper distribution for variable x, because the probability is given for fixed dispersion and it depends on x, i.e. to be normalized the dispersion has to be fixed. The overall distribution then is:



The graph for function f(x) is presented above. The minimum values are at points: -0.47 and +0.47. This means that the safest place is about a quarter distance from either end.

Friday, 3 April 2009

Kernel Density Estimation: Multikernel and Bomb problem

Given a sequence of independent identically distributed random variables X1, X2, ..., XN with common probability density function f(x), how can one estimate f(x)? (Old good KDE problem)

Let us consider the following simple question. You are on the road and you cannot go off side the road. Two bombs fall at points A and B in no particular order (for example you can see only two shell holes, but do not know which one was the first). Where is the safest place on the road if you expect the third bomb to fall? Obviously it is as far as possible from the both points. But what about the safest place between A and B? Is it the middle? Is it the place close to the point A or B?

If you think that both bombs fell from the same source and just randomly deviated from each other, then the middle point would be the most dangerous place, because it gives the highest probability that the most probable outcome is in the middle. However, if you think that those two bombs have independent sources, then the middle is the safest place because it is likely that the third bomb is sourced from either of those two. [It is the best guess because we do not have any information at this moment.] Now if you do not know if the sources are independent, somehow dependent or both are the same, then the answer is unclear.

Note that considering both sources sampled completely independent but with the bandwidth deduced from the distance between the points is the usual way for Kernel Density Estimation. The assumption that the sampled points are uncorrelated seems a bit weird, if not illogical at all. There is no relation between making distribution around points smooth and the spatial information. Doing this properly the estimator f(x) would be a sum of delta functions on points. But this is unacceptable, so the estimator is smoothed with Gaussians or some another kernels. Now if the smoothness (bandwidth) is big enough it is possible (depending on the kernel shape) that the middle is less safe than the end points. [For example see how the most dangerous place changes with the bandwidth parameter for the sum of 2 Gaussians.] In other words the probability in the middle adds equally from both sources and it can be greater than maximum probability from the source A plus probability from the source B at the point A.

If the common kernel is taken for both points, then the most probable place for the third point is the middle, which leaves end points safest - with simple shape of the kernel the middle is the most dangerous place and the further you are from the middle the safe you are; regardless whether you stand right inside the shell hole A or B, or next to it.

Personally I would hide in 1/4 of the distance between A and B from the point A or B, i.e. in the middle between the end point A or B and the middle point. What kernel does satisfy this? I do not know.

Thursday, 29 January 2009

How I made new Microsoft C++ compiler work without Visual Studio installation

My task was to make minimalist compiler configuration running on a machine without installed Visual studio. This helps to work on C++ programs on any computer: copy your files, copy the compiler, and then compile and run. Below are the steps I did to make it working.

1. I downloaded and installed free Visual C++ 2008 Express Edition

2. I created target directory d:\c15 and a file setvars.bat with the following content
set C15=d:\c15
set PATH=%C15%\bin;%PATH%
set INCLUDE=%C15%\include
set LIB=%C15%\lib

3. I copied files

from "Microsoft Visual Studio 9.0\Common7\IDE\" into "d:\c15\bin\"

c1.dll, c1xx.dll, c2.dll, cl.exe, link.exe
from "Microsoft Visual Studio 9.0\VC\bin\" into "d:\c15\bin\"

whole directory 1033
from "Microsoft Visual Studio 9.0\VC\bin\" into "d:\c15\bin\"

whole directory include
from "Microsoft Visual Studio 9.0\VC\" into "d:\c15\"

libcmt.lib, libcpmt.lib, oldnames.lib
from "Microsoft Visual Studio 9.0\VC\lib\" into "d:\c15\lib\"

from "Microsoft SDKs\Windows\v6.0A\Lib" into "d:\c15\lib\"

4. At this moment I was able to compile C++ programs with the copied compiler. I started cmd, cleaned the PATH variable, run setvars (step 1), and cl.exe compiled the C++ and C programs. But when I moved this directory to the computer which does not have Visual studio installed then cl.exe failed with a message: "The system cannot execute the specified program".

5. I looked into cl.exe binary searching for the string "manifest". That part is XML. Noted the lines
name="Microsoft.VC90.CRT" version="9.0.21022.8"
Note: version reported by cl.exe is different!

6. I went into C:\WINDOWS\WinSxS\Manifests and found file
Note: version numbers match!

7. I copied this file into "d:\c15\bin" directory and renamed it into
Note: the name in step 1, the name of the file, and the name inside this file is the same "Microsoft.VC90.CRT"!

8. I went into C:\WINDOWS\WinSxS and found directory
Note: version match!

9. Copied all dlls from this directory into "d:\c15\bin" directory.

Voila, it worked in Virtual Windows with no Visual Studio installation.