2010-12-18

Wikileak Rap News

Perm url with updates: http://xahlee.org/funny/wikileak_rapnews.html

Wikileak Rap News

Xah Lee, 2010-12-18

Great video satire.

〈Rap News 6 - Wikileaks' Cablegate: the truth is out there〉

See: Wikileak: US Diplomatic Cables Leak.

Was this page useful? If so, please do donate $3, thank you donors!

emacs html6 mode

Perm url with updates: http://xahlee.org/emacs/elisp_html6-mode.html

Emacs Lisp: html6-mode

Xah Lee, 2010-12-18, 2011-05-16

This page shows a very simple exmple of writing a major mode for emacs.

I suprised myself. In about 10 minutes, i whipped up a html6 mode. lol.

Here's the html 6 spec: HTML6: Your JSON and SXML Simplified.

Here's html6 mode source code:

;;-*- coding: utf-8 -*-
;; xah-html6-mode.el -- Major mode for editing html6.
;; http://xahlee.org/comp/html6.html

;;; HISTORY
;; version 0.1, 2010-12-17

(setq xah-html6-keywords
      '(("〔\\([^ ]+?\\) " . (1 font-lock-function-name-face))
      ("「\\([^ ]+?\\) " . (1 font-lock-variable-name-face))
        ("“\\([^ ]+?\\)”" . (1 font-lock-string-face))
        ) )

