How I teach physics using open source tools |

How I teach physics using open source tools

A roundup of open source tools ideal for teaching physics (and other subjects).

Person reading a book and digital copy

Subscribe now

Get the highlights in your inbox every week.

The nice aspect of being a physicist and a researcher is the openness of our community. There is a lot of collaboration and sharing of ideas (especially during coffee breaks). We also tend to share the software we write. Since we are very picky about algorithms, we want to modify other people’s code to fix the obvious errors that we find. It feels frustrating when I have to use proprietary tools since I cannot understand their inner workings. Having grown up professionally in such an environment, open source has been my go-to solution for all the software I use.

When I became the regular teacher of the Physics and Biophysics course at the medical school at my university, I decided to use only open source software to prepare my lectures. Here is my experience so far and the solutions I found.

Study material

Teaching is not easy. You should first understand the subject and then figure out how to communicate with somebody that knows nothing about the subject; therefore, it is of paramount importance to study the subject in depth and prepare the lectures well in advance. There are countless books about physics, but there are also some interesting, freely available resources. Most of these do not count as open source, as they cannot be modified, but they are useful anyways.

  • HyperPhysics may have an outdated look, but it is a treasure trove of interesting concepts and insights by Carl R. Nave, Department of Physics and Astronomy Georgia State University.
  • Open Source Physics has a fabulous collection of applets and support material. I met some of the maintainers at various conferences, and they are remarkable people.
  • OpenStax is a nonprofit educational initiative based at Rice University that publishes textbooks that are free online. They have a good library and several works about physics in their scientific section.
  • Open Textbook Library provides a catalog of free textbooks with a physics section as well. Some of the titles have reviews by users.
  • Motion Mountain is a collection of books about physics in general by C. Schiller that has also been translated into several languages.
  • Light and Matter is another collection of writings about different aspects of physics, all authored by B. Crowell of Fullerton College, CA.
  • Wikipedia, what more can I say?

Lecturing style

Before preparing my support material, I had to decide whether I preferred to use the blackboard or slideshows during the lectures. I opted to use both with the idea of showing hard-to-draw graphics in the slideshows and writing down equations on the blackboard. Eventually, the slideshows became much more prevalent. I use them as the draft of my lecture, helping me to keep track of what I want to say. I also added the mathematical proofs that I want to show to have a correct reference during the lecture.

Instead of using a blackboard, I ended up using a graphics tablet for all the notes I write during the lectures. I use the tablet for three main purposes: to draw additional drawings to explain myself better, to write down equations and proofs, and to write down the key messages that I want my students to remember. Even if what I write is already on the slideshows, actually writing it by hand during the lectures gives the students the time to write it down in their notes. After the lectures, I share, on my website, both the slideshows and my notes.


Figure: Example of notes taken during class with the graphics tablet and Krita

Figure: Example of notes taken during class with the graphics tablet and Krita

Material preparation


Since math is the language of physics, I needed a practical way to write down equations in my slideshows. Probably, the best tool for that is LaTeX, but it was designed to typeset books and not slides. Luckily, there is the Beamer class that allows you to typeset slideshows with LaTeX. The resulting file is a very portable PDF. The layout is nice and clean and forces me not to overstuff each slide. From the same source code, I can prepare two versions of the file. The lecture version follows the guidelines of the university’s corporate identity (i.e., with a thick red border), while the handout version has a cleaner layout (e.g., without the thick borders), thus allowing it to be printed without wasting printer toner. I have also seen students taking notes directly on the PDFs of the handouts on their tablets and computers.

The only drawback of using LaTeX and Beamer is the impossibility of embedding videos in the produced presentation. I, therefore, have to keep as a separate file the occasional videos that I show during class.


Figure: Examples of slides created with LaTeX and Beamer

Figure: Examples of slides created with LaTeX and Beamer


Figure: Examples of slides created with LaTeX and Beamer

Figure: Examples of slides created with LaTeX and Beamer

Images and diagrams

Something that I am careful about is the licensing of the graphics I use. As such, I never use graphics that do not allow me to redistribute my modifications. I drew most of the images in my slideshows. If I use other people’s work, I always reference it in my slide.

