𝑒 Generator

2015-10-24, post № 75

mathematics, programming, Python, #(1+1/n)^n, #approx., #approximation, #constant, #e, #Euler

By using the formula \big(1+\frac{1}{n}\big)^n for a big number 𝑛, you can approximate the mathematical constant 𝑒.

Source code: e-generator.py


2015-10-18, post № 74

games, programming, Pygame, Python, #acceleration, #c't, #car, #mouse, #mouse controlled, #position, #race, #ractrack, #track, #vector, #velocity, #vertrac't

In a recent c’t article [1] they showed a game regarding vector mathematics, velocities, accelerations and positions.
I could not resist and wrote this program to simulate the game.
The only thing this program cannot do is to check the barriers. That you have to check for yourself.

The Game

You have a start position (red), an end position (green) and some barriers (white).
Your job is it to steer your little dot (bright yellow) onto the end position.
To make it more difficult, you are not allowed to change the dot’s position directly, but rather you accelerate it on each step.
Your acceleration vector (turquoise) also is not allowed to be longer than 𝟣𝟢 (dim yellow bubble) and at the end point your dot must have a velocity of (𝟢, 𝟢).

The fewer moves you need, the better your steering abilities.



  • Mouse movement changes the new acceleration vector applied in the next step,
  • Left click moves one step,
  • Right click is a undo for the latest move,
  • Middle click moves the frame,
  • ‘c’ clears all the moves made so far,
  • ‘e’ exports current moves to a .txt file,
  • ‘Space’ saves a screenshot.
Source code: ct-racetrack.py


2015-10-17, post № 73

programming, Pygame, Python, #black, #glow, #mouse, #mouse controlled, #pixels, #red, #specs, #spread, #vector, #vector maths

Tinkering around with vectors, I created this fancy program. By left-clicking you spawn a white circle at your current mouse position. This circle then will emit a specific quantity of red pixels (which is 𝑐 = 𝟤 𝜋 𝑟 with 𝑟 = 𝟧𝟢). Those red pixels then get pushed across the screen until they eventually die out.


  • Left click spawns in a circle,
  • ‘Space’ saves a screenshot.
Source code: flare.py
Jonathan Frech's blog; built 2021/04/16 21:21:49 CEST