Showing posts with label Other Observations. Show all posts
Showing posts with label Other Observations. Show all posts

Sunday, March 10, 2013

only bad witches are ugly

The title of this entry is a famous quote from The Wizard Of Oz. Yes, I realize it's awful to spread the idea that goodness is correlated with beauty. But that's not today's topic.

Today's topic is the logic of sets. When a witch says "only bad witches are ugly", which meaning is she communicating in regard to which witches are in which sets? She means that for any witch in the "ugly" set, that witch is also in the set of "bad". This implies that the ugly witches are a subset of the bad witches. Membership in the ugly set is always accompanied by membership in the bad set. Also, any witch that is not bad (good) is therefore not ugly (beautiful); for they could only be ugly if they were also bad.

But the more notable distinction is what the witch isn't claiming about these sets. The witch said nothing certain about whether all beautiful witches are good. All she told us is that each ugly witch is bad. That doesn't contradict the possibility of a beautiful witch who is also bad. Not all the bad witches are necessarily ugly. It's like a deck of playing cards. Each heart is a red card. But that doesn't mean all the red cards are hearts.

In related news, Oz the Great and Powerful has some slow-paced sections that might cause theater-goers' thoughts to wander.

Monday, February 20, 2012

of roots and irrationals

I read a likable proof on Wikipedia about why the roots of an integer must either be an integer or irrational (I'm purposely excluding the complex roots from discussion). Unlike Wikipedia, I'm going to walk through it at an excruciatingly slow pace.
  1. 1) An integer root of a number x is relatively easy to find because the number of integers in a range is limited and powers preserve inequality. Raise an integer to the power. If it's greater than x, then raise a lesser integer. If it's lesser than x, then raise a greater integer. The range of possible integers steadily decreases until the integer root is either found or proven to not exist.
  2. 2) If no integer root exists, then for the sake of argument assume a rational root. Since this hypothetical rational root isn't equal to any integer (those were disqualified as roots after #1), its unique form is an irreducible fraction p divided by q. The fraction p/q would be reducible if p and q had any factors in common. In that case, dividing both p and q by all of those common factors would yield the desired irreducible fraction (or just an integer). Hence, in the final irreducible fraction, by definition p and q have no factors in common.
  3. 3) Raising the alleged rational root p/q to the power is equivalent to raising p and raising q, then dividing the p result by the q result. This is a straightforward application of the facts that the divisions can be rewritten as multiplication by the reciprocal, and then the multiplications can be reordered.
  4. 4) Raising p to a power means multiplying p by p one or more times. So all the same factors of p will be present afterward, but duplicated. To multiply by p is to multiply by all of p's factors. No "new" factors are introduced by raising to a power. Or rather, "Meet the new factors, same as the old factors."
  5. 5) #2 mentioned that p and q had no common factors. But #3 and #4 have shown that raising p/q to the power doesn't help. There wasn't any overlap in factors before, so duplicating the same two disagreeable sets of factors won't yield any overlap either. No matter what power of the irreducible fraction p/q, p and q will continue to have nothing in common.
  6. 6) In order for a fraction to simplify to an integer, the denominator q itself must be a factor of the numerator p. Yet #5 concluded that no powers of an irreducible fraction p/q will produce a fraction with any factors in common between p and q. Therefore no powers of an irreducible fraction can produce an integer. In contradiction with the assumption of #2, p/q cannot be a root of an integer.
  7. 7) Since all non-integer rational numbers must be irreducible fractions, #6 implies that the only possible rational roots can be integers. Integers without integers as roots must have ir-rational roots!
1An efficient way to factor large p or q is left as an exercise to the reader.

Monday, November 14, 2011

Reverse Causality Illusion

I debated whether to mention the Reverse Causality Illusion in my response to the book Willpower, but it was too tangential to merit space in the text and too obscure to describe in five or fewer sentences in a footnote. It's a plain idea with a short definition and lengthy implications. The Reverse Causality Illusion is a proposition about the future that "retroactively" causes changes in the present. It's much more common than it sounds. It underpins the driving narratives that motivate many human actions that are otherwise inexplicable. In a word, it's destiny1. It's willpower's "precommitment" taken to the nth degree.

The strength of the Reverse Causality Illusion depends directly on the realistic treatment of the proposition about the future: adherence to every facet of the proposition. From a proponent's standpoint, the proposition is firmly true. Its part of the future is as irrevocable as the past2. Contemplation of alternatives is fruitless. It's so certain that it repels emotional or intellectual fixation on its likelihood. Anxiety is unnecessary. Dread serves no purpose. Evidence that supports other outcomes has to be inconclusive. Decisions can't contradict it. Impulses that disagree are temporary delusions.

Is this a fatalistic outlook? Definitively. Is it restrictive? Sure, as restrictive as tying Odysseus to the boat mast so he's unable to follow the Sirens. Is it double-think? Yep, since the brain is fighting its thoughts with its thoughts (who gave me the right to order me around?). Is it nonsensical? Perhaps, unless and until someone's actions confirm its accuracy.