I prefer to use vector graphics whenever practicable because they can be easily modified and adjusted afterward. I use the exceptional Inkscape for my vector graphics. On the other hand, for my raster graphics, I use GIMP. When I need a 3D looking diagram, I use Blender to draw the scene; then I trace the rendered image with Inkscape to convert it to vectorial. I recently discovered FreeCAD, which has the striking feature that it can directly export the 3D scene to some vectorial format. I can then adjust the image with Inkscape without having to trace the raster image.

In all my diagrams, I am trying to keep a consistent look, and therefore I limit myself to a 10-color palette, both from d3 and matplotlib. I also use the same palette in my slides to highlight quantities in reference to the illustrations. To produce plots and graphs, I write Python scripts and employ the matplotlib graphical library.


Figure: Diagram example created with Inkscape by tracing a Blender 3D diagram

Figure: Diagram example created with Inkscape by tracing a Blender 3D diagram

Multimedia support

I have prepared a few pages with applets that demonstrate some phenomena that I describe during my lectures (e.g., modeling radioactive decay with dice). I opted to offer these applets on my institutional webpage to easily reach all the students instead of requiring them to install software to run them. The necessary choice was to employ JavaScript and some supporting libraries, such as jQuery for compatibility between browsers, MathJax for typesetting math in the webpages, or d3 for graphics display. Since my institution does not provide the capability of writing dynamic webpages, I am using Jekyll, which is a static site generator. Jekyll allows me to have a consistent look and feel across all the pages without having to write HTML code.


Figure: Dice modeling radioactive decay, image of the interactive simulation

Figure: Dice modeling radioactive decay, image of the interactive simulation

Lecturing software

Since my slideshows are PDF files, to show them during the lecture, I use the default document viewer of my GNOME 3 desktop environment. There is also the alternative of using Okular, which allows annotating the PDFs, but I prefer not to use it, as the annotations would not be carried over to the handouts. In conjunction with the graphical tablet, I use the excellent painting program Krita. I use the image layers as new pages of my notes. This approach is more practical during the lecture than creating a series of new files. I can also duplicate layers and edit them or load vectorial images and draw over them. Krita has the possibility of writing custom Python plugins, so I prepared a script that exports a PDF file with a new page for each layer.


Figure: Screenshot of Krita used in class to write notes

Figure: Screenshot of Krita used in class to write notes

When we go through exercises in class, I use the calculator Qalculate to obtain numerical results. Its particular feature is that it can perform calculations with units associated with the numbers. I can focus more on the exercise resolution than on the units’ conversions. This is a double-edged sword, though, as the students would not learn how to do the conversions themselves. Therefore, I normally start to use Qalculate halfway through the course. wxMaxima can also support exercise resolution, symbolically solving some difficult equations.


Figure: Screenshot of Qalculate

Figure: Screenshot of Qalculate

Video lectures

Sometimes I offer streaming lectures on YouTube, or I upload a video with additional mini-lectures. It has happened that the students have wanted a more in-depth explanation of some subjects. Offering these as a video allows them to take their time to listen and understand the subjects. For these videos, I use OBS studio, which can record or directly stream videos to YouTube. OBS can put on the video scene the screen image and some additional video sources, such as a web camera. To edit the videos, I have been using OpenShot.


Figure: Screenshot of OBS studio recording the screen

Figure: Screenshot of OBS studio recording the screen


This is the set of open source tools that I have been using to prepare and support my lectures. Over the years, I changed some of them whenever I discovered some better fitting tools or if I changed my lecturing style. To be frank, due to laziness, one of the requirements for all the tools is that they have to be easily installable. I use Fedora on my laptop, and its repository has packages for all this software. On the CentOS installation of my desktop computer, I had worse luck. For instance, Krita and OBS are available only through Flatpak.

Writing this article just made me realize how many tools I am actively using for my lectures. Maybe there are some all-in-one solutions, such as LibreOffice Impress, but I am very satisfied with the results I am getting. Besides, all this software has other useful applications.

Leave comments if you have questions.

Teacher or learner?

A free and fun way to learn by teaching others.
Person reading a book and digital copy

Explore new technologies with's top 12 articles from 2019 about learning an open source technology.
A circuit design in lights

Quantum computing is promising, provided we overcome hurdles preventing it from moving deeper into the real world.

About the author

Cristiano L. Fontana - Cristiano L. Fontana was a researcher at the Physics and Astronomy Department "Galileo Galilei" of the University of Padova (Italy) and moved to other new experiences.