Sog Croonge

Wednesday, April 16th 2014

Sog Croonge

The Problem of the Fungibility of Money

Tuesday, April 15th 2014

The distribution of wealth in the West is unequal. And becoming more unequal. The stats seem to be in.

What wealth buys you is another question. Someone on a modest wage can buy a computer now. In 1950 a computer would have cost the equivalent of millions. In fact, a computer as good as a cheap mobile phone would not have existed. But a modest wage won't buy you a house in the suburbs in Australia these days, but it would have in 1950. Instead, you need two incomes to buy a house now. TVs are relatively cheap. Health care is more expensive (but better), intrenational phone calls are cheaper than in 1975, and so on.

You could discuss the topic of relative purchasing power between eras, etc, with little or no emotion; but discussions about inequality, taxes, welfare, business concessions, and so on, usually ends up setting off explosions of high dudgeon.

"You mean you want the hard working to be penalised!"

"You just want to protect the rich!"

"It's a war on the poor!"

"Its envy of the successul!"

"If people aren't rewarded they won't work!"

"Poor people work too hard for too little!"

… and so on and so forth. I think most of this is political. If you have wealth (or empathise with those who do) then things seem alright: you want to defend the existing distribution of wealth. If you have relatively little wealth (or empathise with those who don't have much), you criticise the existing distribution of wealth.

But there's another aspect to inequality in a market system that's worth pondering. I've written about it before, but for some reason I thought I'd revisit it.

You Work Too Much! Work Snobs & the Four Day Weekend

Monday, April 14th 2014

There's a joke about the last Mayday parade in the Soviet

Union. After the tanks and the troops and the planes and the missiles rolled by there came ten men dressed in black.

"Are they Spies?" asked Mikhail Gorbachev.

"They are economists," replied the KGB director, "imagine the havoc they will wreak when we set them loose on the Americans!"

- Anonymous

"Nothing is more obstinate than a fashionable consensus."

- Lady Margaret Thatcher

James M Barrie said that "nothing is really work unless you would rather be doing something else." What would you do if you won the lottery? Let me take a guess. Whatever "something else" is to you. Michael Bernstein, paraphrasing Clay Shirky, puts it this way:

Work is what we have considered for years: your boss tells you to do something, you do it, and you get paid. By contrast, (little-w) work is motivated by inherent interest and generally unpaid. source

Simple Algorithms 2 - Euclidean Distance

Saturday, April 12th 2014

Let's imagine a role playing game. Each character has a strength attribute.

Zeldo the Magnificent, a Mage, looks like this:

{
    'strength': 1.0,
}

Mungord the Barbaric, A Barbarian Chief, looks like this:

{
    'strength': 9.0,
}

What if each character has two attriburtes, Strength and Intelligence? Each attribute is on a scale between 0 and 10.

Zeldo the Magnificent, a Mage, looks like this:

{
    'strength': 1.0,
    'intelligence': 9.0
}

Mungord the Barbaric, A Barbarian Chief, looks like this:

{
    'strength': 9.0,
    'intelligence': 4.0
}

Euclidean Distance

We want to work out how similar each character is to each other character.

Let's use Euclidean Distance.

For Zeldo and Mungord, it's pretty simple.

You take Zeldo's score for strength, a 1, and compare it Mungord's score, a 9. Then you calculate the distance between the two scores. In javascript, you can use Math.abs to calculate the distance.

Then you can do this:

var strengthDifference = Math.abs(zeldo.strength - mungord.strength) // 8
var intelligenceDifference = Math.abs(zeldo.intelligence - mungord.intelligence) // 5

Then you square the two distances.

var strengthDistance = Math.pow(strengthDifference,2);
var intelligenceDistance = Math.pow(intelligenceDifference,2);

Then you sum the distances.

var sumOfDistances = strengthDistance + intelligenceDistance;

Then you get the square root of the sum.

var euclideanDistance = Math.sqrt(sumOfDistances);

The closer the character's attributes are, the lower the Euclidean distance.

What if Zeldo and Mungord have three attributes? No problem.

So, for instance:

var strengthDifference = Math.abs(zeldo.strength - mungord.strength) // 8
var intelligenceDifference = Math.abs(zeldo.intelligence - mungord.intelligence) // 5
var sexualCharismaDifference = Math.abs(zeldo.sexualCharisma - mungord.sexualCharisma)

Then you square the three distances.

var strengthDistance = Math.pow(strengthDifference,2);
var intelligenceDistance = Math.pow(intelligenceDifference,2);
var sexualCharismaDistance = Math.pow(sexualCharismaDifference,2);

Then you can sum the distances.

var sumOfDistances = strengthDistance + intelligenceDistance + sexualCharismaDistance;

Then you get the square root of the sum as per usual.

var euclideanDistance = Math.sqrt(sumOfDistances);

You can add more attributes, too.

Hard to visualise the relationships beyond 3 dimensions! In mathematical terms it looks like this:

Of course, you just want a js function that does all this for you:

var euclideanDistance = function(p, q) {
    var sumOfDistances = 0;
    for (var n=0;n< p.length;n++) {
        var diff = Math.abs(p[n] - q[n]);
        var dist = Math.pow(diff,2);
        sumOfDistances += dist;
    }
    var euclideanDistance = Math.sqrt(sumOfDistances);
    return euclideanDistance;
}

Once you've got the hang of the basic idea, you might want to investigate Jsperf to read about different ways to calculate Euclidean distances. They vary in efficiency. Some are much faster than others! Hint: the implementation above sacrifices speed for clarity!

The Enlightenment of Leonard Fisk Part 2

Friday, April 11th 2014

Continuing from The Enlightenment of Leonard Fisk Part 1.

Leonard Fisk sat on his sofa in deep contemplation. He was scribbling in his notebook.

When the Universe began there was nothing. Absolute nothingness was upon the deep. Which was not actually deep on the account of the fact nothingness can't be measured. Into this void there came a mighty God, Erondel, who was nothing, yet, in enigmatic God-like fashion, existed in a capacity of overseer and administrative agent of Humus Factorant Plendar the God Beyond. Under Humus's instructions Erondel began a mighty task, to create Life out of the void.

Erondel cast a thousand -

Leonard paused and squinted at his notebook. What would a mighty God cast a thousand of into a void? Particles of Truth? Nah. A thousand souls? Nope, that would cause all sorts of awkward questions due to subsequent population growth. Err - a thousand notes of the great symphony of Creation? That's the ticket.

cast a thousand notes of the Great Symphony of Creation into the void and there was a great tumult. The notes grew and multiplied until the void became less void-like and more hospitable. As as the notes formed a great melody that was known as the Song of Creation. And so it was the Universe came into being.

Ah, wait. Leonard scribbled over "into being".

into Being.

Randomly adding capitalisaton always helped, thought Leonard.

And then the notes took on a multitude of forms, too numerous to describe. But the counting of the forms was a thousand. And Erondel looked upon his work and was satisfied. And so it was that Erondel left the Universe-that-was-once-void, developed some basic guidelines for its development and appointed a variety of subcontractors to maintain the Universal infrastructure. And there was much rejoicing.

Now he needed a sort of ten commandments without too much of the authoritarian, judgmental feel. Umm -

Try not to partake of thine neighbour's visiting jug without consulting the

Northern Sun.

Contemplate not the Philosophy of the Church of Nothing at any great

length.

Question not thine elders e.g. Appointed representatives of Erondel.

Upon the ninth sabbath day of the third year of Cartelopoin partake not of the berry of the bush and neither shall ye close the door of the Light of Sardak nor use sunflower oil in thine frying pan for it be carcinogenic.

Give up a 15% of thine worldly goods and make them the legal property of the Church of Nothing pty ltd and its appointed

representatives such as Mr. L. Fisk.

Question not the accounting practices of said organisation.

Peace, harmony, happiness, well being generally, etc.

Leonard paused for a moment. Mental note, he wanted wealthy followers. A little something to encourage them was in order. Err -

Avoidth yon tax at all times for tax is the work of Zeltebonodobad the Destroyer.

Ah. Not bad. But one more thing.

These guidelines may change without notice.


Leonard wandered down the street in white robe. His head was shaven. He paused to look at his reflection in a shop mirror. He was not going to taken seriously as a spokesman for a new religion looking like this, he thought. Perhaps when he had a beard? Still, he had photocopied some pamphlets. That was a start.

He continued down the street. Some adolescents hanging about a fountain sniggered a little and looked over his way.

Leonard stopped walking and fixed them with what he hoped was a gaze of deep profundity.

"The hooves of the wild donkey do not tread upon the icy wastes of Being, little ones," quoth he.

The kids stopped sniggering and looked baffled.

"You're fucked mate," said one of the kids.

"Ah," replied Leonard. "And what does it mean when a star burns in the heavens yet does not reveal its light?"

The kid shrugged. "It means you're fucked." They all started sniggering more loudly.

"That or its some kind of black hole or something," said one of the kids.

Leonard held up a finger. "And what is it that black holes feed upon?"

The kids started to hasten away.

"Light!" shouted Leonard after them.

"And what's your point?" asked another voice from behind Leonard.

Leonard turned around.

A man was looking over one of Leonard's pamphlets.

"You wrote this?" he asked.

"It came to me in a dream on a Golden tablet that had had these words etched upon it by Erondel himself using the Emerald Truth Seeking Chisel."

"You'd think someone who could create a universe would write a little better?"

"He," the man quoted, "developed some basic guidelines for its development and appointed a variety of subcontractors to maintain the Universal infrastructure." He paused. "Doesn quite rung off the tongue does it?"

"They the words of Erondel," said Leonard, trying to sound scholarly.

"No, seriously, you need a little help, getting Word of Erondel out there. I could help."

"Oh yeah?" Leonard regarded the man with suspicion. "It is I Erondel has chosen to steer humanity on to the Eightfold path of Righteous Transcendence of the Corporeal Dimension."

"No doubt," said the man. "But there's nothing stopping you hiring a marketing consultant."

The man nodded his approval.

"You have," the man made quotation marks with his fingers, "spiritual potential."

Simple Algorithms 1 - Sequential/Linear Search Versus Binary Search

Thursday, April 10th 2014

Imagine that there are 9 closed boxes organised in a line.

Each box contains a piece of paper with a number written on it.

Imagine you're trying to find the number 12.

You don't know which box the number is in. Indeed, you don't even know if it's in one of the boxes!

How do you search for number 12?

You have to open each box until you find it.

You may as well start from the first box!

Is it in box 1? No.

Box 2? No.

Box 3? No.

Box 4? Yes!

You had to open four boxes to find 12. But that was just good luck.

If there were 18 boxes you might end up opening all 18 boxes.

If there were 27, you might end up opening all 27.

The number of boxes you might end up opening roughly matches the number of boxes there are to search.

This is called a "linear" or "sequential" search.

Here's some javascript to do something similar:

var findNumber = function(arrayToSearch, numberToFind) {
    for (var n = 0; n < arrayToSearch.length -1; n++) {
        if (arrayToSearch[n] === numberToFind) 
        {
            return n; // found it!
        }
      }
    return -1;
}

var boxes = [12, 32, 33, 43, 56, 78, 99, 109, 400];
var result = findNumber(boxes, 12);

This algorithm has an efficiency of O(n). That is: the length of the array - n - we give to findNumber tells us how long it is likely to take, the worst case, to find the number we're looking for.

So: an array that has ninety numbers (where n = 90) in it could take take ten times as long as the one that has just nine (where n = 9).

We're at the bottom of page 74.

Click a page number above to go to that page.