Mr. 23

23 is everywhere!
- Greg Funchess
Ask me anything

Food for Thought: Senses

This is pretty much an unedited (except for spelling) thing I wrote today on the way back home. I figured it’d be a good start to get back into tumblr.

What do we know about the world? We know what our senses tell us. From these perceptions we apply logic and this leads us to our understanding of the world. We agree that this understanding, this science, makes sense because it is logically consistent and we can verify such consistency with others.

Now consider the possibility that we are all one. Consider that we are all projections, images, of one entity. Of course then our perceptions and senses would all be for the most part the same. And then we could easily verify consistency with ourselves.

But then you ask, what of time? What of all of us who lived in the past? Is time not a perception too? To add to that time is a very odd thing. It’s often said we live in a 4D world where time is the fourth dimension. Why is time the odd one out? I can move forwards and backwards, left and right, up and down, but only forward in time and not backwards. And if time is just some weird perception that we can’t yet explain, then it makes sense that all humans (the projections) are actually existing at the same time since there is no time. And if that were the case then the everyone is one doesn’t have the problem of people in the past or people in the future. How then does one explain different personalities? Are our personalities not reflections of the environment we grow up in? I have run out of paper and will stop here.

jorenh said: Hi!
I've been busy lately building a digitalized version of Rubik's Cube in Matlab. Up untill now, I mainly worked on the appearance and interactibility of the program, but ofcourse I want to solve it eventually...or rather let it solve itself. Since I don't know anything about solving Rubik's cube, I thought of writing a genetic algorithm. When I googled this to see if anyone had ever thought of this before (which ofcourse was the case), I came across your blog. Unfortunately you haven't posted anything about this problem after March 2010, so I was wondering if you ever came up with an effective algorithm. Mine is able to come halfway in solving the cube, but after that, almost every sequence of moves destroys the relatively 'fit' state it was in. Are you interested in the algorithms I'm using (evolution, fitness-function)? I would love to hear your thoughts on this subject!

Kindest regards,


Hello, yeah unfortunately I didn’t bother implementing this. I was going to and at the time it seemed cool but then I was busy with something and forgot about it.

