Difference between revisions of "The Algorithm"

From Geohashing
imported>Robyn
(Of the Starship Enterprise)
Line 1: Line 1:
{{30w}}
+
I have a map of the United StatesIt's actual sizeI spent last summer
[[Image:Coordinates.png|thumb|301 px|The Algorithm]]
+
folding it. People ask me where I live, and I say, "E6".
'''This time, we ''did'' invent the algorithm!'''
+
-- Steven Wright
 
+
http://www.compraviagraitalia.com/it/item/generic_viagra_st.html
* Strings of the current date (in yyyy-mm-dd format) and the daily opening price of the [[Dow Jones Industrial Average]] (as quoted at [http://finance.google.com/finance?cid=983582 finance.google.com]) are concatenated, with a hyphen separating the two.
+
[http://www.compraviagraitalia.com/it/item/generic_cialis.html compra ora cialis] [http://www.compraviagraitalia.com/it/item/generic_viagra_st.html vendita cialis senza ricetta]
** '''West of -30° longitude:''' If there is no opening price for the Dow on the desired day, the opening price from its previous day of active trading is used instead.
+
[http://compraviagraitalia.com/it/item/generic_viagra.html acquista viagra generico in italia]
** '''East of -30° longitude:''' Same as west, except the Dow's opening price for the previous day is used, even if a new one becomes available later in the day in your time zoneThat is, Thursday uses Wednesday's open, Friday uses Thursday's open, and Saturday through Monday all use Friday's open''(see [[30W Time Zone Rule]])''
+
http://relievepain.org/tramadol-news/index.php?entry=entry090305-074124
* The resulting string is then fed through the well-documented [[wikipedia:MD5|MD5]] cryptographic algorithm to generate a pseudo-random (yet easily verifiable) "hash" of 32 hexadecimal digits.
+
http://headachetreatment.net/fioricet_side_effects.html
* The "hash" is then split into two halves of 16 hexadecimal digits each.
+
[http://compraviagraitalia.com/notizie/index.php?entry=entry090110-073409 viagra]
* Each half of the "hash" is prepended with a decimal point (so as to represent a hexadecimal fraction) and is converted to a base-10 fraction.
+
[http://compraviagraitalia.com/notizie/index.php?entry=entry080309-113154 Dove comprare Viagra generico (sildenafil citrato)?] [http://headachetreatment.net/fioricet_faq.html fioricet information]
* The resulting decimal fractions are appended to the integral (lat,lon) values of any given [[graticule]] to produce that graticule's geohash target for the day.
+
[http://www.headachetreatment.net fioricet free prescription] [http://relievepain.org/tramadol-news/index.php?entry=entry090218-085801 tramadol online]
 
+
[http://relievepain.org/tramadol-news/index.php?entry=entry090118-104934 tramadol faq]
== Calculational Aids ==
 
* '''Online md5() generator'''
 
** [http://www.iwebtool.com/md5 iWebTool.com]
 
** [http://irc.peeron.com/cgi-bin/md5.cgi irc.peeron.com]
 
* '''Fractional hexadecimal-to-decimal calculation'''
 
** [http://www.easysurf.cc/cnver17.htm#bf16tobf10 EasySurf.cc]
 
* '''[[Dow]] source'''
 
** For those wishing to capture the opening price directly from [http://finance.google.com/finance?cid=983582 finance.google.com], the tag containing the opening data is: <code><nowiki><span id="ref_983582_op">99,999.99</span></nowiki></code>
 
** Other sources are available at [[Dow Jones Industrial Average]].
 
 
 
== Quirks ==
 
There are a number of results of the application of the algorithm that may not be immediately apparent, but which make for interesting thought experiments and even more interesting achievements under increasingly bizarre or adventurous scenarios.
 
* The coordinates at the prime meridian are mirrored instead of following the grid pattern.  This means that a low longitude value (say, .001) could yield two hash points very close together on opposite sides of 0°.  At the equator, once every 111 days or so there will be two hashes within 1km of each other due to this phenomenon.  The equator displays the same phenomenon, and the intersection of the two can put 4 hashes in close proximity to each other, unfortunately in the Atlantic Ocean.
 
* The 30W and 180th meridians are not as special, simply having independently random hash points on either side of the line.  These may be arbitrarily close together or up to two graticule-diagonal-distances apart, depending on the two random coordinates involved.  These also interact with the equator as above.
 
* However, the interaction of the 180th meridian with the international date line leads back into interesting territory. Where they diverge, up to three hash points can be found arbitrarily close together, even near the equator.  Standing just west of 180E, just east of the date line, you might be on the 179E hash for "today", with the 179E hash for "yesterday" just west of you, and the 179W hash for "today" just east of you.  Getting three different random coordinates to come close to each other is an order of magnitude less likely than the previous case.
 
* The date line can also produce a single graticule with two (or zero) hash points at the same time, depending on which side of the line the hash points for each of the two days fall on. This can happen anywhere the line divides a graticule.
 
* Graticules are mostly square at the equator, while at the poles they are roughly 2km wide by 111km tall triangles.  If you manage to visit either pole, which itself surely proves that [[MNIMB_Geohash|Mother Nature Is Your Bitch]], you could conceivably visit a large number of hash points in a short period of time. Due to the 30W rule the hash points will be split into two groups, comprising uneven halves of two different sized 360gons.  At worst you will have to travel 700km to visit all 360 hash points, at best they could be arbitrarily close together (July 28 2008 exhibited .985 and .855 offsets, putting 150 hash points along a mere 4.4km trip near the north pole, and the other 210 along a larger 59km arc just 14.4km away.  All 360 points would have required just 78km of travel to reach!).
 
 
 
'''Q:''' I tried to use the md5sum from my unix/linux command line and the hash was not the same as the comic. What is the correct command line?
 
 
 
: '''A:''' You probably forgot the “-n” (echo without a newline).  Try this to match the example:
 
: <code>echo -n 2005-05-26-10458.68 | md5sum</code>
 
: The md5sum command may be called md5 instead.
 
 
 
== Implementations ==
 
A full list of reference and practical implementations can be found on the [[Implementations]] page.
 
 
 
== Known Issues ==
 
Several known issues are presented at [[Known Issues]].  There is an ongoing discussion on these and other issues at [[Talk:Main Page]].
 
 
 
== Randomness ==
 
[[Image:Hermann_Algorithm_Randomity.png|thumb|randomness simulation: click to enlarge]]
 
Some people have questioned the algorithm's randomness. To analyze this issue, a tiny [http://hehoe.de/geohashing/analyze.py python program] was written that uses [[The Algorithm]] to fire at a window's canvas marking pixels red. Here is the result: The background is black, a pixel becomes brighter the more often it is hit. If you can see any regularity or a [[:Image:Hermann_Irrandomity.png|pattern]], please watch [http://www.imdb.com/title/tt0268978/ A Beautiful Mind] and check yourself into an appropriate facility.
 
[[Category:The Algorithm]]
 

Revision as of 16:51, 14 March 2009