introducing pick elt

So, we are slowly trying to work towards what humans do. eg, the plurals, the easy definition of close relatives and so on. Today, random greetings. Makes use of merge-labels() and pick-elt. First, let's introduce pick-elt.

The definition of pick-elt is simply, given a superposition randomly return a ket in that superposition. Currently it is unweighted. ie, there is no bias in choice of ket. It is probably useful later to define a weighted pick-elt.

Anyway, a pick-elt example:

sa: pick-elt (|a> + |b> + |c> + |d> + |e> + |f> + |g> + |h>)
|e>
where dot "." in the console means repeat last computation.
sa: .
|a>

sa: .
|c>

sa: .
|h>

sa: .
|g>

So that should be clear enough. Each time it randomly picks kets.

I guess I should also note that it preserves coeffs:
sa: pick-elt (10|a> + 3.141592|pi> + |fred> + 7|cats>)
7.000|cats>
sa: .
7.000|cats>
sa: .
10.000|a>
sa: .
7.000|cats>
sa: .
3.142|pi>

And I suppose you could say pick-elt has a little similarity with the idea of wave-function collapse in QM. Just a little. Indeed, for the QM case you would need a weighted-pick-elt.
eg, Schrodinger's cat in BKO might look like:
sa: is-alive |cat> #=> normalize pick-elt (0.5|yes> + 0.5|no>)
-- ask if the cat is alive?
sa: is-alive |cat>
|no>
sa: .
|no>
sa: .
|yes>

where "normalize" sets the sum of the coeffs of the superposition it is applied to to 1.
eg:
sa: normalize (3|a> + 10|b> + |c>)
0.214|a> + 0.714|b> + 0.071|c>

And that's about it for pick-elt. Very useful all over the place.


Home
previous: learning plurals in bko
next: random greetings in bko

updated: 19/12/2016
by Garry Morrison
email: garry -at- semantic-db.org