Some specimens achieve a still-higher notch of curious self-reinforcement. Whereas lower illusions enforce boundaries on actions and feelings, superior illusions enforce boundaries on doubts. Someone reasons, "The future is fixed but my belief in it is wavering; I should try harder to reassure myself about these facts that are yet-to-come." Essentially the "reality" of a proposition about the future takes precedence over each doubt of it. Thoughts that contradict the proposition are proof that the thinker is mistaken, not proof that the proposition is less likely! Thereby the supposed future can constrict just as completely as the past.

Nevertheless, a judicious Reverse Causality Illusion has its uses, especially for inducing calmness3 or pursuing an appropriate goal. To reiterate, in order for the illusory proposal to push through time in reverse and cause differences immediately, it cannot be weak. A working illusion is vivid and plausible. If it's not feasible or believable, it's too easily interpreted as an ignorable wish or passing whim. Necessary mental revisions or physical adjustments will increase its perceived probability4.

A sturdy illusion isn't enough. Perverse commitment is the second requisite. An internal mind game needs willing players. At all costs, the existence of the illusion must seem independent and indestructible. Regardless of its authorship, it transforms into an objective occurrence that happens to not be tangible. First the brain cultivates the illusion, then the brain obeys the illusion thereafter despite remembering the creative origin. Illogical or not, this strategy is actually consistent with well-known observations. Isolated parts of the brain aren't able to unilaterally sort reality from fantasy or true from false5. Uncritical acceptance is the default effortless response. Sections of the brain can deceive other sections by issuing prophecies.

Of course, the prophecy might be correct. Days ago, I had foretold that yesterday afternoon was the time period of tidying the exterior of my house. I dislike miscellaneous humdrum tasks, but what else could I do? I'd been expecting that event. My sense of annoyance about it had preemptively risen and subsided. I'd released my misgivings about it and shifted my angst to uncertain outcomes. Why should I continue to expend my limited animus on an impersonal and unavoidable circumstance?6

1Reverse Causality Illusion is distinct from normal predictions. Predictions are far less pretentious, bossy, and insistent. Predictions are reasonable guesses which are tied to bounded confidence levels.
2Someone who's learned about Minkowski spacetime may ponder the notion that their whole worldline exists. Past, present, and future are merely coordinates. The future is "there" like the room at the end of the hallway is there.
3With the caveat that strong phobias, persistent depression, or pervasive anxiety require more drastic techniques and/or chemicals. Your mileage may vary.
4For example, in my communication courses I found that the cheery proposition "My next speech will go well" only felt tenable after rehearsing the speech and laying out my phrasing and gestures beforehand. Rehearsal may bother procrastinators precisely because it reminds them of the impending unpleasantness, but why not use a "safe" environment to confront and eliminate the worrisome unknowns of how the speech will go? It doesn't prohibit spontaneity at delivery time. To the contrary, close familiarity with the speech's overall delivery allows for better-informed choices of how to tweak its details freely as the situation warrants or as inspiration strikes.
5The same gullibility affects conscious memory. Oft-repeated or pleasing lies tend to be later recalled as truths, including when the hearer is aware of falsity at the original time of hearing. As the popular saying goes, never let the facts ruin a good story (or conventional wisdom, or common sense).
6I'm dramatizing. My hatred of that category of work is real but not deep.

Wednesday, September 28, 2011

evolution and DRY

Reality may be unintuitive. One instance among many is the evolutionary march that yields complexity from chaos, harmony from cacophony, solution from error. At the timescale of a human life, and applied to everyday objects, such a progression is nonsense. In information-theoretic thinking, the introduction of greater randomness to existent information only degrades it with greater uncertainty or "noise", necessitating a communication code that can compensate by adding greater message redundancy. In thermodynamic thinking, the much larger number of disordered states overwhelm the small number of ordered states. Two gases in one box will mix simply because that's far more probable on average than all the undirected gas particles staying apart in the original groupings. In parental thinking, miscellaneous household items won't land in specific designated positions if children drop the items at randomly-chosen times and locations (a four-dimensional vector governed by a stochastic variable).

Clearly, accurate metaphors for biological evolution are lacking. Humans are justifiably amazed by the notion of entire populations of intricate organisms changing for many millions of years. And the changes are related to numerous shifts in myriad factors, including habitat and competition. It's problematic to transplant prior assumptions into that expansively complicated picture.

But a metaphor from software development might be helpful for contemplating the stunning results achieved by the unpremeditated mechanisms of evolution. No matter the particular need served by the software, a solemn rule of development is "don't repeat yourself", which is abbreviated to "DRY". The intent of the rule certainly isn't the naive claim that no repetition ever happens. To the contrary, the rule is about handling repetition correctly. Following DRY is typing a "chunk" of software just once and then somehow rerunning that solitary chunk on different data whenever necessary. The alternative to DRY is duplication. Duplication is often cheaper at the time of initial development, although it's costlier thereafter: two or more chunks are naturally laborious compared to one.

Besides the long-term savings in maintenance work, aggressive DRY has a second effect. The software is divided into chunks. These divisions and subdivisions are easier to read, understand, and analyze. Organization and interconnections take the place of a flat sequence. Appearances suggest conscientious craftsmanship, independent of any knowledge of the software's developers.

Hence, a DRY-compliant outcome has a tendency to look artificially arranged. Evolution could fall in that category. Obviously, unlike in software development DRY can't be a conscious guideline. Instead, inherent constraints "encourage" DRY to occur. Since normally DNA is strongly resistant to massive change, perhaps outright duplication of a gene across separate strand locations is improbable. Reuse of the original gene in a new context accomplishes an identical adjustment in the organism. The DRY-like modifications of the DNA trigger matching DRY-like modifications to the creature. It appears to be the product of a history that's less chaotic than it really is. Thus phenomena that human brains find comprehensible or beautiful, like symmetry or hierarchical containment, arise from frugal genes. So do displeasing phenomena, like unsightly remnants of a contemporary body part's surprising past. DRY pushes for tweaking existing genes and transforming an existing appendage of little value, rather than partial duplication of existing genes and adding more appendages.

Insistent objectors could aver that the DRY metaphor violates the common sense of the conceptual chasm between thoughtful human software developers and thoughtless genetic mutations and transcriptions. The computer programming languages of typical software are specifically designed to enable smaller chunks. Languages incorporate syntax and semantics. How can that be comparable to the simple streams of codons in DNA? Reuse can't happen without a structure to support it. Pronouns are literally meaningless without basic grammar.

Odd as it seems, the genetic code indeed has a grammar. The fundamental building blocks of grammar are symbols that modify the interpretation of other symbols. Here, "interpretation" is the translation of nucleic acids into working cell proteins. Over time, discoveries have shown how subtle the translation can be. It's affected potentially by a host of activity. Genes definitely can adjust the expression of other genes, which is why geneticists hesitate to assign premature importance to single genes. Some of the "words" in this haphazard language are likely grammatical in impact on protein replication, akin to "and", "or", "not". Some might serve both independent and regulatory functions. Incomplete human understanding doesn't cast doubt on the existence or the capacity of evolution's code. It could very well be able to encode the reuse of sections in accordance with DRY-like conservatism. Just as replacing one word in a sentence might have drastic overall implications, replacing a minimal quantity of genes might have drastic overall consequences that give off the impression of evolution acting smart or informative or experienced.

Wednesday, August 31, 2011

the absent mind

Recently I watched Memento again. I've never owned it but I can watch it via Netflix. No later viewing of it compares to the first, because surprise is gone. Nevertheless the progression of scenes in reverse chronological order is appropriately disorienting as ever.

This time, though, I reacted in a new way. Like an untrained reader who self-diagnoses every disease in the book, I identified with the main character. In my case, the similarity has nothing to do with the inability to form new memories. My memory isn't problematic; based on academic accomplishment, it's above average. No, the similarity is the need to leave reminders for myself. As I watched the movie, I distinctly recall thinking, "Doesn't everyone do that, but on a smaller scale?"

Age can't be the cause. I've been "forgetful" in this way since childhood. The usual driver seems to be having an "absent mind". Some people mock the truism, "Wherever you go, there you are." Those must be the people for whom it isn't a challenge. My thoughts are noisy. Emptying my mind is difficult because sometimes it churns and overflows without prodding. It's as if I'm walking through dreamlike surroundings that are far more engrossing than my real environment. External occurrences can't be guaranteed to leave a lot of impact, during a deep swim in the brainwaves. Of all activities done to excess, theorizing has to be one of the most unobtrusive to onlookers. On occasion, when the train of thought jumps tracks, I'm shocked by the time that's passed. The questions "Where am I?" and "What is the time and date?" are generally unimportant. Depending on which ideas are consuming you, the location of your body and the continual ticking of seconds are totally irrelevant.

