Previous Up No next

Diary, March 1997


 Sun Mon Tue Wed Thu Fri Sat

                           1
   2   3   4   5   6   7   8
   9  10  11  12  13  14  15
  16  17  18  19  20  21  22
  23  24  25  26  27  28  29
  30  31

Tuesday, March 4, 1997

Power sets in TM

TM is a specification language for databases. And it being a specification languages, it is implementation depended. For this reason it also has constructs whose calculation may not terminate, or which may give infinite results. TM does have predicate sets, thus in order to write a method which returns the power set of a set of integer, you simply write:
    power(in s : P int, out P P int)
    = { ss : P P int | ss subset s }
An abstract machine, which can interpret compiled TM specifications has been made, but it does not (yet) support predicate sets. Which means that expressions like the above cannot be executed, and result in a run-time error.

Normally, when you want to generate a power set of a set, you use a recursive procedure, which picks an element from the set, and generates the sets with and without that element. But, in TM, being a true specification language, sets are sets, which means you do not have an operation to pick an arbitrary element. (You can split sets based on a criteria, and return the element of a set which contains exactly one element.)

I had almost come to the conclusion that there is no elegant specification of a power set (not using the predicative set), and was explaining this to one of it designers, when I suddenly saw the solution:

     power(in s : P int, out P P int)
     = { s } union unnest (collect power[self](s minus { e }) for e in s)
(The [self] is needed because it is an object method which needs to be applied to some object, as TM does not (yet) have functions.) This is a very inefficient way to generate power sets, as the power method is called about n! times, where n is the size of the set.

The reason why I did not see this solution at first, is because I am more of a hacker than a specifier. The method has acceptable performance for sets up to 6 elements, but larger sets become problematic.



Thursday, March 6, 1997

A silly riddle

The following riddle was posted by Paul Dietrich on
rec.puzzles: He also remarked: logic isn't everything.

The analysis by Matt

An interesting way of phrasing the question. As I look in my dictionary (Webster's New World Dictionary - 1990) it lists as the definition for exit
  1. an actor's departure ... probably does not apply here
  2. a going out; departure ... doesn't make sense
  3. a way out
from the statement of the problem: "You are in a concrete room, <with> no exits." and definition (3) you get "You are in a concrete room, <with> no ways out. [snip] How do you get out?" Regardless of the existence of the table and mirror or if you happen to be Superman, you cannot "get out" in the traditional sense. You cannot be rescued, summon a magical portal or "outlive" the cage you are in as each of these would constitute a way out.

So what is left? To begin, the meaning of "exit" probably either means "obvious exits" or "traditional exits" with the understanding that, "Hey, if you don't figure out some trick, your gonna be stuck here for a long time."

Making the somewhat rash assumption that I am NOT Superman, I look up the word 'table'.

table:

  1. orig. a thin slab of metal, stone, etc. ... I guess I could use to this try and bash my way out.
  2. a piece of furniture [snip] ... this is the obvious interp.
  3. a systematic list of details, [snip] facts, figures ... now this shows some promise (if the table happens to be a list of when a wormhole will open up next to you)
  4. any flat horizontal [blah blah blah]

The definitions of 'mirror' and 'you' give little help. 'Out' has more definitions than I care to type here. So what's left beyond this? Puns I guess.

How do you get out? Place the mirror on the wall, thus my image is "out" of the room, and turn the table on it. Or ignoring the other conditions of the question: How do you get out? Three strikes, for example.

The question can be assaulted logically. "You are in a room with no exits." - "No, I am not." - "Pretend for a moment, [snip], how do you get out?" - "I am pretending that I can teleport." I doubt, however, that this is what was intended.

Are we done? Not remotely! We can define ourselves to be out and the rest of the universe contained within the box. We can suggest that though the walls are concrete, they are wafer-thin. We can also appeal to literary characters (as I am obviously Alice, I step through the looking glass).

Many more possibilities spring to mind. Is there some context to this question? Is this, for example, part of a game where additional information would narrow the search for answers?

The answer by Yos

How about, look in the mirror, you saw your image, take the saw and cut the table in half, two halves make a whole (hole), climb through the hole to exit.

I heard this when I was a kid. Matt, lighten up a little! You took all the fun out of the question with your logical answer.

The answer by Jaybird

Here's my answer: Look in the mirror to see what you saw. Take out the saw, and use it to cut the table and form a bat. Take three swings at nothing. Three strikes and you're out. Remember, wherever you go, There you are.

Asperger Syndrome

The following questionnaire was posted by Hubert Cross under the subject: Are you lonely? in uk.religion.christian. I have added my answers in italics.
  1. Have you never been able to make and sustain friends? (No. I am married right now.)
  2. Do you have difficulty recognizing people's faces? (No, but remembering their names.) or Do you have an excellent memory? (No.) Can you do complex math in your head? (Yes.) Can you visualize complex structures and their relationships in your mind? (Yes.)
  3. Were you constantly teased and tormented by other kids at school? (Often. And the strange thing was that often I was completely aware of what was happening, but not being able to respond.)
  4. Have you seldom or never been able to get a date? If you are in a relationship, it happened almost "by accident"? No long friendship and no romance? (Friendships often, but most of the time nothing further.)
  5. Are you very good at computers or engineering, but poor at social relations? (Definitely.)
  6. Do you not look at the eyes of the other person when talking to him/her? (I have learned to do this. And sometimes I still find it hard to look people in their eyes.)
  7. Do you have few and narrow interests or hobbies, and sometimes become obsessed with them? (Yes.) Do you like to collect things or keep your possessions clearly categorized and listed? (Slightly.) Are routines very important for you? (No.)
  8. Are you a loner? An outcast? Do people sometimes call you "eccentric", "strange", "weird", or even "nut" or "crazy"? (In the past yes, not anymore.)
  9. Do you have a tendency to fantasize and speculate? (Yes.) Do you spend a lot of time in inner retrospection? (Yes.)
  10. Do other people's feelings go 'over your head'? (Sometimes.) And even if you do notice them, do you still feel at a complete loss with how to act when they show some deep feelings? (Yes.) Do you feel incapable of showing compassion? (Sometimes.)
If you answered "yes" to most of the questions above, you are likely to have Asperger Syndrome, Hubert writes. Based on my answers, and what I read about it, I do not believe I suffer from this syndrome, or else not anymore. But it did remind me what I wrote about the movie `Rain Man' a year ago.

(follow-up)

Programming aptitude test by John Graley

Time allocated: 1 hour. Or maybe 2.
  1. (5 points)
    Explain why "too many cooks spoil the broth" in terms of the effect on efficiency of allocating more than one person on a particular (manual or intellectual) task.

  2. (5 points)
    Explain how it is possible for a single wrongly set overload circuit breaker to cause a power cut affecting half of America.

  3. (5 points)
    Assuming you know nothing of the specialised field of time travel, say as much as you can about how you would make such a machine (this question is not oxymoronic; you need to (a) say anything you can say with certainty and (b) say how you might cope with the things you don't know about).

  4. (10 points)
    Choose any form (eg inland revenue, insurance claim, marketing survey etc). Now, analyse the form, and try to "improve" it as much as you can. You decide what is "better". Give details of the improvements you made.

  5. (15 points)
    As you probably already know, a quadratic can be solved using the "completing the square" method. For example:

    I want to solve x^2 - 4x + 3 = 0 <---- the quadratic

    STEP 1: Note that x^2 - 4x + 4 = 1
    STEP 2: Note that ( x - 2 )^2 = 1
    STEP 3: Note that x - 2 = -1 or 1
    STEP 4: Note that x = 1 or 3       <---- The solution
    
    Using this single example as a guide, you must derive, and prove (or at least argue for) an equation to solve all quadratics of the form ax^2 + bx + c = 0. Hint: start by normalising a to 1.

  6. (10 points)
    Rewrite your quote, above, in as few characters as possible, whilst keeping it meaningful and in English.

  7. (10 points)
    Do 6/ again, but this time you can use your own codes, language etc, as long as you provide a key, which is meaningful in English. See if you can get to less characters than your answer to 6/ including the key.
End of exam.

The points indicated are as an effort guide only. I will not be marking any exams, as this seems like a sure way to start a flame war.

Cheers, John


Tuesday, March 11, 1997

Hale-Bopp

Yesterday evening, I saw the comet
Hale-Bopp for the first time, and I immediately took two pictures. One with a 400mm lens (actually a 200mm lens in combination with a 2x convertor) and a 1000mm lens (actually a 500mm lens in combination with a 2x convertor). The sky was not completely dark, due to street lights and such. I just guessed the exposure times, and have no idea how the pictures will look. They might be too dark, or too light. But at least I can say I took a picture of it.

(follow-up)


Saturday, March 22, 1997

Spring

Yesterday, spring officially started. Last night it was freezing, but today we did have some sunshine. In the past weeks the weather has been more the fall, then like spring time. Nevertheless, the little lambs are born, and the trees are sprouting. We bought the first strawberries.

Spring in my heart

Last Thursday, I was filled with a feeling compared to that which you can have on the very first warm day in spring, when you suddenly realize you had forgotten how nice a warm spring day can be. I had the feeling, as if suddenly my inward eyes were opened, making me realize I had been too much walking on the grey side of life. It was as if I was lifted up after being creeping on the ground for a long time. Or should I describe at as suddenly discovering that I can do something, I knew I could do.

(follow-up)

Hale-Bopp

The pictures I
took, turned out to be too dark. I do not know, whether I will give it a second try.


Home | February 1997 | April 1997.