python4enlightening

the open notebook

Fundamentals of Estimation Theory

The Mathematical Estimation Problem

Since our study group has planned to design a poly tuner, by utilizing multi pitch estimation, this is a brief investigation into the basics of estimation theory.

The \(N\)-point dataset is \(\texttt{x} = x(n) = \{x[0], x[1], ... ,x[N-1] \}\) is dependent on an ...

Matlab Code in iPython Notebook

I was very pleased today to find out that some people made a library which makes it possible to utilize MATLAB code directly in the iPython Notebook, which this webpage is written in. As you see in the In[134] the library is called pymatbridge. For me personally this is ...

Fibonacci Mystery Pythonified

The Fibonacci numbers are generated by setting \(F(0)=0, F(1)=1\), and then using the recursive formula \[ \begin{equation} F(n) = F(n-1) + F(n-2) \end{equation} \] to get the rest. Thus the sequence begins: \(0, 1, 1, 2, 3, 5, 8, 13, 21, 34,\) ...

Leonardo of Pisa ...

A root less evil

Since it sometimes is required to calculate the square root of some number. This job is straight forward by solving the 2nd order equation for the square root of 2 i.e. \[ \begin{equation} x^2 − 2 = 0 \Rightarrow x = \sqrt{2} \approx 1.41 \end{equation} \]

However, when we ...

Plotting Polynomial InterPolation

This post is a note where I gain some experience with Python matplotlib and linear equations with NumPy. This post is initialized with a specific solution for only the quadratic polynomial. At the end of this post there is a program which generalizes the order of the polynomial solution and ...

Test of uploading posts

A few weeks ago, Fernando Perez, the creator of IPython, wrote a post about blogging with IPython notebooks. I decided to take a stab at making this work in Octopress.

I started by following Fernando's outline: I first went to http://github.com/ipython/nbconvert and obtained the current version of the notebook converter. Running nbconvert.py -f blogger-html filename.ipynb produces a separate html and header file with the notebook content. I inserted the stylesheet info into my header (in octopress, the default location is source/_includes/custom/head.html) and copied the html directly into my post.

I immediately encountered a problem. nbconvert uses global CSS classes and style markups, and some of these (notably the "hightlight" class and the <pre> tag formatting) conflict with styles defined in my octopress theme. The result was that every post in my blog ended up looking like an ugly hybrid of octopress and an ipython notebook. Not very nice.

So I did some surgery. Admittedly, this is a terrible hack, but the following code takes the files output by nbconvert, slices them up, and creates a specific set of CSS classes for the notebook markup, such that there's no longer a conflict with the native octopress styles (you can download this script here):