Michael Landis

new year, new site

04 Jan 2014

For the past year, I hosted my research progress on Google Sites. This is a wonderful free option for hosting cookie-cutter websites. Unfortunately, executing arbitrary Javascript within Google Sites was not permitted for security reasons. Because of this, I never managed to configure Google Sites to properly display syntax-colored code blocks or LaTeX-based equations.

I moved my content to GitHub Pages which is compatible with Jekyll-generated static content. Jekyll supports MathJax and Pygments, enabling LaTeX-rendering and code-syntax-highlighting, respectively.

For example, a Jekyll Markdown post containing the code

$$
L_{l}^{(i)} (s) = \left[ 
        \sum_{s_{j}} \text{Prob} (s_j \mid s, v_j) L_{j}^{(i)}(s_j)
    \right] \times \left[
        \sum_{s_{k}} \text{Prob} (s_k \mid s, v_k) L_{k}^{(i)}(s_k)
    \right]
$$

with MathJax produces

…and the code

{% highlight python %}
def f(L,tp,j,k,l):
    for sl,ll in enumerate(L[l]):
        llj = sum([ lj * tp[l,j,sl,sj] for sj,lj in enumerate(L[j]) ])
        llk = sum([ lk * tp[l,k,sl,sk] for sk,lk in enumerate(L[k]) ])
        L[l,sl] = llj * llk
{% endhighlight %}

with Pygments produces

def f(L,tp,j,k,l):
    for sl,ll in enumerate(L[l]):
        llj = sum([ lj * tp[l,j,sl,sj] for sj,lj in enumerate(L[j]) ])
        llk = sum([ lk * tp[l,k,sl,sk] for sk,lk in enumerate(L[k]) ])
        L[l,sl] = llj * llk

…and voilà! We have a major component of Felsenstein’s pruning algorithm!

With these features working, I’m looking forward to writing practical posts containing code snippets or educational posts dissecting the math we use to model evolution.

All the code used for the site (and this post) are located at http://github.com/mlandis/mlandis.github.io.