Minimalistic and maintainable Python extensions

The last 10 year have show that Python is versatile enough and fast enough for general purpose computations. An exception to this may be solving problems that require to juggle a very large number of intricately connected objects, e.g. when implementing a CAD program or a rendering engine and which are better done using a language with more direct access to the computer’s hardware. In Python, data-heavy computations can often be accomplished efficiently with numpy and other specialized libraries. Occansionally however one runs into a specific problem that can’t be solved efficiently with the availably libraries or where adding a extra dependency is an unfavorable option (e.g. for licensing, security, or maintenance issues). In that case, builing a C extension module is often a good solution to optimize the slow code.

Read More

Euclidean distance between quaterions

Quaterions are a generalization of complex numbers that have three distinct imgaginary components instead of one (in addition to the one real component). Like the space of complex numbers can be represented with the 2-D plane, quaterions can be represented as points in 4-D space. The analogies do not end there: the unit circle in the complex plane is equivalent to the set of orientation angles $\phi$ in 2-D (there is just one orientation angle in 2-D). The 3-D unit sphere in the 4-D space of quaternions is equivalent to the orientation of a rigid body in 3-D space. Alternative ways to describe orientation in 3-D are the three Euler angles $\psi$, $\theta$, $\phi$. The three Euler angles are related to the yaw, pitch, and roll angles or ships and aircrafts.

Read More

numpy argsort incantations

“You seem to be a big fan of the numpy.argsort method, Fabian, since you recommend it so frequently…”, my colleague Raj approached me last Friday in the lab.

Read More

Braess-Paradox in Greifswald

Im diesjährigen Vortrag auf der Semesterfahrt geht es um das “Braess-Paradox”, das in verschiedenen Netzwerken wie z.B. in Strom-Netzwerken auftreten kann.

Read More

Dead cat bounce simulation

This is a bunch of discs that do inelastic collisions. Gravity pulls them down but the piston in the floor tosses them up. What do you expect to be the long time behavior of the simulation? Figure it out or … relax and observe. :)

Read More

Solitonen als Flachwasserwellen

Solitonen sind Lösungen einer partiellen nichtlinearen Differentialgleichung, die teilchenartige Eigenschaften aufweisen. Wir behandeln speziell die Korteweg-de-Vries-Gleichung.

Read More

Laser-Akkustik-Gitarre

Mittlerweile wird auf jeder zweiten populärwissenschaftlichen Veranstaltung der ,,Laser-Bass’’ gespielt. Dabei handelt es sich im wesentlichen um ein gespannetes Gummiband, das sich in einer Lichtschranke befindet, die wiederum mit einem fetten Lautsprecher verbunden ist.

Read More