Calling it attention deficit disorder would be inaccurate. It's closer to having too much focus or fixation than having too little. And it's also not autism. I tend to have trouble interacting naturally in casual conversation, yet the obstacle is distraction rather than disinterest (I make eye contact although some have commented that I appear to be looking "through" the speaker). My sense is that the low severity of absent mind doesn't qualify at all as a disability. It's a disposition, a personality quirk. As a child, it manifested in toothbrushes left behind after a sleepover or gloves left behind after winter travel from one building's interior into another. The tips for coping aren't too complicated:
  • If something needs to be remembered, but at some point after the immediate moment, make a reminder soon. Otherwise there's the possibility that an intriguing stream of thought will resurface before too long and flood everything else. Don't presume to remember to make a reminder...
  • Reminders don't need to be lengthy, detailed, or time-consuming. Unlike Memento's main character, the hang-up isn't that the memory is completely missing but the high probability that the intact memory won't return to mind at the proper time. All that's necessary is an unambiguous trigger. For instance, the infamous trick of tying a string around a finger is too uninformative, while a note consisting of one significant word could work. One mustn't then misplace or ignore the note, of course. It should be located within normal view.
  • Memento emphasizes routine and the ease of learning repeated subconscious reactions. That fits with my experience. Habits demand less concentration, which is a perpetually scarce resource. Breaking habit is healthy and invigorating, but special effort is called for. To succeed, novel actions require greater levels of deliberation and care. More present, less absent.
  • As in all things, simple strategies shouldn't be overlooked. Startling sensations sharply disrupt introspection. Increased alertness to the world is an automatic side effect of fresh perceptions. Simply keeping your eyes moving might be adequate. Administering pinches is a second tactic, as long as it isn't overdone.
  • Reminders work well for single tasks. Habits work well for routine or periodic tasks. A large list of irregular tasks, perhaps to be completed in the upcoming week, is better attacked by outlining a comprehensive schedule. Without explicit scheduling, there's considerable risk that awareness of the tasks will weaken, only to finally revitalize at an inopportune time. Or that one prominent task will monopolize available energy and mask the rest. Either way, an all-encompassing arrangement of what to do and when is, strangely enough, less of a chore than trying to repeatedly rein in a stampeding brain and urge it toward item by item. I compose the whole schedule, as a draft in progress. Then I think of it whenever I'm pondering or visualizing the time periods in the schedule. Writing or typing it is purely optional (memory isn't the problem, engulfment by my own reflections is the problem). As for an event more than two weeks away, those of us with absent minds act like everyone else. We enter it on calendars.
  • As illustrated by Memento, anticipation is a highly sophisticated approach. Self-knowledge enables self-manipulation. Small adjustments, like temporarily moving objects to atypical positions, can prompt corresponding adjustments in behavior. "Why is that there?...oh, to ensure I don't leave it behind." Unsubtle clues either illuminate the desired path or erect a barrier for the inadvisable path. I in the future am likely to be all right with or without the hints, but the prevention would help in the eventuality of unforeseen internal distractions (e.g. trying to recollect the name of the hidden Elvish kingdom in The Silmarillion, which was one of the last to fall to Morgoth). 
  • Selected undertakings force full engagement, regardless of contemplation's pull. With practice, it's easier to adapt. For example, I've gradually developed my skills at driving and athletics. At work, I'm more conscientious about not drifting off during meetings, and I ensure that all my assignments are written down.
I don't want to produce the wrong impression. I'm not overly burdened by this. A bent toward abstract preoccupation is part of who I am. I realize it's not comparable to serious conditions like dementia, which I wouldn't dare to minimize.

I also recognize that a sound albeit absent mind comes in varying degrees. I've only forgotten my keys when leaving the house once. A while back someone notified me that I was wearing two unmatched shoes. I have a desk drawer that contains a stack of papers with the cryptic markings that result from pursuing a particular flash of inspiration over a few days. It could be worse. Apparently, others have been known to go out in public in partial undress, and their mysterious notes fill filing cabinets...

Friday, August 05, 2011

source code comments and evolution

In judging whether the source code of a computer program has been copied, similarity in the two programs' effects isn't a conclusive exhibit. As long as the programs were both written to accomplish similar purposes or solve similar problems, it's reasonable for the two to behave similarly. The base strategies used by the programs could very well turn out to be not that different at all. When a particular mathematical formula yields the right quantity, other formulas would probably need to be alike in order to also yield the right quantity. (This is why some argue that patents on software, as opposed to copyright of the source code, are questionable and/or unenforceable.)

Although it's not hard to believe that two programs could be created without copying and yet have a resemblance, it stretches credibility to allege that the source code of the two is the same. Human-friendly source code allows for a variety of choices that fall under the amorphous category of "style". Names, extra spacing, units of organization, and so forth distinguish the source code and therefore authorship of two independently-written programs. Still more idiosyncratic are the comments in the source code, which are completely extraneous lines of text that explain the code to readers - including the writer, who will undoubtedly need to return to the code later. It's improbable to see source code with identical details, especially when those details serve no function in the operation of the actual program! One program writer could have used the name "item_count" and the other "number_of_items". One could have included the source code comment, "prevent division by zero", and the other, "avoid a zero denominator". The great freedom that's possible for nonfunctional features of the source code also makes coincidences too unlikely to consider. If these features match, the confident assurance is that the source code is a copy.

DNA is the metaphorical source code of organisms. And like its metaphor, DNA has well-known nonfunctional ("noncoding", perhaps "junk") elements, too. Observations of such elements match across a huge range of organisms. Just as these matches strongly indicate common origins of program source code, the DNA must have common origins. Evolution, in which species spring from other species, is consistent with the observations. Copying is rampant, but at least there aren't any violations of copyright. There can't be; the material is copying itself!

Thursday, March 24, 2011

package delivery tracking can make you sadder

One of the more striking points in How We Decide by Jonah Lehrer is the strong and sophisticated reward/punishment feedback systems of the brain, which people experience as strong emotions. A vital factor incorporated into these responses is expectation. Expected rewards or losses have less effect than the unexpected. Gaps between expectations and reality make the difference. An unexpected windfall of $20 feels good. A lackluster gain of $20 for an expectation of $40 feels bad.

Hence compulsive usage of online package delivery tracking is unlikely to leave the user happy about being well-informed. Each time the user checks the tracking, the expectation is "delivery has progressed since the last time I checked". If the result matches that expectation, the user feels a burst of reward stimulus; in fact, that experience may "hook" the user into compulsively checking again a short time later. If the result doesn't match that expectation, the user feels a loss despite the delivery happening precisely on schedule! The tracking falls into the category of long-term planning with intermittent milestones. If I'm interpreting the book's advice correctly, the better way to make decisions in this category is with reason, the prefrontal cortex. Logistics is more of a math problem ("A delivery truck embarks at 5:00 AM on a 200 mile trip going the posted speed limit, when should it arrive?").

Also, the tracking creates a subconscious illusion of control. Like the sports fan who cheers the home team playing on TV, mere observation is clearly powerless to affect the outcome. However, each time an observation yields a favorable outcome, the brain "learns" that observation is a good tactic. Of course, we know that watching the pot of water won't make it boil, and reloading the tracking Web page won't make a sophisticated transportation network run according to design. This is why someone should resist the temptation to check the package delivery more than twice per day. That's a setup for disappointment and less happiness over time. For some people, a three-week delivery with no tracking at all may actually be more pleasing than a three-day delivery with tracking. ("I forgot this package was on the way. What a nice surprise!")

Monday, November 01, 2010

a bad statistics joke

Since I recently posted something with a statistical lean...

I recently encountered the statement: "Why be normal? No one else is."

And all I could think in response was: "Why be within one standard deviation of the mean? Only 68% of the population is, assuming it to be normal."

Saturday, October 30, 2010

statistical inference and racism

Up-front disclaimer: None of the following should be construed as supporting racism. If anything, my point is that racism is as shaky intellectually as it is morally. It's simply wrong to unfairly treat an individual based on indirect inferences from their similarities to a particular race (or ethnicity, gender, religion, etc.). I also apologize up-front for offending statisticians.

It occurred to me, as it doubtless has to others, that racism has some connections to faulty statistical inferences. Of course, I don't mean that the typical racist is computing actual statistical regressions, but that part of their error consists of an "intuitive" misunderstanding that would appear unsound if it was quantified and written out. And naturally, the inability to estimate correct conclusions about probability and statistics is present in any untrained person, not just the racist one.

the instrumental variable

I've heard people aver that, since racial discrimination has continued to decrease, race should no longer be considered a determining factor in people's lives. While this is a happy thought, it naively misses a crucial aspect: (direct) discrimination is not the only way that racism acts.

Assume a statistical model or equation in which race and discrimination aren't present. It could be for any personal outcome like educational attainment, as long as race isn't included in the model's variables. Essentially, the mathematical equation expresses a complete lack of obvious relevance and causation between race and the outcome. Discrimination doesn't even enter the equation, as we posited.

Now run a thought experiment on our model. Suppose we apply the model to randomly selected people, i.e. we grab the info for each person and then calculate (not measure) the outcome with the model. Further suppose that we also record each person's race. Then we find, as in reality, that when we partition the calculated outcomes by race, the distribution is drastically and consistently different. How can this be? Race wasn't one of our variables, because without outright discrimination it had no mechanism of causation.

The answer is that, in this hypothetical model and thought experiment, race could still act as an instrumental variable. Roughly speaking, race is correlated with the outcome through the model variables. For instance, in a model of personal income, it's highly reasonable to have the parents' income as a variable. Although the model may leave out "race", race can nevertheless affect personal income (the outcome) as long as it affects the parents' income (the modeled variables). Thus race can be a cause of an outcome despite not being a "cause".

Moreover, race is likely to be an instrumental variable for an array of models, and all the models are likely to be related too. Bad (or missing) education tends to lead to low-paying employment or unemployment, which tends to lead to poverty, which tends to lead to crime, which tends to lead to low property values and taxes, which tends to lead to low school funding, which tends to lead to bad education. Regardless of whether there's a blatant racial barrier presently at work, the long-lasting "fingerprints" of racial differences may be active (e.g., systematic segregation sometime in the past that restricted access to the same set of opportunities).

the overeager Bayesian

Stereotypes are simplifications by nature. Sometimes a stereotype can be a helpful mental shortcut, but often it doesn't reflect the most accurate concept of a "typical" sample from a population. This is notoriously true of racial stereotypes that highlight the worst representatives.

For compared to a proper Bayesian analysis, "reasoning" by a stereotype is overeager to apply shaky conditional probabilities. Consider a very hypothetical population with only two races that are each 50% of the population. 10% of the entire population has an undesirable characteristic (left unnamed). Of the people in the entire population who have the undesirable characteristic, 75% are of race A. Whenever someone in this population is of race A, what is the probability of having the undesirable characteristic?

When it comes to a stereotype for the undesirable characteristic, chances are the stereotype is of race A due to prevalence within that subgroup. So the stereotype would tend to override the right Bayesian answer, 7.5%, with a much greater probability that overlooks the facts that 1) only 10% of the entire population has the undesirable characteristic at all and 2) therefore 85% of race A does not have it.

