Thursday, June 14, 2012

The knot project

I pretty much completed my math/programming project while in Taipei. At the end of my last stay in Tainan, I thought I was close to computing the Kauffman polynomial for all knots. This is an algorithm for associating a polynomial to each knot which is the same polynomial no matter how the knot is manipulated but stays untied.

After awhile I realized that I was far from correctly computing the polynomial, so I decided to rewrite from scratch and this time use C++ instead of C. Previously, I had used C++ at work, but after this project I feel I know the language well. I set up C++ classes for loops, knots and links, implemented overloaded operators for Laurent polynomials, used dynamic allocation and recursive calls. All of these could have been done in just C but are so much easier in C++.

I used gnuplot to create pictures of the progress of computation. Here is a simple composite of the steps for computing the Kauffman polynomial for the figure 8 knot.



In my two previous stints in Tainan, I used an Asus netbook running Linux for a development machine. This time, I used a Toshiba notebook running Windows 7. To simulate the Linux environment, I used CYGWIN and the vim editor for vi. I'm too cheap to buy the Microsoft development suite and don't have the time to learn all of MS's details.

For the most part, it worked OK but I did have some problems:

1. Because of my recursive use, I ran out of stack space and CYGWIN has noway of increasing stack space. So I'm stopped at computing only the knots with up to seven crossings. When I get back home on a real linux box, I'll do more.

2.MS has no automatic(and free) way to view thumbprints of .eps files. I like to survey the correctness of the algorithm by viewing the directory of thumbprints. It's a pain to open dozens of output .eps with ghostscript/gsview.

3.I feel that little Asus netbook running linux was faster than the big Toshiba notebook running windows7.

Out in Neihu I saw this sculpture in an apartment garden. I doubt that 1% of passerbys know what figure they are looking at. Hexagons and pentagons in the shape of a ball. What could that be?


Ok, none of that has been too practical. But here is something that is. One of my relatives in Taiwan gave me a blank Microsoft paper notebook that had the current calendar as 1994(they never throw out anything). The days of the year matched up perfectly with the current year(at that time) 2011. How often does that happen?

Using unix tools the command "cal xxxx" produces a text copy of the calendar year xxxx. Then looking for duplicates(easy in the unix world). We get this table for the years 1900 to 2100:

 Duplicates
1900 1906 1917 1923 1934 1945 1951 1962 1973 1979
1990 2001 2007 2018 2029 2035 2046 2057 2063 2074
2085 2091
Duplicates
1928 1956 1984 2012 2040 2068 2096
Duplicates
1920 1948 1976 2004 2032 2060 2088
Duplicates
1916 1944 1972 2000 2028 2056 2084
Duplicates
1904 1932 1960 1988 2016 2044 2072
Duplicates
1901 1907 1918 1929 1935 1946 1957 1963 1974 1985
1991 2002 2013 2019 2030 2041 2047 2058 2069 2075
2086 2097
Duplicates
1912 1940 1968 1996 2024 2052 2080
Duplicates
1902 1913 1919 1930 1941 1947 1958 1969 1975 1986 
1997 2003 2014 2025 2031 2042 2053 2059 2070 2081
2087 2098
Duplicates
1924 1952 1980 2008 2036 2064 2092
Duplicates
1903 1914 1925 1931 1942 1953 1959 1970 1981 1987
1998 2009 2015 2026 2037 2043 2054 2065 2071 2082
2093 2099
Duplicates
1908 1936 1964 1992 2020 2048 2076
Duplicates
1909 1915 1926 1937 1943 1954 1965 1971 1982 1993
1999 2010 2021 2027 2038 2049 2055 2066 2077 2083
2094 2100
Duplicates
1910 1921 1927 1938 1949 1955 1966 1977 1983 1994
2005 2011 2022 2033 2039 2050 2061 2067 2078 2089
2095
Duplicates
1905 1911 1922 1933 1939 1950 1961 1967 1978 1989
1995 2006 2017 2023 2034 2045 2051 2062 2073 2079
2090

So for 2013,  a calendar from 2002 or 1991 will do just fine and it there are so many similar calendars because it is not a leap year.

No comments:

Post a Comment