Using Mayavi to visualize electric fields

Mayavi renders great field line plots.

While searching for a good Python module to visualize electric fields, I found Mayavi. Developed by Enthought, Mayavi is a very good module for visualizing a huge range of different scientific data sets. Everything from surfaces, flows and streamlines to bar charts, 3D plots and contour surfs are beautifully drawn on screen and exported to several file formats, such as PDF, PNG, EPS and more.

What I needed it for, however, was to visualize electric field lines in the course FYS1120 at the University of Oslo. We were told to use Matlab with the streamline and quiver functions, but even so, I wanted to use Python and decided to do a search and see if something similar was possible with Python. It took me some time to figure out how to use the scitools package to do streamline plots, but eventually I made it. However, these were a bit tedious to get working correctly and looked only about as good as the Matlab plots.

Continue reading

The FYS1120 Weekly Assignment Post #1

There is no solution manual to the FYS1120 (electromagnetism) weekly assignments, so we tought it was a good idea to start posting suggestions to answers here with the aim that other students at fys1120 can crosscheck their answers somewhere  and eventually if they don’t agree or just want to know how the answers was obtained start a discussion about them in the comments.

We’ll try to start a system so that if others want to submit suggestions before we’ve manged to post them, they can.

Continue reading