(define-derived-mode xah-html6-mode fundamental-mode
  (setq font-lock-defaults '(xah-html6-keywords))
  (setq mode-name "HTML6")
  )

(provide 'html6)

Here's how it colors:

?xmlversion1.0” encoding “utf-8”」〕
〔feedxmlnshttp://www.w3.org/2005/Atom” xml:base “http://xahlee.org/emacs/”」

  〔title Xah's Emacs Blog〕
  〔subtitle Emacs, Emacs, Emacs〕
  〔linkrelself” href “http://xahlee.org/emacs/blog.xml”」〕
  〔linkrelalternate” href “http://xahlee.org/emacs/blog.html”」〕
  〔updated 2010-09-19T14:53:08-07:00〕
  〔author
name Xah Lee〕
   〔uri http://xahlee.org/〕
  〕

  〔id http://xahlee.org/emacs/blog.html〕
  〔icon http://xahlee.org/ics/sum.png〕
  〔rights © 2009, 2010 Xah Lee〕

  〔entry
title Using Emacs's Abbrev Mode for Abbreviation〕
   〔id tag:xahlee.org,2010-09-19:215308〕
   〔updated 2010-09-19T14:53:08-07:00〕
   〔summary tutorial〕
   〔linkrelalternate” href “http://xahlee.org/emacs/emacs_abbrev_mode.html”」〕
  〕
〕

For a detailed tutorial, see: How To Write A Emacs Major Mode For Syntax Coloring.

Using Unicode in HTML Attributes

Perm url with updates: http://xahlee.org/js/unicode_in_html_attributes.html

Using Unicode in HTML Attributes

Xah Lee, 2010-12-18, 2011-01-23

Discovered that you can use unicode in your html tag attribute values. Here's a sample html:

<html>
<head>
<title>Unicode in HTML Tag Attributes</title>
<style>
p.ฮฑ {color:red}
</style>
</head>
<body>

<p class="ฮฑ">yay!</p>

</body>
</html>

In the above, notice the greek alpha ฮฑ character, used as attribute value.

Here's the page you can see the above source code rendered: Sample Page of Unicode in HTML Tag Attributes.

This works in all latest versions of Firefox, Internet Explorer 8, Google Chrome, Safari, Opera, on Windows. (as of 2010-12)

You can use any other unicode, including various bullets symbols, math symbols. For a sample list of unicode chars, see: Sample Unicode Characters.

If you use emacs, you can enter unicode chars easily. See: Emacs Math Symbols Input Mode (xmsi-mode)Emacs and Unicode Tips.

ID's Value Cannot Contain Unicode

However, ID's value must not contain unicode. It can be letters A to z, 0 to 9, and -_:.. It cannot contain space and cannot start with a number.

How is it Useful?

This could useful to reduce file size and reduce attribute value space jam, especially in html generating codes. (e.g. concent management system's engines)

For example, here's a source code of OCaml language.

(* array examples *)
let x = [| 2; 8; 3 |];;
print_int x.(1);;
x.(1) <- 9;;
let x = Array.make 9 4;;

The following is the syntax colored version:

(* array examples *)
let x = [| 2; 8; 3 |];;
print_int x.(1);;
x.(1) <- 9;;
let x = Array.make 9 4;;

The following is the html source code for it:

<span class="comment">(* array examples *)</span>
<span class="tuareg-font-lock-governing">let</span> <span class="variable-name">x </span><span class="tuareg-font-lock-operator">=</span> <span class="tuareg-font-lock-operator">[|</span> 2<span class="tuareg-font-lock-operator">;</span> 8<span class="tuareg-font-lock-operator">;</span> 3 <span class="tuareg-font-lock-operator">|];;</span>
print_int x.<span class="tuareg-font-lock-operator">(</span>1<span class="tuareg-font-lock-operator">);;</span>
x.<span class="tuareg-font-lock-operator">(</span>1<span class="tuareg-font-lock-operator">)</span> <span class="tuareg-font-lock-operator">&lt;-</span> 9<span class="tuareg-font-lock-operator">;;</span>
<span class="tuareg-font-lock-governing">let</span> <span class="variable-name">x </span><span class="tuareg-font-lock-operator">=</span> <span class="type">Array</span>.make 9 4<span class="tuareg-font-lock-operator">;;</span>

See how verbose it is? For each token in the OCaml lang, it is wrapped by a span tag with a particular class name. Each of these class name can be replaced by a short unicode char, but remain unique, meaningful, and doesn't pollute your class value space for normal use. For example:

Before:

<span class="tuareg-font-lock-operator">…</span>
<span class="variable-name">…</span>
<span class="string">…</span>

After:

<span class="♠o">…</span> <!-- for operator -->
<span class="♠v">…</span> <!-- for variable -->
<span class="♠s">…</span> <!-- for string -->

Here, we used the spade symbol ♠ for all class values that is used for syntax coloring. Effectively created our own namespace.

For a example of how verbose it can become, see: Emacs nxml-mode Fontification Changes.

If you use emacs, you might be interested in: Using Emacs To Syntax Color Source Code In HTML.

2010-12-16

Google Webfont

Perm url with updates: http://xahlee.org/js/Google_webfont.html

Google Webfont Tutorial

Xah Lee, 2010-12-16

Recently, discovered that Google has a webfonts project, at code.google.com/webfonts.

For web authors, it is probably the most easy way to use a font and have your readers see the same font, regardless what browser they are using.

How to use Google Webfont

It's very easy to use, and does not require extra knowledge. Here's a example html:

<html>
<head>
<title>sample page</title>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Geo">
<style>
body {font-family: "Geo", serif}
</style>
</head>
<body>

<p>Once upon a time... there's a movie called Tron.</p>

</body>
</html>

You can see the above html rendered here: Google Webfont Sample Page.

No special syntax or knowledge is required. All you need to do is to include a style sheet at google in the line:

<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Geo">

Then, you can freely choose the font in your css:

body {font-family: "Geo", serif}

Just go to their font directory and choose a font you want. Then, put the right font name in the above code.

How Does It Work?

If you look at the css source code at http://fonts.googleapis.com/css?family=Geo, it's content is this:

@font-face {
  font-family: 'Geo';
  font-style: normal;
  font-weight: normal;
  src: local('Geo'), local('Geo-Regular'), url('http://themes.googleusercontent.com/font?kit=mJuJYk5Pww84B4uHAQ1XaA') format('truetype');
}

The 「@font-face」 appears to started in CSS2, but is not widely support. You can read some history at: Web fonts and 〈CSS @ Ten: The Next Big Thing〉 (2007-08-28) by Hรฅkon Wium Lie at Source www.alistapart.com

Also, exactly what css source code Google sends out is dependent on the reader's browser. For tech detail, see: http://code.google.com/apis/webfonts/docs/technical_considerations.html.

linotype machine, book binding, technologies

Perm url with updates: http://xahlee.org/comp/book_printing_binding_tech.html

Linotype Machine, Typesetting, Book Binding Tech

Xah Lee, 2010-12-17

A fantastic video.

〈Pictorial Webster's: Inspiration to Completion〉 (2009) by John Carrera

All my life, i've been interested in symbols. I recall, in 1980s, in the back of big dictinories, there's a appendix of list of symbols and their nams, group into category of fields. e.g. punctuations, printer's symbols, astronomy, math, geometry, chemistry, survey, etc. In the past 20 years, the interest has expanded into typesetting, fonts, TeX, syntax and notation systems, etc. These are all related. Symbols are needed for written communication, and in math and comp lang, they are tied to notation and syntax. When printed, it relates to printing technologies, Typesetting, font. In our digital publishing era, most of these have moved to the desktop computer with associated new techs, such as keyboard, input method systems (e.g. chinese input methods), unicode, math notation software systems. (For a collection of articles, see: Xah's Unicode TutorialXah on Programing LanguagesMath Notations, Computer Languages, and the “Form” in FormalismKeyboards, Layouts, Hotkeys, Macros, RSI )

Have heard of Linotype machine many times in the 1990s when i was reading about TeX, but never had any idea what it looks like or how it works. This video showed the machine at work, also, it showed many printer technologies as a craftsmanship. Including classic technologies of book binding, making the page stack curved, printing decoration on book page edges, creating leather book cover, embossed letters on the leather cover, cutting finger holes on page edges (a semicicle-wedge-shaped “hole” for each letter A, B, etc cut into page edges). (Much of these are no longer practiced, but can be seen in older thick dictionaries). Fantastic video. (thanks to meowcats for mention)

pictorial websters book Full leather with emboss

“Pictorial Websters”. amazon

The one that sells on Amazon is a mass produced version at $20. The one shown in picture above is a delux version manually crafted as shown in the video. It sells for few k. Here's a quote from the author's comment at vimeo:

The deluxe copy shown in the video is from an edition of 26 is $4600, but there is also the regular run of 100 books (doesn't have fingertabs) in $3200 binding, $2600, and $1800, and now from Chronicle Books a very splendid $35 version. Chronicle has a contest on their website where you can WIN the deluxe in the photo!

The company “Quercus Press”, has a site with much more info: http://www.quercuspress.com/websterbindinggallery.htm.

2010-12-15

Computing Symbols in Unicode

Perm url with updates: http://xahlee.org/comp/unicode_computing_symbols.html

Computing Symbols in Unicode

Xah Lee, 2010-09-03, 2010-12-15

This pages collects unicode characters that are related to computing. For example, symbols for keyboard keys, symbols to represent line returns, enter, paragraph, file, window, cursor, etc.

Arrow keys ↑ ↓ ← → ◀ ▶ ▲ ▼ ◁ ▷ △ ▽ ⇦ ⇨ ⇧ ⇩ ⬅ ⬆ ⬇; More arrows ↔ ↕ ↖ ↗ ↘ ↙ ↮ ⬄ ⇳ ⬀ ⬁ ⬂ ⬃ ⬈ ⬉ ⬊ ⬋ ⬌ ⬍ ☞ ☜ ☝ ☟; (More at Arrows in Unicode.)

Return, Enter ↵ ↩ ⏎ ⌤; Tabs ⇄ ⇤ ⇥ ↹; Esc ; Delete, clear ⌫ ⌦ ⌧; Clear screen ; Home/End ↖ ↘; Page Up/Down key ⇞ ⇟; Modifier keys ⇧ ⇪ ‸ ⌘ ⌥ ⎇; (Sample usage: A Short Survey Of Keyboard Shortcut Notations)

Cut ✂ ✄; Undo, redo ⎌ ↶ ↷ ↺ ↻; Reload, refresh ⟲ ⟳; Whitespace ▷ · ␢ ␣ ¶ §;

Watch ; Hourglass ⌛ ⧗ ⧖; Cursor ⌖ ▮ ▯; I-beam ; prev/next Page ⎗ ⎘;

Eject ; keyboard ; tape drive ; print ; mail ; write/comment ✍ ✎ ✏ ✐ ✑ ✒; home ;

Misc icons ⌗ ⎆;

checkmarks ✓ ✔ ✗ ✘ ☐ ☑ ☒ ๐„‚ ⍻ ❍ ❏ ❐ ❑ ❒;

Bullets •◦ ‣ □ ○ ◇ ■ ● ◆ ★ ☆ ♠♣♥♦ ♤♧♡♢;

Misc ⌜ ⌝ ⌞ ⌟ ⎔ ⎖ ⎀ ⎁ ⎂ ⎃ ⎄ ⎅;

Electricity ⎓ ⎉ ⎊ ⏚ ⏛ ⏦ ⏧ ⎏ ⎐ ;

ASCII control characters glyph etc ␀ ␁ ␂ ␃ ␄ ␅ ␆ ␇ ␈ ␉ ␊ ␋ ␌ ␍ ␎ ␏ ␐ ␑ ␒ ␓ ␔ ␕ ␖ ␗ ␘ ␙ ␚ ␛ ␜ ␝ ␞ ␟ ␡; and also ␠ ␤;. (For explanation, see: Emacs's Key Notations Explained (/r, ^M, C-m, RET, <return>, M-, meta).)

Optical Character Recognition ⑀ ⑁ ⑂ ⑃ ⑄ ⑅ ⑆ ⑇ ⑈ ⑉ ⑊ ;

APL ⌶ ⌷ ⌸ ⌹ ⌺ ⌻ ⌼ ⌽ ⌾ ⌿ ⍀ ⍁ ⍂ ⍃ ⍄ ⍅ ⍆ ⍇ ⍈ ⍉ ⍊ ⍋ ⍌ ⍍ ⍎ ⍏ ⍐ ⍑ ⍒ ⍓ ⍔ ⍕ ⍖ ⍗ ⍘ ⍙ ⍚ ⍛ ⍜ ⍝ ⍞ ⍟ ⍠ ⍡ ⍢ ⍣ ⍤ ⍥ ⍦ ⍧ ⍨ ⍩ ⍪ ⍫ ⍬ ⍭ ⍮ ⍯ ⍰ ⍱ ⍲ ⍳ ⍴ ⍵ ⍶ ⍷ ⍸ ⍹ ⍺ ⎕ ; (See: Math Symbols in Unicode)

Keys or incons to be added: All icons on this page: http://nicolasgallagher.com/pure-css-gui-icons/demo/.

Much more:

Was this page useful? If so, please do donate $3, thank you donors!

What's Function, What's Operator?

Perm url with updates: http://xahlee.org/math/function_and_operators.html

What's Function, What's Operator?

Xah Lee, 2010-12-14

Typically, we understand what “function” and “operator” mean, but average programer or mathematician may have a hard time explaining them. Here, we clarify a bit on the meaning of the word “function” and “operator”, their context, their relation.

Function Is a Mathematical Concept

Function you probably understand. A function takes inputs, and produces a unique value/output for the given inputs. The inputs are called “parameters”. A specific set of input are called “arguments”. The number of parameters of a function is called the function's “arity”. So, for example, the function “sin” has arity 1. A constant, such as 35, ฯ€, can be considered as functions of no parameter, so they are functions of arity 0. A function of 2 parameters, such as 「define f(x,y) := x+y」, are arity 2.

Function is a mathematical concept. Viewed in another way, it's a map from one space (aka set) to another. You can read Wikipedia for detail here: Function (mathematics).

Operator is About Notation

A operator, is less of a mathematical concept, but more of a concept of notation, i.e.syntax. A “operator” is a symbol (or symbols) that are written to indicate operations. For example, we write 「1+2」, the “+” is a operator, and the “1” and “2” are its “operands”. Mathematically, operator is a function that acts on its operands. The operands are the arguments of the function.

Binary Operators

Typically, operators takes 2 arguments, the left and right of the symbol. e.g. 「2×3」, 「3/4」, 「2^3」, union ∩, intersection ∪.

Unary Operators

But there are also 1-argument operators. For example the minus sign 「-3」, and the logical not 「¬」 sign, the factorial 「3!」, square root 「√3」.

Multi-symbol Operators

Operators can also involve other forms with more symbols. For example, the absolute sign 「|-3|」, floor 「⌊3.8⌋」 uses a bracket, summation ∑ takes 4 arguments, a expression, a variable, and start and end values. The anti-derivative (aka indefinite integral) ∫ takes 2 arguments, a expression and a variable. In traditional notation, integration as operand involves 2 symbols, ∫ and โ…†. For example, we have 「∫ sin(x) โ…†x 」.

Implicit Operators

Operator can be a bit complicated. For example 「-3」 can be interpreted in several ways. We can think of the minus sign as unary operator acting on the argument 「3」. So, mathematically, it is a function of 1 arity that returns the addictive inverse of the element 3. Or, we can interprete it as one single entity, a element denoted 「-3」. When we write 「3-2」, the ways to interprete it gets a bit more complex. One way to think of it as a notation shorthand for 「3 + (-2)」. The 「-2」 part can be thought of as before. Another way is to think of 「-」 as a binary operator on 3 and 2, but this seemingly simple interpretation is a bit complex. Because, what is math definition of the minus binary function? I'm not sure how it can be defined in terms of algebra without ultimately thinking of it as additon of 2 elements, one being a addictive inverse. The other way is to think of it as a real line, moving the first argument to the left by a distance of the second argument. Of course ultimately these are equivalent, but i can't think of a simple, direct, interpretation that can serve as a math foundation. Also, this is directly related to how does one interprete division, such as 「3/2」.

The multiplication operator also gets complicated. For example, when we write 「3 x」, it usually means 「3*x」. The space acts as implicit multiplication sign, but otherwise the space char has no significance and only make things easier to read.

Operator Stickiness

There's also the concept of “operator stickiness” (aka “operator precendence”) at work that makes expressions with operators more concise. When we write「3△4▲5」, how do you know it's 「(3△4)▲5」 or 「3△(4▲5)」? The concept of operator stickiness is needed to resolve that. Otherwise, you'll need to always write 「3+(4*5)」 instead of the simpler 「3+4*5」. But this again, also introduced more complexity. When you have a expression of tens of different operators, it becomes a problem of remembering the stickiness grammar for each operator. (in practice, you just resort to use explicit priority indicator by parens. Forgetting Operator Precedence is a frequent source of code error in programing. And in written math for human communication, it is prone to miscommunication.)

Operator is tied to Notation

Because the concept of “operator” more has to do with syntax and notation, and when considering traditional math notation of writing in “2-dimensions”, also the fact that traditional math notation has a lot ambiguities, it gets a bit complicated and not as imprecise as we like. (See: The Problems of Traditional Math Notation)

Mathematically, operator and function are the same thing.

Math function, when written down, usually takes the form e.g. 「sin(x)」, 「f(x,y)」, where the things inside the paren are its parameter/arguments.

Operators are useful because writing everything out in full function notation gets very cumbersome and hard to read. For example, we write 「3+4*5」 instead of 「plus(3,times(4,5))」 or 「+(3,*(4,5))」.

Here's a example of traditional notation using operators, versus traditional full functional notation.

-b+√(b^2-4 a c)/(2 a)

If you don't allow space as implicit multiplication sign, then you have:

-b+√((b^2)-4*a*c)/(2*a)

If you don't allow the implicit operator precedence, then you have:

(-b)+(√((b^2)-(4*a*c))/(2*a))

Finally, writing it out in the traditional function 「f(x)」 form, you have:

/(+(-(b),√(+(^(b,2),-(*(4,a,c))))),*(2,a))

If you prefer words than symbols, as traditionally practiced when writing out functions, you have:

divide(add(minus(b),sqrt(add(power(b,2),minus(times(4,a,c))))),times(2,a))

The notation using operators is much concise, readible, but at the cost of relatively complex lexical grammar. The full functional notation is precise, grammatically simple, but difficult to read.

In math context, it's best to think of functions instead of operator, and sometimes also use a uniform function notation, where all arguments are explicitly indicated in one uniform way.

Here's what Wikipedia has to say about operators: Operation (mathematics). Quote:

An operation ฯ‰ is a function of the form ฯ‰ : X1 × … × Xk → Y. The sets Xj are called the domains of the operation, the set Y is called the codomain of the operation, and the fixed non-negative integer k (the number of arguments) is called the type or arity of the operation.

Note that it doesn't really speaks of “operators”, but speaks of “operations”, and flatly defines operation as a function.

Traditional Function Notation 「sin(x)」 Isn't Perfect

Note that, even the functional notation such as 「sin(x)」, isn't perfect.

Problem of Functions Returning Functions

Normally, with full function notation, you'd expect the operation clearly corresponds to the nesting structure. For example, our example before:

divide(add(minus(b),sqrt(add(power(b,2),minus(times(4,a,c))))),times(2,a))

But there's a problem when a function returns a function. For example, the derivative takes a function and returns a function. We might write:

derivative(f)

Now, if we want to evaluate the result at 3, then we might write:

derivative(f)(3)

You can see that the notation no longer nests. The operator precedence issue is back. Now, you need a symbol precedence to make it clear.

One solution to this is the lisp language's syntax. In lisp syntax, everything is written inside a paren. The first element is the function name, the rest is its arguments. So, 「sin(x)」 would be written as 「(sin,x)」. (comma is used for separator) Our derivative example would then be:

((derivative,f),3)

In this way, the syntax remains a pure nested form, and provides the utmost precision.

Our formula example in fully nested syntax be:

(/,(+,(-,b),(√,(+,(^,b,2),(-,(*,4,a,c))))),(*,2,a))

We could change the comma separator to space. So, it would look like this:

(/ (+ (- b) (√ (+ (^ b 2) (- (* 4 a c))))) (* 2 a))

(Note: lisp language syntax is not regular. Many of its syntax does not have the form 「(a b c ...)」. See: Fundamental Problems of Lisp.)

Syntax Design for Computer Languages

Mixing Operator Syntax with Full Function Notation Syntax

In most computer language, they allow both the operator and full function syntax. For example, you can write 「(sin(x))^2+3」. (almost all languages do this; e.g. C, C++, C#, Java, Pascal, Perl, Python, Ruby, Bash, PowerShell, Haskell, OCmal. The only exception is lisps.) This way is normal, and most flexible. Because, not all functions have a associated operator symbol. And, writing everything in nested brackets is not readible and hard to write too. The question is, is it possible to design a syntax, that has very simple lexical grammar, is regular, and easy to read and write?

Though, almost all computer languages does not have a regular syntax, in fact, non of any major computer lang has a syntax specification. The closest one that has a somewhat regular and simple syntax grammar is Mathematica. See: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Nested NotationsMath Notations, Computer Languages, and the “Form” in Formalism.

So, if we were to design a computer language, with a syntax that has a simple grammar, what would it be like?


The following are half written, still work in progress

Mathematica Example

Here's a explanation of one approach. (much based on syntax of Mathematica)

Start with a fully nested syntax. So, everything is in a fully nested functional notation, like this: 「(a b c ...)」.

For some function names or builtin names, we give them a operator symbol. For example, say we have a function named plus 「(plus,2,3)」. Now, suppose we assign the s

Unique Semantics for Each Symbol

Note first that the char paren is used for 2 purposes. (1) as a operation priority grouping indicator. (2) as delimiter for function's arguments.

So, if the context is designing a consistent math notaton or computer language syntax, this we need to fix. One way, is by insisting that each symbol used only has one unique purpose, and not be dependent on adjacent symbols. So, we might insist that, function parameter delimiters should use the square bracket. Like this 「sin[x]」. (this is what Mathematica does)

Was this page useful? If so, please do donate $3, thank you donors!

Logical Operators, Truth Table, Unicode

Perm url with updates: http://xahlee.org/math/logical_operators.html

Logical Operators, Truth Table, Unicode

Xah Lee, 2010-12-14

Added a bunch symbols to Emacs xmsi-mode for Math Symbols Input.

⨯ ∮ ∲ ∳ ↦ ↤ ¬ ∧ ∨ ⊻ ⊽ ⊼ ⊻̅. Note that the 「」 is for vector/matrix multiplication. Its unicode name is “VECTOR OR CROSS PRODUCT”. It is different from 「×」 (MULTIPLICATION SIGN). It appears, that by tradition, the vector cross sign should be rendered smaller than the normal multiplication sign. This is so in Mathematica and STIX font.

Those integrals with circles are Contour integral (aka line integral, path integral). One of the symbol has a clockwise circle, the other anti-clockwise.

Truth Table and Possible Logical Operators

Also, been working on adding full set of logical operators. Here's some interesting notes. The following is the definition for “and” and “or”.

And
0 ⊕ 0 = 0
0 ⊕ 1 = 0
1 ⊕ 0 = 0
1 ⊕ 1 = 1
Or
0 ⊕ 0 = 0
0 ⊕ 1 = 1
1 ⊕ 0 = 1
1 ⊕ 1 = 1

Taking their results in a condensed way, we can say “And” can be given a code 「0001」 and “Or” can be given 「0111」. These can be considered as 4 digit binary numbers. So, number of possible logical function with 2 parameters are the same as total number of 4 digit binary numbers, and that's 16. Let's see the complete list of what they are, and what they are named, and their symbols, if any.

Truth Table; All Possible Logical Operators

DefinitionCodeNameSymbolComment
0⊕0=0;0⊕1=0;1⊕0=0;1⊕1=00000false
0⊕0=0;0⊕1=0;1⊕0=0;1⊕1=10001and
0⊕0=0;0⊕1=0;1⊕0=1;1⊕1=00010
0⊕0=0;0⊕1=0;1⊕0=1;1⊕1=10011
0⊕0=0;0⊕1=1;1⊕0=0;1⊕1=00100
0⊕0=0;0⊕1=1;1⊕0=0;1⊕1=10101
0⊕0=0;0⊕1=1;1⊕0=1;1⊕1=00110xor
0⊕0=0;0⊕1=1;1⊕0=1;1⊕1=10111or
0⊕0=1;0⊕1=0;1⊕0=0;1⊕1=01000nor
0⊕0=1;0⊕1=0;1⊕0=0;1⊕1=11001xnor⊻̅The char is a combining char in unicode.
0⊕0=1;0⊕1=0;1⊕0=1;1⊕1=01010
0⊕0=1;0⊕1=0;1⊕0=1;1⊕1=11011
0⊕0=1;0⊕1=1;1⊕0=0;1⊕1=01100
0⊕0=1;0⊕1=1;1⊕0=0;1⊕1=11101
0⊕0=1;0⊕1=1;1⊕0=1;1⊕1=01110nand
0⊕0=1;0⊕1=1;1⊕0=1;1⊕1=11111true

It is interesting to note that half of them don't have a name. Wikipedia on Logical connective gives some name to some of them. For example, the “0000” is just “false”, the “1111” is “true”, the “1101” is “if/then”. Though, much of these names are rather forced and don't make much sense. First of all, remember we are dealing with functions of 2 parameters (so-called “binary operators”). The term “true” isn't usually thought of as a binary operator, and the “if then” and “not” doesn't make sense here neither.

No symbol for “xnor”

Also interesting, that there's no symbol for “xnor” in unicode. (See: Math Symbols in Unicode.) Logically, it should be a symbol 「⊻」 with a bar above it, like this 「⊻̅」 (the “v” and the top bar should not be connected). In Mathematica, such symbol is used. (you can create such char by unicode spec thru the method of Combining character (char composition).)

Functional Completeness

Also, i learned the term Functional completeness. Quote:

In logic, a functionally complete set of logical connectives or Boolean operators is one which can be used to express all possible truth tables by combining members of the set into a Boolean expression.[1][2] A well known complete set of connectives is { AND, OR, NOT }, consisting of binary conjunction, binary disjunction and negation. The set consisting only of the binary operator NAND is also functionally complete.

In a context of propositional logic, functionally complete sets of connectives are also called (expressively) adequate.[3]

Here's a formal definition given:

Given the Boolean domain B = {0,1}, a set F of Boolean functions ฦ’i: Bni → B is functionally complete if the clone on B generated by the basic functions ฦ’i contains all functions ฦ’: Bn → B, for all strictly positive integers n ≥ 1. In other words, the set is functionally complete if every Boolean function that takes at least one variable can be expressed in terms of the functions ฦ’i. Since every Boolean function of at least one variable can be expressed in terms of binary Boolean functions, F is functionally complete if and only if every binary Boolean function can be expressed in terms of the functions in F.

The definition above is a bit hard to understand due to its use of jargons. (i don't know what “clone” means in universal algebra (and if you look into that article, it's again esoteric, incomprehensible).) The definition is also quite general. Also, am not sure this particular definition on Wikipedia is good or well-known one. However, the concept is quite simple. Here's a simplified version for our purposes:

A set (L) of binary logical operators are “functional complete” if the semantic of any of the 16 possible logical operator can be expressed by a combination of operators in the set L.

We know that the total number of possible binary function in the binary space {1,0} is 16, from the truth table above, and by convention 6 of them have names and widely used. Others are not used much.

So, a functionally complete set of function is one that any of the possible function in truth table can be expressed by a combination of the functions in the set.

According to Wikipedia, one of the functionally complete set of function is just one single function the nand by itself. Let's see how it can express all possible functions.

First, remember that nand is defined like this: 「0⊼0=1; 0⊼1=1; 1⊼0=1; 1⊼1=0」.

The first function we'll call it “f0000”, we need 「0⊕0=0; 0⊕1=0; 1⊕0=0; 1⊕1=0」.

incomplete. Will work on this later.

Was this page useful? If so, please do donate $3, thank you donors!

2010-12-13

astronomy symbols

Added a bunch symbols to Emacs xmsi-mode for Math Symbols Input.

◀ ▶ ▲ ▼ ◁ ▷ △ ▽ ☉ ☼ ☾ ☽ ☿ ♁ ♄ ♅ ♆ ♇ ♃ ♂ ♀ ☄. The symbols includes the 9 planets. Note that the male sign ♂ and female sign ♀ is also Mars and Venus, and in Unicode, there's just one char for them.

Also some interesting readings. See: Astronomical symbol.

Also, discovered this article about the pseudo-science book Worlds in Collision, which was a best-seller in 1950s. But today's people probably all forgot about it. By analogy, you should know that many concepts, ideas, practices, we have today in math, sciences, in programing, are probably garbage. In particular, i could personal say this is so with regards to math notations, computer syntaxes, and many computing practices (e.g. Design Patterns, eXtreme Programing, which were hot in early 2000s but today pretty much waned. See: Why Software Suck) See also: Men Are From Mars, Women Are From Venus.

Also added the del operator Nabla symbol ∇. The partial derivative symbol .

2010-12-12

Math Font, Unicode, Gothic Letters, Double Struck

Perm url with updates: http://xahlee.org/math/math_font_unicode.html

Math Font, Unicode, Gothic Letters, Double Struck

Xah Lee, 2010-12-12

This post is some thoughts and info about specially styled alphabets used in math, fonts, unicode.

In math, there's these special styled letters:

  • Double Struck: โ„‚ โ„ โ„• โ„™ โ„š โ„ โ„ค โ…† โ…‡ โ…ˆ โ…‰
  • Gothic: โ„ญ โ„‘ โ„Œ โ„œ โ„จ
  • Scripted โ„ฌ โ„ฐ โ„ฑ โ„‹ โ„ โ„’ โ„ณ ℘ โ„› โ„ฏ โ„“ โ„Š โ„ด

Note that the above does not contain the full alphabets A to z. The above chars are in Unicode' “Basic Multilingual Plane”. (BMP. Their unicode number can be expressed by 4 digits of hexadecimal. (See also: UNICODE Basics: What's Character Encoding, UTF-8, and All That?)) The full set of letters from A to z of these styles is also in unicode, but is outside of BMP, thus are currently not widely supported. (meaning, you'll need to install special math fonts to see them.) If you are using latest versions of browsers (as of 2010-12), all the above letter forms should show up correctly. In particular, Google Chrome (8.0), Firefox (3.6.12), Opera (10.63), or Safari (5.0.3), Internet Explorer 8, all display them fine. (If they don't show up in your browser, and you are using latest version, see: Unicode Character Shows Blank, Question Mark, Gibberish and Best Fonts for Unicode )

Here's a exampe of the complete set of gothic styled latin alphabets:

Capitals: ๐”„ ๐”… โ„ญ ๐”‡ ๐”ˆ ๐”‰ ๐”Š โ„Œ โ„‘ ๐” ๐”Ž ๐” ๐” ๐”‘ ๐”’ ๐”“ ๐”” โ„œ ๐”– ๐”— ๐”˜ ๐”™ ๐”š ๐”› ๐”œ โ„จ

Lowercase: ๐”ž ๐”Ÿ ๐”  ๐”ก ๐”ข ๐”ฃ ๐”ค ๐”ฅ ๐”ฆ ๐”ง ๐”จ ๐”ฉ ๐”ช ๐”ซ ๐”ฌ ๐”ญ ๐”ฎ ๐”ฏ ๐”ฐ ๐”ฑ ๐”ฒ ๐”ณ ๐”ด ๐”ต ๐”ถ ๐”ท

To display the above, you'll need to install the STIX Fonts. It's a font set specially designed for math. Home page is at stixfonts.org. After you install the font, you can choose “StixGeneral”. (be sure to follow the instruction on Windows. You can't just drop the font in the font folder)

The Gothic styled letters is also known as “Blackletter”. The Double Struck (โ„ โ„‚) is also known as “Blackboard bold”. I don't like the term Blackboard Bold, and the “double struck” should be “double stroke”.

In Unicode, besides the sets of gothic, double struck, scripted, forms for the whole latin alphabet, there's also slanted and bold and “slanted and bold” variants, as actual unicode chars. They are all outside of BMP. You can see them at Mathematical Alphanumeric Symbols. I would advise to not use these stylistic variants as much as possible. Using slanted letter for variables in math is not semantically meaningful, in works such as Calculational Proofs notation or computer proof and computer algebra languages. Slanted letters as variables contribute to the problem of traditional math notation. The essential reason it's bad is because in traditional math notation, or the use of slanted font for variable, it basically treats the notation as visual glyphs of ideas, not as a language with structure and grammar. See:

Emacs xmsi-mode for Math Symbols Input

Perm url with updates: http://xahlee.org/emacs/xmsi-math-symbols-input.html

Emacs xmsi-mode for Math Symbols Input

Xah Lee, 2010-12-08, 2010-12-12

This is the home page for xmsi-mode 〔xmsi-math-symbols-input.el〕, a Emacs minor mode for inputing math symbols of Unicode characters.

Usage and Features

Call “xmsi-mode” to turn the mode on. Call it again to turn off.

Type “inf”, then press 【Shift+Space】, then it becomes “∞”. Here's some other popular symbols and their abbrevs:

abbrevsymbol
aฮฑ
bฮฒ
pฯ€
lฮป
gฮณ
Gฮ“
sum
prod
c+
rt
and
!=
>=
=>
->
e'รฉ
e`รจ
e"รซ
e^รช
n~รฑ
aoรฅ
dsRโ„
^2²
_iแตข

The abbreviations are based on Mathematica's 【Esc abbrev Esc】, HTML/XML entity name, TeX/LaTeX's 「\symbolname」.

Acting on Selected Word

If you have a text selection, then selected word will be taken as input. For example, type 「sin(a)」, select the “a”, then press 【Shift+Space】, then it becomse 「sin(ฮฑ)」.

Supported Chars

To see the full list of supported chars and their abbrevs, call “xmsi-list-math-symbols”.

Here's a list of chars the mode currently suports:

¡ ¢ £ ¤ ¥ ¦ § ¨ © ยช « ¬ ® ¯ ° ± ² ³ ´ ยต ¶ · ¸ ¹ ยบ » ¼ ½ ¾ ¿ ร€ ร ร‚ รƒ ร„ ร… ร† ร‡ รˆ ร‰ รŠ ร‹ รŒ ร รŽ ร ร ร‘ ร’ ร“ ร” ร• ร– × ร˜ ร™ รš ร› รœ ร รž รŸ ร  รก รข รฃ รค รฅ รฆ รง รจ รฉ รช รซ รฌ รญ รฎ รฏ รฐ รฑ รฒ รณ รด รต รถ ÷ รธ รน รบ รป รผ รฝ รพ รฟ ล’ ล“ ล  ลก ลธ ฦ’ ห† ˜ ฮ‘ ฮ’ ฮ“ ฮ” ฮ• ฮ– ฮ— ฮ˜ ฮ™ ฮš ฮ› ฮœ ฮ ฮž ฮŸ ฮ  ฮก ฮฃ ฮค ฮฅ ฮฆ ฮง ฮจ ฮฉ ฮฑ ฮฒ ฮณ ฮด ฮต ฮถ ฮท ฮธ ฮน ฮบ ฮป ฮผ ฮฝ ฮพ ฮฟ ฯ€ ฯ ฯ‚ ฯƒ ฯ„ ฯ… ฯ† ฯ‡ ฯˆ ฯ‰ ฯ‘ ฯ’ ฯ– ฯœ ฯ ื‘ ื’ ื“ แตข แตฅ – — ‘ ’ ‚ “ ” „ † ‡ • … ‰ ′ ″ ‴ ‹ › ‾ ⁄ ⁰ โฑ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁺ ⁻ ⁼ ⁽ ⁾ โฟ ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₊ ₋ ₌ ₍ ₎ โ‚ โ‚‘ โ‚’ โ‚“ โ‚” € โ„‚ โ„Š โ„‹ โ„Œ โ„ โ„ โ„‘ โ„’ โ„“ โ„• ℘ โ„™ โ„š โ„› โ„œ โ„ ™ โ„ค โ„จ ร… โ„ฌ โ„ญ โ„ฏ โ„ฐ โ„ฑ โ„ณ โ„ด โ„ต โ…† โ…‡ โ…ˆ โ…‰ ← ↑ → ↓ ↔ ↵ ⇐ ⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇ ∈ ∉ ∋ ∏ ∑ − ∓ ∗ √ ∝ ∞ ∠ ∡ ∢ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥ ⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈ ⌉ ⌊ ⌋ ▲ △ ▶ ▷ ▼ ▽ ◀ ◁ ◊ ☄ ★ ☉ ☹ ☺ ☼ ☽ ☾ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♆ ♇ ♠ ♣ ♥ ♦ ⦜ โฑผ 〈〉 《》 「」 『』 【】 〔〕 〖〗 ๐”„ ๐”… ๐”‡ ๐”ˆ ๐”‰ ๐”Š ๐” ๐”Ž ๐” ๐” ๐”‘ ๐”’ ๐”“ ๐”” ๐”– ๐”— ๐”˜ ๐”™ ๐”š ๐”› ๐”œ ๐”ž ๐”Ÿ ๐”  ๐”ก ๐”ข ๐”ฃ ๐”ค ๐”ฅ ๐”ฆ ๐”ง ๐”จ ๐”ฉ ๐”ช ๐”ซ ๐”ฌ ๐”ญ ๐”ฎ ๐”ฏ ๐”ฐ ๐”ฑ ๐”ฒ ๐”ณ ๐”ด ๐”ต ๐”ถ ๐”ท

The mode currently supports over 300+ math symbols by abbrev input. (Any other char in unicode can be entered by decimal or hexadecimal or by name.)

XML Char Abbreviations

All XML char entity abbrevs are supported. For example, 「copy」 becomes 「©」. (See: List of XML and HTML character entity references)

Unicode By Number 「&#number;」

To type any unicode by its code point in decimal, use 「&#n;」. For example, 「&#945;」 becomes 「ฮฑ」.

Ending semicolon “;” is optional.

Unicode By Hexadecimal 「&#x‹hex›;」

To type any unicode by hexadecimal, use 「&#x‹number›;」. For example, 「&#x3b1;」 becomes 「ฮฑ」.

Ending semicolon “;” is optional.

Unicode Char by Name

To type any unicode by the char's unicode full name, type 【Ctrl+x 8 Enter】 (ucs-insert). Asterisk “*” can be used as a wildcard to find the char. For example, calling “ucs-insert”, then type 「*arrow」 then Tab, then emacs will list all unicode char names that has “arrow” in it. (this feature is part of Emacs 23)

Get Unicode Font

For best result, you'll need a font that support unicode. See: Best Fonts for Unicode.

Also, you should be using Emacs 23, because it has a new unicode engine and font engine that supports operating system's fonts.

Buy xmsi-mode Now

Download the mode for $3. In the comment field, put “emacs math symbol input mode”. I'll email you the download link. Make sure your email address is included and correct.

Alexander McQueen, Haute Couture, How Absurdity Became High Art

Perm url with updates: http://xahlee.org/Periodic_dosage_dir/Alexander_McQueen_Haute_Couture_suicide.html

Alexander McQueen, Haute Couture, How Absurdity Became High Art

Xah Lee, 2010-12-12

Just learned today, that Alexander McQueen (1969-2010) killed himself, on 2010-02. Age 41. He's a well-known fashion designer with many international awards.

〈Alexander McQueen Retrospective〉

About these Haute Couture fashion stuff... am not sure what to say. I want to say they are idotic. First of all, these “highart” fashions are irrelevant to everyday life and common people. They are catered to the rich and the show biz. That's something in clash with my lifestyle and thoughts.

If i consider Haute Couture as a art form, that is, design clothings for the sake of design (without regards to function or comfort or practicality), and i look at the clothing of these catwalks, i find them rather lacking artistry. These elevated “designs”, in my opinion, are easy, almost trivial, and not beautiful. It's the same phonemon where some photography is elevated as high art. To put in context, music, painting, sculpting, poetry, are much more of a art.

Look at the following, i suppose it's one of fashion show McQueen created:

“Weird Science of Alexander McQueen”

Is that art? How idiotic can that be? Painting a white dress by 2 robotic arms on a actress.

In the art world, there are a lot idotic things. Often, the most trivial idotic thing are elevated to be a celebrated genre, idea. e.g. random dumping of paint on canvas you have abstract paintings. Then there's music composition of absolutely no sound. These famous artists went on to talk about their ideas, philosophy, etc.

I think the reason that often arts become stupid is precisely because it is not something many people do. The more “high” the art, the more chance it becomes absurd garbage.

Of a set of Haute Couture that i found beautiful is here: Fashion Alices.

For another highbrow fancy fashion show, see: Harem (Sarah Brightman).

Discovered that, Isabella Blow (1958-2007), a English magazine editor and international style icon, a friend who helped McQueen became famous, also killed herself.