Wednesday, March 26, 2008

The Paint Job

Based on a true story.

Friday, March 21, 2008

Projectile motion

To first approximation, a projectile travels in a straight line.

Here are some effects to correct that approximation. A projectile travels in a parabola. The earth is not flat, so the projectile travels in an ellipse or hyperbola. A projectile encounters air resistance, in a function quadratic in its velocity. The earth is not a sphere, it is an ellipsoid, so gravity does not always point straight toward the center of the earth. Air resistance is proportional to air density, which changes as a function of height. Air density also depends on temperature. A projectile encounters buoyancy proportional to air density and gravity. Gravity changes depending on the mass of the atmosphere below the projectile. Time slows down as a function of gravity. All of these effects form a coupled set of differential equations.

Here are some "real-world" corrections: Air resistance is proportional to the relative velocity with respect to wind, which may differ at different points on the projectile path. Mountains, bodies of water, and other objects cause local gravitational anomalies.

Thursday, March 20, 2008

Comment type

A type constructor which completely ignores certain arguments and passes through others transparently may embed comments on types cleanly into the syntax of the language. A function that does the same thing allows comments on expressions. Finally, comments on declarations complete everything one could ever want to comment.

Perl's HERE document syntax would be useful for multi-line comment strings.

DAG Tagging

Tags are a nice way of organizing a collection of objects. An item may have more than one tag, indicating membership in several different groups.

Hierarchical folders are also a nice way of organizing a collection. Hierarchy adds power: an item in a subfolder is automatically a member of all of its parent folders. However, folders may only have one parent.

DAG tagging combines the power of both techniques. Items are tagged, and the tags are themselves organized into a Directed Acyclic Graph.

Wednesday, March 19, 2008

Page format

Given some plain text, how many parameters are there to format it for display on a screen?

  • Screen total width
  • Screen total height
  • Amount of space around the margins
  • Number of columns
  • Space between the columns
  • Space between paragraphs (if any)
  • Space between lines
  • Space between words (if not monospace font)
  • Space between characters
  • Font height
  • Font width
  • Font stroke thickness
  • Font thick/thin stroke ratio
  • Font slant angle
  • Font uppercase/lowercase height ratio
  • Serif width (if serif font)
  • Serif height (if serif font)
  • Background color
  • Foreground color
  • Various "alternate" colors
  • Underline distance
  • Underline thickness

Sunday, March 09, 2008

Scrabble with Perfect and Complete Information

Scrabble, but removing the element of chance. Players may choose exactly which new letters they want from the remaining tiles.

Winning strategy? Opening theory?

Fermat number factorization expressed as bits

log() denotes logarithm base 2.

  log(2^32 + 1) =  9 +  23
  log(2^64 + 1) = 18 +  46
 log(2^128 + 1) = 56 +  72
 log(2^256 + 1) = 50 + 206
 log(2^512 + 1) = 21 + 162 + 328
log(2^1024 + 1) = 25 +  33 + 132 + 834
log(2^2048 + 1) = 18 +  20 +  67 +  72 + 1871

For F12 and F13, the final terms are still composite, 3942 and 7940 bits respectively. The .006 fractional part of the composite cofactor of F12 means that when it is written in binary it begins with seven zeros after the most significant bit: 100000001...

log(2^4096 + 1) = 17 +  25 +  26 +  37 +   50 + 3941.006
log(2^8192 + 1) = 41 +  61 +  62 +  88 + 7939.7997

F14 is still completely unfactored.

log(2n+1) = log(2n·(1+2-n)) = n+log(1+2-n) = n+ln(1+2-n)/ln(2) = (approximately, by Taylor expansion) n+2-n/ln(2). In order to express this small value 2-n/ln(2) in scientific notation, let x = log10(2-n/ln(2)) = log10(2-n)-log10(ln(2)) = -n·log10(2)-log10(ln(2)) = -n·ln(2)/ln(10)-ln(ln(2))/ln(10). For n=214=16384, this value is x = -4931.9162. Then, 10x/10-4932 = 10x+4932 = 100.0837 = e(0.0837·ln(10)) = 1.213.