Saturday, March 20, 2010

one more way that DST can be confusing

1. Someone logs an instant in time before DST starts and dutifully includes the offset from UTC to avoid ambiguity.
2. After DST starts, the same person in the same location reviews the logged times by a systematic procedure: a) converting the logged times to UTC according to each time's recorded offset and b) converting the UTC time to local time using the current DST offset.

Presto! A time that was frozen in history a month ago has now "changed". "I don't remember doing that during my lunch hour..."

Tuesday, January 20, 2009

algorithms everywhere

I have a simple (*mumble* cheap) portable music player that allows file organization through one mechanism: unnested subdirectories listed alphabetically under the root with files listed alphabetically in each. I started pondering the best way to divvy out subdirectories and files to reduce searching time. The number of subdirectories ideally should be small, so it takes less time to select the desired subdirectory. But the number of files within each subdirectory ideally should be small as well, so it takes less time to select the desired file after selecting the subdirectory.

To cut the self-indulgent story short, I ended up reading about B-trees on Wikipedia. However, since this application has a maximum depth of one, a B-tree would be inappropriate. Yet I was sufficiently inspired to come up with my own set of insertion algorithms based on a subdirectory minimum of 5 files and a maximum of 10 files (in passing, note that these parameters meet the B-tree criterion that a full tree/subdirectory can split evenly into two acceptable trees/subdirectories).

