05/2/15

Monkeys and Coconuts

Here is my attempt to solve the monkeys and coconuts problem. The story goes
that five sailors were stranded on an island and had decided to gather some
coconuts for their provisions. They put all the coconuts in one large pile and
went to sleep. One sailor got up and fearing that there could be problems when the
time to came to divide the pile, he divided the pile five ways and noticing that
he has an extra coconut, he gave it to a monkey, and then hid his stash. The other
four sailor repeated the same procedure. When they woke up they noticed that
they had a smaller pile and proceeded to divide into five equal piles, this time
around there were no extra coconut left for the monkey. So the question is: what was
the size of the original pile?

We will denote by x_i as the size of the
pile after the ith sailor has carried out his procedure. In this system x_0
is original size of the pile. So following this procedure we then proceed as
follows:

x_1=\frac{4(x_0-1)}{5}
\cdots
x_i=\frac{4(x_{i-1}-1)}{5}
\cdots
x_5=\frac{4(x_4-1)}{5}

It is important to note that x_i \in \mathbb{N}_0 for i=0\ldots5, also \frac{x_5}{5}\in \mathbb{N}_0. Alternatively, we think of the reverse procedure and express the above as
x_4=\frac{5x_5}{4}+1
\cdots
x_i=\frac{5x_{i+1}}{4}+1
\cdots
x_0=\frac{5x_1}{4}+1

Observing that x_5 has to be divisible by 4 and 5 (last equation in the first system and first equation in the second), one can brute force the solution(s) by the following Julia code:

Which results in

[2496,1996,1596,1276,1020]
m=51, x₀= 3121
[14996,11996,9596,7676,6140]
m=307, x₀= 18746
[27496,21996,17596,14076,11260]
m=563, x₀= 34371
[39996,31996,25596,20476,16380]
m=819, x₀= 49996

This corresponds nicely to the answers that were obtained by rigorous derivation in the video, however it shows how programming can easily find such solutions by brute force.

If one would like to avoid the negative or blue concocts suggested in the video and also preserve the monkey. Below is an alternative derivation. Working through the first system, one gets:

x_{5}={{4\,\left({{4\,\left({{4\,\left({{4\,\left({{4\,\left(x_{0}-  1\right)}\over{5}}-1\right)}\over{5}}-1\right)}\over{5}}-1\right)  }\over{5}}-1\right)}\over{5}}=\frac{4^5x_0}{5^5}-\frac{8404}{5^5}

Hence,
5^5x_5=4^5x_0-8404.
Realizing the x_5 has to be necessarily divisible by 5, we denote the final share that each sailor gets in the last division by s. So our Diophantine equation becomes
5^6s=4^5x_0-8404.
It will have solutions at x_0=3121, 18746, 34371 \ldots= 3121+n5^6 \text{ for } n \in \mathbb{N}_0 .

03/6/15

The Postmodern Man

Wondering through an old town
I saw a sight that made me frown
People running all over the place
With no purpose, but an angry face

Tearing houses in which they dwell
Barking words I can not tell
Breaking mirrors and shattering glass
What an awful fate this has come to pass

They smashed all that could glimmer
Their ugly faces it could mirror
I asked a man what is going on
To the beautiful city of a thousand songs

He stared at me in total confusion
Then said “We lost all truth for an illusion”
“At first it was truth that we were seeking
But lost all hope when we lost all meaning”

“Of many Gods we did create
Then we destroyed and declared their fate”
Of what is sacred we did not respect
Many noble meaning we did dissect ”

“We studied stars with microscopes
Viewed atoms with telescopes

“We uttered word we shouldn’t speak
Turned heaven’s gift into a freak
We’ve broken vows we shouldn’t break
Our existence became a funny mistake”

“Then our hearts turned to dust
Nothing left that we can trust
“God is dead” the man proclaimed
“Man is god, man is great”

“When man is god all is abstruse
What use to him, is now the truth
Of a murky mix he did evolve
In murky chaos he must now dissolve”

“All must be now undone
All hope is lost all meanings gone”
I walked away in disbelief
My heart now filled with so much grief

What tragic end could all this be
For men with eyes but could not see
What strange turns this world does take
When men are stung by a life-giving snake

Logic used to break man’s chains
From chains of logic it should break again
I weep for that post-modern man
Post-modern, postmortem and the world is bland

06/16/14

Reality’s Semblance

Layers of Lies marching in semblance
of an ugly and distorted “reality”

Lives wasted in transience
in false hopes of evidential existentiality

In fear of facing internal emptiness
they blind themselves to possibilities of … humanity

03/7/14

Nepomuk Pains

Recently I ran into a nasty situation on Kubuntu desktop where a host of crucial KDE components would cease to work. Chiefly amongst them were:

  1. No instances of Dolphin would start
  2. The kickoff launcher would not work 
  3. The KDE activity manager was crashing. 

I suspected the Nepomuk might be the culprit and I was right.  I stopped it by running

qdbus org.kde.NepomukServer /nepomukserver quit

I then wiped out its data by running

rm -r .kde/share/apps/nepomuk/

Finally I got it started again by runing

nepomukserver

…and my problems were solved.

Trying to search for a solution to this problem, I found people suggesting that one would wipe the ~/.kde folder and start afresh. That sounded too drastic and a great deal of my customizations would have been lost in the process.