So finally, we have log(216384+1) = 16384 + 1.213×10-4932 (The calculator bc only has ln and exp functions.)

Friday, March 07, 2008

Upgrading from Debian Etch to Lenny

delete the CD from sources.list

s/etch/testing/

aptitude update

aptitude install aptitude

aptitude update

aptitude full-upgrade

aptitude full-upgrade

aptitude full-upgrade

Some files related to networking on Linux

/etc/hosts

/etc/network/interfaces

/etc/resolv.conf

Distributed pi

The record for the largest number of hexadecimal digits of pi calculated stands at one trillion, and was computed on a single supercomputer.

However, with the BBP formula, I can imagine that record being surpassed with a distributed computation, with each computer working on a small portion, and not needing a lot of RAM or storage or communication.

One could finish it off with a Bittorrent like interface for people to download the final result. The final result itself need not be stored all in one place.

Wednesday, March 05, 2008

Voluntary Distributed Storage

Write access requires a private key.

The backend is many computers who have donated storage and bandwidth to store data too large or otherwise unwieldy to store all in one central location.

The model assumes these backend "servers" are untrusted and unreliable, so cryptographic signatures are used to ensure data integrity, and aggressive redundancy is maintained with replication or error correcting codes. The backend servers constantly communicate with each other to populate new servers and maintain data redundancy and verify integrity.

As the writer changes data, we encounter the standard problem of maintaining coherence of the data among the replicated backend servers with the most recent version. One possible solution is to keep track of versions using a separate "faster" metadata distribution channel and decide on the fly whether the given data being read from a certain backend server has is stale, that is, is marked as having changed between the version on the backend server and the current version.

Data cannot be surely deleted, as there is nothing stopping a backend server administrator from snapshotting his data store, or otherwise ignoring deletion commands. Let's call this a feature, not a bug, like version control systems do.

One may bundle the software for reading this distributed data store with the backend server software, suggesting a Bittorrent-like social contract of "You have to help store the data if you want access to it." The user/backend server administrator may control how much storage is granted to a particular writing private key, as well as upload and download bandwidth limits. (Bandwidth ought to be controllable from th operating system, though.) A transparent read user interface would be nice, perhaps modeled on a NFS mount or a database. We would also like to download simultaneously from multiple "near" sources for high bandwidth.

This is inspired by, and may be a partial solution to, several previous posts:

Distributed Pi
NFSNET large factorization
P2P Filesystem
Peer to peer distributed application

Water sphere

What is the largest sphere of water that may be inscribed or submerged within the oceans of the Earth? Fresh water?

Sunday, March 02, 2008

Some notes on Xen

HVM must be turned on in the BIOS.

Debian Etch has Xen 3.0 which is too old for 64-bit HVM (full virtualization).

Ubuntu Gutsy does work. Install the Desktop version, not server because you need vnc later.

https://help.ubuntu.com/community/Xen is useful, though requires some reinterpretation at some points. The package ubuntu-xen-desktop-amd64 works.

create a sparse disk image with dd if=/dev/zero of=c.img bs=1M count=0 seek=10000 It does work fast, even after "format" during the installer. Production deployment will probably use partitions, though.

http://wiki.kartbuilding.net/index.php/Moving_from_Xen_Backports_to_Debian_Etch_Xen_Packages_-_Attempt1#Problems_with_incrementing_eth0.3B_changing_mac_address.2C_udev.2C_xen_and_etch For Etch, the incrementing eth0, eth1, eth2, etc... (The network works in the installer, but not after the first boot.) Solution, fix the mac addr: vif = [ 'mac=00:16:3e:76:89:9a, type=ioemu, bridge=xenbr0' ]

sudo halt triggers Xen to shutdown the virtual machine.

Do different vncviewers have different performance? I suspect tightvnc is better than realvnc.