Ipython: simple finite differences

Ipython as a prototyping tool for scientific computation is very neat and useful indeed.
After the Win 8 minimal installation reviewed in a previous post, now we are going for some simple Crank Nicolson of a parabolic PDE. We are going to have non-degenerate diffusions, as we don’t want the problem to become hyperbolic and to lose parabolic smoothing.

To run the notebook, one simply needs some more libraries, “numpy” and “matplotlib”.
They can be obtained as precompiled “wheel” files courtesy of Christoph Gohlke
from here.

After the relevant wheel files have been downloaded, simply run cmd (as administrator) and issue
from the directory where they have been saved:

pip install "numpy_my_version.whl"
pip install "matplotlib_my_version.whl"

(where of course the suffix “my_version” has to be changed into whatever the version is).
This zip contains a modified version of some buggy notebook found over the internet. It is now fully working in Python >= 3.x.
After uploading in the usual way, run it. The Finite Difference stencil is easily computed, and the heatmap is nicely displayed. Latex is there as well to document the mathematical steps.
Literate Programming at its best.



Categories: Computing

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: