Friday, December 12, 2014
Magnetic Words: Firefly-inspired Chinese Words & Phrases
And so can you: Words and phrases file (PDF), English-Chinese List, Chinese (by Pinyin)-English List. You’ll also need a pair of scissors and some adhesive-backed magnetic sheets such as those by MagPro [e.g. amazon] (also available at Michael’s arts & craft stores).
These PDFs are creative commons licensed. Attribution, Non-Commercial, Share-Alike
Tuesday, July 8, 2014
2112 in Mayan
The other day I was browsing a book on Mayan Civilization and Archeology and was reading about their base-20 number system and how it was juxtaposed to their calendar system in terms of complexity. I started to play a bit with the number system (I love messing about mathematically in different bases — place-value systems are so brilliant!). Thinking of the prog-rock band Rush’s palindromic album title, 2112, I quickly converted in my head and came to a surprising conclusion:
The number twenty-one twelve is a palindrome in both Hindu-Arabic base-ten numerals:
and in Mayan base-twenty numerals:
However, Mayan is normally written along the vertical axis rather than the horizontal:
Granted, it is a palindrome only graphically, as transliterating to Hindu-Arabic numerals would give us 5.5.12 (base 20, using decimals as place separators), not exactly palindromic. Even so, I thought this was a neat observation.
Saturday, June 7, 2014
Vectors for Custom Map(s) of Portland (Maine)
Next I wanted to experiment with some more detail, so I started working on a map of the University of Southern Maine's Portland Campus, I have roughed out green spaces and buildings in about two hours. The draft results look a little too cartoonish, which might work in the school paper for orientation week, but is just not the look I was going for, so I need to spend some more time tidying up and generalizing; — it also needs labels.
Friday, May 9, 2014
Basic 2D & 3D Multi-dimensional scaling (MDS) in R
Multi-dimensional scaling is related to PCA. Basically it translates data points between differently dimensioned spaces, through the use of a similarity metric. Thus the result is a plot in 2- or 3-D similarity space; that is, what you're plotting is the similarity between data points as measured by the metric.
For 2-D plots, you can use the
dist
and cmdscale
functions of R:setwd("~/Data/")
getwd()
#Load Data
data <- read.csv("myData.csv", header=TRUE)
#Caclulate Dist.
data.dist <- dist(data[,1:4])
#Calculate MDS
data.mds <- cmdscale(data.dist, k=2)
#Create x,y refs
data.x <- data.mds[,1]
data.y <- data.mds[,2]
#Plot
plot(data.x, data.y, col=as.integer(data$CLASS))
this results in a plot like this:
3-D plotting relies on the amazing
rgl
library. Which, on MacOS, I believe requires X11 to be installed. The code for this is very similar, except in the call to cmdscale
, k equals 3, there is an additional axis, and a call to plot3d (rgl library call):library(rgl)
setwd("~/Data/")
getwd()
#Load Data
data <- read.csv("myData.csv", header=TRUE)
#Caclulate Dist.
data.dist <- dist(data[,1:4])
#Calculate MDS
data.mds <- cmdscale(data.dist, k=3)
#Create x,y refs
data.x <- data.mds[,1]
data.y <- data.mds[,2]
data.z <- data.mds[,3]
#Plot
plot3d(data.x, data.y, data.z, col=as.integer(data$CLASS))
play3d
to movie3d
and adding a movie = "namewithnoext"
argument you can produce animated gifs of your 3D plot:Data from SatLog dataset, from the UCI Machine Learning Repository