Some might say that it's ludicrous to approach this task in this way, given that I "executed" the algorithms by hand inside a file manager in lieu of writing any code and the low-capacity music player contains less than 300 files. Thus, I lost time by analyzing the problem via a theoretical lens and formulating a general solution. I'm practical enough to acknowledge that reality.

My point is that algorithms and data structures are everywhere if one has the right perspective. And this is not strange compared to other specialties. Artists see lines and shapes and visual patterns that I wouldn't notice unless someone told me. Mathematicians see quantitative relationships (or more abstract stuff - as in abstract algebra sometimes drives me nuts). I could list numerous examples like doctors, lawyers, mechanics, architects, psychologists who all see aspects of their surroundings differently than me.

This is the part of vocational training that's hard to teach: to mold one's mind until the subject matter is a familiar mental frame or toolkit. The reason that professional software developers should study the "Computer Science-y stuff" is so that they can recognize and organize their thoughts, thereby avoiding the trap of attempting a solved problem or attacking it in a naive manner. They don't need to memorize what they can find on the Web or in a book, but they need to know enough to comprehend and adapt what they find!

Saturday, September 13, 2008

you might be a Myers-Briggs INTP if...

...your immediate response to "INTP" isn't a variant of "What the...?" but "That one's easy: int pointer!"

If you then go on to start musing about how the INTP enforces the type of its referent, and how it handles overflow, well, there's even less doubt...

Friday, March 28, 2008

a link to the past

Discovering Delphi. Just marvel at its design sense.

I found the link on the Object Pascal entry at Wikipedia. I arrived at that entry after noticing that Delphi is in the top 10 at TIOBE.

Monday, March 17, 2008

life is a metaphor for video games

It happens to me every time I pick up a quick lunch from a fast-burger franchise. I think "hey, this reminds me of Monolith Burger....hee hee hee". Then when I go back to my cubicle, I think, "hey, this reminds me of the cubicle maze on Pestulon, but that one had people walking around cracking whips". Then when I go home and watch some show that has killer robots, I think, "hey, this reminds me of being hunted by Arnoid".

And at that point I'm quite grateful that in my everyday life making one little mistake won't result in bloody death or encasement in lime gelatin.

Monday, March 10, 2008

futilely confronting the foolishness of crowds

This isn't a news flash to anyone I suspect, but it can sometimes be incredibly frustrating to publish an acute comment or reply online (or offline). Once some people feel that they're under attack, they will proceed to strike back at the comment or reply however they can: mod it down, ridicule it, counter it with irrelevant nonsense, etc. In any case, they don't seem to bother trying to comprehend the point it's making, or if they do then they still feel obligated to chivalrously "defend the honor" of banner foo. I've found that even if the tone is mild and evenhanded and all of the supporting axioms are undeniable, the same outcome can happen. The possibility of a moderate thought is simply crowded out by the sacred cows and cargo cults. How dare anyone attempt to offer a novel perspective! Evolved pack cooperation be damned, let's go back to competing dominance displays!

When I'm in a philosophical mood such situations often remind me of what Kris Kringle says in Miracle on 34th Street to explain why he purposely failed the mental examination after Dr. Sawyer the peevish company psychologist committed him to an asylum:
Oh, it's not just Doris. There's Mr. Sawyer. He's contemptible, dishonest, selfish, deceitful, vicious...yet he's out there and I'm in here. He's called normal and I'm not. Well, if that's normal, I don't want it. That's why I answered incorrectly.
When I'm in an impatient mood such situations merely make me want to yell "Doesn't anybody notice this? I feel like I'm taking crazy pills!"

Friday, December 28, 2007

