SVG may not be the most obvious choice for depicting a 3-D object, but with some care over the perspective and ordering of the plotted points, it can be done. The code is below and relies on a single import for the colour scheme, palettes.py, …
This is a simple Python function to generate a clock face indicating a specified time. It can be used in the script below to generate 1, 2, 4 or 6 faces indicating random times to teach children how to tell the time. Run this script …
Truchet Tiles are decorated squares which can tile a plane to create a pattern. For example, the four tiles: can be placed at random orientations to yield a non-repeating pattern: Similarly the two types of tile consisting of two quarter-circles in diagonally-opposite vertices of a …
The following code illustrates the effect of the initial velocity on the dynamics of an object released in a gravitational field. A very simple numerical integration of the equation of motion gives the trajectory, which is plotted below for four different initial speeds for a …
The following code plots a two-dimensional object and its bounding box for several rotations about an arbitrary point. Three types of bounding box are considered: (1) the original bounding box, rotated by the same amount as the object, (2) the bounding box to that bounding …
A Moiré pattern is an interference pattern that occurs when two grids of repeating lines or shapes are rotated by a small amount relative to one another (oblig. xkcd). A recent application concerned the experimental verification of Hofstadter's butterfly: Douglas Hofstadter (he of Gödel, Escher, …
A charged particle of mass and charge moving with a velocity in an an electric field and a magnetic field is subject to a Lorentz force, , given by The equation of motion for a single particle is therefore given by Newton's second law as …
Sometimes it is necessary to rotate a text annotation in a Matplotlib figure so that it is aligned with a line plotted on the figure Axes. Axes.annotation takes an argument, rotation, to allow a text label to be rotated, and a naive implementation might be …
Two important parameters in plasma physics are the electron Debye length, , a measure of the distance over which charge-screening effects occur and deviations from quasi-neutrality are observed, and the number of paricles in a "Debye cube" (of side length ), . In terms of …
An important concept in plasma physics is the Debye length, which describes the screening of a charge's electrostatic potential due to the net effect of the interactions it undergoes with the other mobile charges (electrons and ions) in the system. It can be shown that, …