Now that I have a little more sense and have worked on things like this ( it seems that a genetic algorithm might have difficulty solving this for exactly that reason. It gets “close” but really it’s just landed on a local minimum and it may in reality be far from the solution. That’s not to say don’t do this with a genetic algorithm, just know that GA’s are good at finding things close and for things that don’t have easy to see mathematical models (otherwise a gradient descent would be an excellent choice).

One way that may help with the GA is to see if it can solve the case where 2 layers are already solved and it just has to do the last layer. There should be fewer local minima with only a single layer remaining and then it may be able to solve it. If that works you could maybe do something where it’s “more fit” to solve one layer first, then the next, then the last. That seems like it might work. If you have any other questions or thoughts email me at gfunchess @t gmail d0t com (not that bots aren’t going to get my email anyway).

Collatz Color (my art project for today)

Collatz Color (my art project for today)

Sudoku Solver / Generator

Yesterday I wrote a simple Sudoku solver. I’m thinking of using it to generate sudokus. I’ve run the program against a “very hard” puzzle at and it solves this in ~0.2 seconds on my Macbook. I think this is probably slow. Anyone else made a backtracking Sudoku solver that’s faster?

The brief idea behind a backtracking sudoku solver isn’t to use logic but rather “take a step” and set a square as a number and keep doing this until the puzzle is no longer valid (i.e. a certain square has no possible values). Then obviously the previous step was wrong and so it should be undone and another number should be chosen instead.

It’s essentially like how one would solve a maze. Walk in, make a choice about which way to go and keep doing that. If you get to a dead end, go back to the last choice you made and make the other choice, if that also leads to another dead end, then go back two choices, etc. until you finally get out of the maze.

As for how sudoku generation will work, it will take a valid grid, mix it up quite a bit, then start removing numbers. It’ll keep removing numbers until the puzzle is no longer solvable, then it’ll stop so that the minimum number of clues are there to solve the puzzle.

MongoDB and Heroku - Anagram search

So I’ve finished my anagram finder thing and it’s fast.

It hardly has any design to the page as I’ve not had time to do that. It’s backed with MongoDB and searches documents of the form { word: “LOLCATZ”, lookup: “acllotz” } with an index on “lookup” so it’s fast.

Some issues that I had was the permute function that I wrote had a slight flaw that turned out making it hardly generate any permutations. This took me a while to find because when the search only provided a few results I figure it was just because I wasn’t using a large wordlist. Now the permute function is fixed and many more words are returned.

Any feedback or suggestions would be appreciated.

MongoDB is fast

Inserted 8,087 small documents in 6.1125 seconds from a small Sinatra ruby app.

I decided to get familiar with MongoDB since I plan to use it in a product that I’m working on (was going to go with Redis but realized that’s a hack and while it works I haven’t been able to figure out an easy geospacial thing with Redis). A while ago I made a post about how NoSQL isn’t always the way to go. I was trying to find anagrams of words by computing a score for each word based on the product of prime numbers found by mapping the letters to primes. Then anagrams are just words where the gcd is greater than one. An example might help, ‘abc’ -> 2*3*5 = 30, ‘cab’ -> 5*2*3 = 30, gcd(30,30) > 1; also ‘ba’ -> 3*2 = 6 and gcd(30, 6) > 1. This works well for an in-memory system (it’s what I use in my Scala OMGBot that plays Letterblox) but not so much for a database like MongoDB. 

What I’m doing now is making an anagram lookup service with several improvements. Firstly, there won’t be so many random words as now I’m using the text of Sherlock Holmes as my wordlist rather than some arbitrary wordlist that I found on the internet. Also this will use MongoDB hosted at MongoHQ and will hopefully be more efficient and faster.

The plan to find anagrams with Mongo is to store documents in the form { word: “LOLCATZ”, lookup: “acllotz”} with an index on lookup, the alphabetically sorted version of the word. Then, to find an anagram, all permutations of a word will be made into an array and then mongo will be queried via { lookup: {$in: [‘a’, ‘c’, … ‘ac’, … ‘lolcatz’, …]}} This should be much faster than the previous method that made big use of the modulo operator, something that mongo can’t index.

I should be done with this lookup system sometime tonight and I’ll make a post explaining a few things about it.

Purposely tired

Today was kind of boring. The night was also kind of boring. I’m not even all that sure what I did. I do know I did some reading. I was going to make a simple link shortener thing but decided that would be a wasted effort since there are so many out there it may be unoriginal. I may make one for personal use, one that indexes the pages that it makes a shortened link for. That way I can find pages that are interesting by keyword / make a “tag cloud” of sorts. I was thinking about writing an IO monad for node.js so that the asynchronous business can be “jailed away” in a monad, allowing for synchronous style coding; something that would greatly increase the number of users as they wouldn’t complain about being in an “asynchronous jail” monads have cool and useful properties for fixing things like that. I also started playing around with SuperCollider, this cool audio synth thing. There is a haskell binding to it to improve (?) the syntax of SuperCollider. I think this will be the first of my tumblr posts to be so long winded and unstructured as this. That’s partly due to the fact I’m writing this on my phone, partly because it’s late? Anyway, intentionally tired because I don’t want to be bored tomorrow. Oh and I was thinking about making a tumblr post about how people cynically ask why is there evil. I don’t know that my response to this is very long and the question has never caused me to wonder for a simple reason. I’m not sure that, in a cosmic sense, we know what evil is and that are interpretation seems a bit self centered. I haven’t heard this question recently but I believe people usually are refering to unnatural death. That is something to think about but then today I read about moderate hedonism which states that death is lack of sensation and thus is not good or evil. Fin.

Haven’t been on Tumblr in forever…

I need to post more interesting things. I’ve worked on a few things recently, one is a visualization of people’s friends at DeBakey at It works by simulating a system of springs and and point charges. Then using a gradient descent (Cal 3 FTW) it minimizes the potential energy of the system. It’s not so great though as their is no friction in the springs, as a result the springs bounce forever and the system never stabilizes. To add friction I’d need to set up a second order ODE, the friction is proportional to the velocity (the first derivative of position) and the energy is proportional to the acceleration (the second derivate).

I’ve read a few things and been thinking about philosophy a bit too (partly because I wondered a bookstore for three hours recently). I’m curious what DeBakey students are learning in the (brand new) philosophy class this year. Anyone in philosophy want to reblog this and tell me?

Anyway, I’ll think of something interesting to post tomorrow.

PageRank and social graphs

Recently the senior class voted on prom themes and there was also an additional field requesting people to select their friends. This was going to be used as an attempt to forecast possible winners of prom king and queen. My theory was that by using PageRank, an algorithm that Google uses to rank importance of a website, to determine the “most popular” people and thereby predict who will win prom king and queen. 


  • tried to survey people of their friends
  • use pagerank on the resulting graph determine most popular and predict prom king and queen winners
  • failed: not enough participants, people didn’t understand why, PageRank doesn’t seem to correlate with popularity.
  • other ideas?


Of the 209 seniors, 104 people voted on prom themes. There were three themes and each person was allowed to put a number for each theme between 1 and 10. The reason for this, rather than a first choice, second choice, third choice system was because some people feel adamantly about one about and really don’t want the other options, while some could careless. Those who careless generally give the themes about the same score, whereas those that really don’t want one theme can give it a low score relative to others. I had many 1,10,1 kinds of votes, and a number of 6,7,8 kinds of votes. Clearly some people felt stronger about this than others (I should’ve graphed participation between girls and boys, I’ll do that tomorrow). To determine the prom theme, the scores were averaged and the highest average was chosen. 

Now while less than half the class voted (almost half), the results are representative of the class. There was a clear theme which had a higher average than the other two, thus a complete class participation wouldn’t likely change the outcome (also those who didn’t vote didn’t care enough about the theme anyway).

At the bottom of the voting form was something for the voter to select all of their friends. The form required at least 3 friends to be selected. AT LEAST, most people only selected 3 friends and then submitted their vote. On a side note this says something about how attentive people read when they are directed from Facebook, or it may be that people didn’t have much time to list their friends (though there was a quick search as you type box).

I ran PageRank on this (initially the R implementation and then I coded my own) friend graph. While I got results of who the “most popular” people were, the results aren’t very conclusive. While the prom voting is, because those are simple stats, doing PageRank on a graph requires most of the graph, ideally the whole graph. With only half of the graph, the results are inconclusive.

Further, PageRank is useful for determining “good quality” web pages because it uses link data, what pages other people link to, to determine good pages. I don’t know if this analogy can apply to people, or at least I’m not sure of how to interpret this. When the “links” are friendship lines, what is being determined by finding the highest ranking people with PageRank? Most friendly, most popular, most influential? I’m not sure and I’d like to know your thoughts on this. 

Corona SDK is Awesome

I recently downloaded and started playing around with Corona. It’s really awesome. The Corona SDK allows developers to code for Android and iPhone using Lua, which is much more fun than Java. I’ve only made two really simple apps but I’ll soon have a more finished one for people to play with.

More Information