resolving the question of new year resolutions

Dreaming up resolutions for living better in the coming year is one of those many cultural rituals which are simultaneously well-intentioned and pointlessly arbitrary. The drive to improve oneself isn't the pointless or arbitrary part. The pointlessness stems from a few other facts.
  • The point of completion of another solar revolution could be set anywhere in a cyclical calendar. A year is an additional numerical designation applied to the calendar to preserve a linear (or sinusoidal, because each year is a cycle?) reckoning of time. In other words, the switching of the year is like going from 19 to 20. Oooo, the "1" changed to a "2". How fascinating. Who are the people obsessed with "boring numbers" now? (Of course, time isn't perfectly linear, but under the circumstances most of us operate in, this assumption is accurate enough.) Just as a new year could be started at any time in the calendar, new resolutions could be started at any time in the calendar.
  • Similarly, the passage of time which occurs as one year ends and another begins isn't at all unique. Someone looks about the same a day before and a day after his or her age changes, tattoos or hangovers notwithstanding. When the "calendar's birthday" happens, the interval of time that has passed isn't a year; it's a day. Days change...daily. Celebrating the passage of mere time is an odd exercise when time is always passing. We're always waving farewell to the past and planning for the future. If a person thinks of a new resolution on Dec. 22 and waits until Jan. 1 to do something, which is more significant and concrete: the action the person took on the "magical" first day of the new year, or more than one week's accumulation of days of inaction?
  • From the standpoint of results ("metrics", if you want to annoy people), resolutions are not enough. This isn't news, but that won't stop the news from producing several fluff segments about it. Traditionally, people make resolutions, attempt to follow the resolutions, fail, and perhaps try again the next time the digits of the year increment. For claiming to be a civilized society of knowledge workers in the information age, this approach is remarkably careless. Although an inspiring goal is vital for the sake of motivation, resolutions should include other items: sub-goals/milestones, plans, contingency anticipation (you don't expect the universe to cheer you on, do you?), rewards, punishments, support, recognition of difficulty. Moreover, if someone isn't willing to "bother" with such details, that may be a sign he or she would truly prefer for the resolution to remain in daydream-land, where valuables have no cost.
  • Some excellent character-based humor has come out of the tendency for people to overlook their greatest flaws as they form resolutions about comparatively trivial minutiae. We shouldn't be surprised. Personal qualities often serve as both strengths and weaknesses, leading people to think the quality is no problem, or to think the people around them are the ones with problems (isn't marriage challenging?). And as for the flaws people are oblivious to...would they still have them if they were aware of them? A pivotal change to one's path requires a clear view of where someone currently is. Before drawing up new year resolutions, perhaps one should spend time considering Who is responsible for past failures? Who is standing in the way? Who is the saboteur? One might find the unpleasant answer by looking himself or herself in the I.
  • Furthermore, after deciding on a resolution, the plausibility of the resolution bears evaluation. Without extreme tactics (think of those who talk about "breaking down newbies to rebuild them"), sustainable behavior modification happens slowly and gradually. In my opinion, not everyone is capable of every behavior, doing every action, developing every habit. Bodies differ. Genes exert limits and tendencies. Within those parameters, dedication can accomplish a lot, yet some resolutions are, realistically-speaking, improbable to impossible for some people. Don't let failure to reach an implausible or impossible goal steal the satisfaction of doing something worthwhile. Readjusting the resolution is still preferable to trashing it.
To the extent I have a resolution for the new year at all, it would be to act on the good intentions I had during the past year. That should keep me busy.

Tuesday, December 18, 2007

seriously, two movies based on the Hobbit?

According to the official Hobbit movie blog, two movies will be shot simultaneously, with Peter Jackson as one of the executive producers. Also, speculation is rather pointless right now, considering the hoped release dates are in 2010-2011.

Overall, this seems like good news to me. A good adaptation of Hobbit has been a long time coming. But I never thought two movies would be necessary. LOTR is usually sold as three books, and each book is dense. I've always considered Hobbit to be the "gateway drug" for LOTR: less intimidating, generally not as potent/complicated (look, fewer subplots!), and hints of what the heavier stuff is like. Looking back at how the adaptation worked for LOTR, massively cutting here and adding there until we had three long movies (longer if you opt for the extended DVDs), I'm worried what will happen this time around, when the problem is reversed: not enough story for two movies. Will it turn out like King Kong?

Yet another problem will repeat itself for the screenwriters: the choice of which scenes belong in which movie. In retrospect, Two Towers may have been diminished because of the parts that shifted to Return of the King. I'm curious where the dividing line will fall for two Hobbit movies. The book's sense of scale shifts toward the end; onward from when Smaug appears, the book is suddenly no longer about just Bilbo and dwarves, but disagreements between peoples culminating in a Battle of Five Armies. Cut the story off too soon, and the first movie won't have much of a climax to speak of. Cut the story off too late, and the second movie won't have much plot left to cover at all. This should be interesting to observe.

Wednesday, November 28, 2007

drop the superiority complex

I know, easier said than done, and I fall into this more than I should...

Neither career nor talents grant anyone the authority to degrade everyone else. On a website aimed toward computer technology professionals but on a non-tech topic, I just read an ugly comment stating (in different words) the unlikelihood of a previous commenter having anything valuable to say to "people who think for a living". I'm not surprised or bothered by attacks on basic credibility; disagreement without acrimony would be the real anomaly. What makes me cringe are the haughty assumptions behind the statement:
  1. People who work on computer technology think for a living.
  2. Others, like the statement's victim, don't think for a living.
  3. "Thinking for a living" is a qualification for having worthy opinions to express.
I won't deny that strong aptitude for logical/analytical thought, as used by people to successfully work with computer technology, is rather atypical. I won't deny that deep knowledge in a particular subject domain such as computer technology allows that person to not be as easily confused by casual problems in that domain. I even won't deny that the requisite intellectual capability should be an important factor in decisions for career and education.

However, people who don't fall into those categories can still make coherent, valid points. They may be smart, clever, and accomplished. Their problem-solving skills and ingenuity may be impressive. They may have a wealth of skills for human interaction (which would be foolish not to learn from). The striking creativity they may exhibit is partly why they want PCs at all. "Thinking for a living", as opposed to dumb repetitive labor like ditch-digging, encompasses many options beside working with computer technology.

I know people who either can't do my chosen career, or don't want to. That doesn't make them inferior. After all, the fact that I may not be able to succeed in their careers, or want to, doesn't make me inferior to them...

Friday, September 21, 2007

good-bye Alex

I was emotionally affected by this more than I would have expected: Alex the intelligent parrot has died. Similarly trained apes and dolphins can do the same mental tasks, if not more, but it was always amusing to experience a real "talking animal", which is a quite common occurrence in fiction. Debates about the true nature of how Alex's abilities operated strike me as hollow, but then again I lost interest in scientific psychology years ago. One of the firmest conclusions about intelligence that have come out of AI is that "common-sense" reasoning is the end result of many data items and training sessions, so the boundary between "thinking by rote" and "higher-level cognitive functions" may be mushier than we humans care to admit.

Friday, August 10, 2007

abstract algebra sometimes drives me nuts

The problem with learning new abstractions is that, from then on, the abstractions have the infuriating tendency to crop up everywhere. All someone must do is take a concrete idea, throw away some information, and recognize what's left. Applied geometry has some trivial examples. To compute a geometrical property of a ball, throw out such facts as: what color it is, the store it came from, its texture. Recognize the shape that's left, a sphere, and apply the geometrical formulas for spheres. There's nothing exotic about this process.

However, because shapes in the real world are so complex, geometrical abstractions don't break into my thoughts too often. Abstract algebra is worse, perhaps because its abstractions have minimal assumptions or requirements: sets, mappings, operations, groups, rings. Mathematicians and scientific theorists explicitly apply these concepts all the time, if only for classification.

But I don't want to keep thinking along those lines in everyday life. Specifically, I was thinking about changing the days of the week I water a plant, so the same number of days passes in-between. Right now I water on Monday and Thursday, leaving one gap of two days and another gap of three days. (Yes, I realize this problem is most likely not worth the mental expenditure I'm describing--but what are hobbies for?). Mentally starting at Wednesday, I counted in three day increments until I reached Wednesday again...