02/6/14

Structural vs. Cultural violence

In Egypt we had a pretty nasty form of structural violence that was embodied in the state’s massive bureaucracy, and web of interests that surround it. It was nasty, inefficient, and very corrupt. The revolution attempted to call for end to that violence and was still taking baby steps in trying to find a more human replacement. The magical eighteen days in Tahrir in early 2011 saw a wonderful experiment where people were trying to create a new reality and a new order, they were trying out new ways of dealing with others…gentler and sweeter ways.

Before anything they were attempting came to fruition, they were faced with cultural violence by Islamists. The Islamists claimed divine authority and were naturally bent on extinguishing all experimentation as they viewed them as silly and futile. They had their perfect ways and had no need for those where reaching out for something nobler…yet without history laden labels or structures of power. The Islamists attempted assimilate the machinery of structural violence in their arsenal of cultural warfare.

As soon as the horrors of their designs became clear to the vast majority of Egyptian, a revolt ensued. Tragically, since June 30th, 2013  no alternative means were found to supplant either forms oppression. One thing is patently clear, most Egyptians would opt for the familiar and impersonal structural violence that they had suffered  for decades, than to give a chance for Islamist cultural violence to run its course…democratic process be damned.

01/6/14

The gods they make

The gods they make capture their fears, their ignorance, and their desire to control.
Their gods share their grotesque outlook, yet they fully capture their aspirations.
Aspirations of dominance, control, and subjugation of others.
Aspirations of meek and mean-spirited human “beings”.
The wretches are blind to human potential!

12/10/13

Why will I Vote a Reluctant “yes” to the Proposed 2013 Constitution

I will be voting “yes” on the next constitutional referendum. It will be a vote with limited enthusiasm and excitement. It comes about from a painful analysis of the sorry state Egypt is now in. My aspirations for a post revolutionary Egypt remain much higher.

My concern is that the alternative to a positive outcome of the referendum are a great deal more grim. The way I see it, we have three options on the menu:

1. A very hard-core Islamist constitution that will be regressive and anachronistic if the MB or their ilk rise again to power…a “no” will make that more probable.

2. The 2012 constitution which already included military trials (the most abhorrent part in the new constitution), but missing out on many of the good points with regards to freedom of belief and minority rights in the proposed constitution

3. The 1972 constitution which gives the president completely unchecked powers. i.e. full regression to the pre 2011 state.

Escaping the sad fate of 1 makes 2 or 3 (or some mix of the two) very likely . I do not see a fourth option. The revolutionary idealists never managed to organize themselves politically over the last 3 years. Beyond making moral statements, and standing for what they believe is right, their sacrifices have been well exploited by many parasites.

The proposed constitution is still a small victory for the civil and progressive camp. A beach head, that I hope they will be able to expand upon later. The alternative is to risk domination by the Islamists, in which case society will come to complete stasis and no progress will be possible except via an all out civil war.  Although the military will continue to play an active role in Egyptian politics in the coming years, with some hard work and a bit of luck we  might be able to gradually contain and limit their influence. With the Islamists our chances of doing that is zero.

image

12/8/13

You Fall!

You fall! You hit the water at high speed. Wet! Shocked! Refreshed! Disoriented!
You emerge! You quickly swim towards your board and get your sail up again.
You learn! The forces acting over you lead to an imbalance. Your actions were not properly calculated.
You  understand! Full control is a myth! The best you can do is make optimal use of the natural forces around to arrive to where to want to go.The direct path is often unfeasible. You can not fight the waves or wind head-on.
You read! The awesome forces that drive you forward and shape the planet; you body that is optimize through millennia for different purposes, but through will and determination you adapt it for totally different purposes.The power of the intellect is magnificent!
You realize! Harmony in flow, motion and action.
You think! You have achieved mastery…..you FALL again.

12/8/13

Real Stress

Taking a break on the approach to the summit, freezing winds howling fiercely, my youthful partner remarks “I am stressed!”. I shot back with some anger and exasperation “This is nothing! There are levels of stress you have yet to experience!”. My partner stares at me, his face ashen cold and with a pained expression asks “But what on earth could be more stressful than this?”. I answer “Watching a noble dream sublimate into nothingness… and digging deep for the will to live…and learning once more to hope again and to dream again”. We continue our accent…silently.

12/7/13

When north was not up

A few days ago, I was having a chat with a friend about how we often depict the motions of the planets following an anticlockwise rotation around the sun. We saw that it is a matter of arbitrary bias and perspective where north is often depicted as being in the direction of the topmost part of the map. Thus if you took spacecraft and flew above the north pool, and from a highly elevated vantage point looked down upon the solar system, you would see Earth, and the planets rotate in an anticlockwise direction. You would, however, perceive things in the opposite sense if you where  to fly southward above the south pole and look down up our solar system.

Dr. Fathi brought to my attention such view of the world,where the north is at the topmost part of the map, is a but a rather recent development. The pioneering Arab cartographer, al-Idrisi depicted the south in the direction of the topmost part of his maps. In that view, upper-Egypt is indeed “higher” than lower Egypt, Europe is “below” northern Africa. I am very curious as when the flip to north being “up” can about and why?

al-Idrisi’s life is a complex and fascinating one. He compiled his major works while at the court of the Norman King, Roger II of Sicily.

Al-Idrisi's_world_map