Thursday, January 22, 2015

IPython Notebooks

So while I wasn't paying attention, the Python scripting language has turned into an incredible tool for scientific math. I was aware of the badass numerical package numpy, but [IPython] has integrated it with amazing math (LaTeX) and graphics (matplotlib) display packages into a powerful tool for mathematical exploration.

Because MathJax is used for rendering LaTeX, this post is mostly an experiment to see how much of a IPython notebook I can cram into my blogging platform (Staceyapp). I was hoping I could inline some Notebook charts'n'graphs but turns out I can't without hacking IPython's HTML (rendered with 1500 lines of css) into the Staceyapp templating engine, which is a task for another time...

What I can do is simply link to the converted notebook page: Here's a test notebook to check out.

But MathJax is pretty awesome, here's a little test of rendering some LaTeX. Let's try Schrödinger's Equation:

$$ \left [ – \frac{\hbar^2}{2 m} \frac{\partial^2}{\partial x^2} + V \right ] \Psi = i \hbar \frac{\partial}{\partial t} \Psi $$

Holy moly, that seemed to work! Take a look at the page source to see how easy that was.

Tip for installing IPython on Windows: because I have another Python package manager because client, I found the usual "pip install" didn't work and I had to manually install a lot of dependencies. Fortunately Christopher Gohlke at at UCI has made a lot of precompiled Python binaries available and they are super handy.

Update 2020 Installation is a lot easier today! I recommend the Anaconda distribution. Even easier, if you have a Google account you can use IPython notebooks right in your Google drive.

Tagged: SW hacks



RSSicon.png  RSS feed