...and after I was done I went on a long tangent looking up information about the cyclic group Z7, merely one in this list at wikipedia, but also an important group because it is a simple group. By associating each day of the week with an integer in the range 0-6 (like 0 := Sunday and then assigning progressively greater numbers in chronological order), and setting the group "multiplication" operation to be plain addition followed by modulo 7, the days of the week match that group perfectly. Although people might be a bit bewildered if you mention multiplying Monday by Friday (or Friday by Monday, abelian, baby!) to get Saturday [(1 + 5) modulo 7 = 6].

This group has no nontrivial subgroups (the trivial subgroup is just 0 alone, which is useless because I must assume that time is passing and I must water the plant more than once!). The lack of subgroups implies that no matter what interval of days in the range 1-6 I try, I'll end up having to include every day of the week in my watering schedule!

I mentioned before that I tried 3, which is Wednesday according to the mapping (isomorphism, whatever). Three days past Wednesday is Saturday [(3 + 3) modulo 7 = 6]. Three days past Saturday is Tuesday [(6 + 3) modulo 7 = 2]. Three days past Tuesday is Friday [(2 + 3) modulo 7 = 5]. Three days past Friday is Monday [(5 + 3) modulo 7 = 1]. Three days past Monday is Thursday [(1 +3) modulo 7 = 4]. Three days past Thursday is Sunday [(4 + 3) modulo 7 = 0]. Finally, three days past Sunday is Wednesday [(0 + 3) modulo 7 = 3]. The cycle is complete, but all I have is the same group I started with--the entire week!

I'm not sure what's worse: that all this pondering about abstract algebra didn't lead to any useful insights, or that I got caught up in doing it. I don't know how I manage to get anything done. Ghaah, I can be so nerdy even I can't stand it...