User:Francis Tyers/Maths

From Apertium
< User:Francis Tyers
Revision as of 14:28, 22 September 2012 by MattOates (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
i = 0;
for(n = 0; n < 10; n++)
{
  i = i + i;
}


Kronecker Delta and Iverson Notation

The Kronecker Delta function below allows you to transform logical expressions into 0 and 1 integer values available for summing over sets, or for removing terms from an equation where you multiply a given term by the delta to keep it in or not dependent on some logical restriction.

In computer science this function became so useful for expressing algorithms it's frequently described using a more lightweight and intuitive notation called the Iverson bracket popularised by Kenneth E. Iverson. The Iverson bracket is similarly defined as the Kronecker Delta:

Imagine we wish to count the total number of instances of "the" in an array of words from a piece of text:

count = 0
for word in words
    count += 1 if word == "the"
print count

With Iverson bracket notation we would write this thusly:

let W be a set of sequences of characters from the English alphabet
let c be the sum of sequences w that are equal to (t,h,e)