A 2D simple regression analysis.

Making Math Less Stressful With A Python Super-Calculator

In a recent write-up, [David Delony] explains how he built a Wolfram Mathematica-like engine with Python.

Core to the system is SymPy for symbolic math support. [David] said being able to work with symbolic math easily has helped his understanding of calculus and linear algebra. For statistics support he includes NumPy, pandas, and SciPy. NumPy is useful for creating multidimensional arrays and supports basic descriptive statistics such as mean, median, and standard deviation; pandas is a library for operating on tabular data arranged into “DataFrames”, it can load data from spreadsheets (including Excel) and relational databases; and SciPy is a “grab bag” of operations designed for scientific computing, it includes some useful statistics operations, including common probability distributions, such as the binomial, normal, and Student’s t-distribution.

For regression analysis [David] includes statsmodels and Pingouin. If you’re not familiar with the term “regression analysis” it basically refers to the process of curve fitting. When your data is two-dimensional, with one dependent variable, the simple linear regression algorithm will generate a function that fits the data as y = mx + b, including the slope (m) and the y-intercept (b); this can be extrapolated to higher dimensional data and other types of regression.

If you have an interest in symbolic math you might enjoy learning about Mathematica And Wolfram On The Raspberry Pi.

Creating Python GUIs With GIMP

GUI design can be a tedious job, requiring the use of specialist design tools and finding a suitable library that fits your use case. If you’re looking for a lightweight solution, though, you might consider just using a simple image editor with a nifty Python library that [Manish Kathuria] whipped up.

[Manish’s] intention was to create a better-looking user interface solution for Python apps that was also accessible. He’d previously considered other Python GUI options to be unimpressive, requiring a lot of code and delivering undesirable results. His solution enables the use of just about any graphic you can think of as a UI object, creating all kinds of visually-appealing possibilities. He also was eager to make sure his solution would work with irregular-shaped buttons, sliders, and other controls—a limitation popular libraries like Tkinter never quite got around.

The system simply works by using layered image files to create interactive interfaces, with a minimum of code required to define the parameters and performance of the interface. You’re not strictly limited to using the GIMP image editor, either; some of the examples use MS Paint instead. Files are on Github for those eager to try the library for themselves.

We’ve featured some neat GUI tools before, too, like this library for embedded environments. Video after the break.

Continue reading “Creating Python GUIs With GIMP”

Two hands working a TekaSketch

TekaSketch: Where Etch A Sketch Meets Graph Theory

The Etch A Sketch was never supposed to meet a Raspberry Pi, a camera, or a mathematical algorithm, but here we are. [Tekavou]’s Teka-Cam and TekaSketch are a two-part hack that transforms real photos into quite stunning, line-drawn Etch A Sketch art. Where turning the knobs only results in wobbly doodles, this machine plots out every curve and contour better than your fingertips ever could.

Essentially, this is a software hack mixed with hardware: an RPi Zero W 2, a camera module, Inkplate 6, and rotary encoders. Snap a picture, and the image is conveyed to a Mac Mini M4 Pro, where Python takes over. It’s stripped to black and white, and the software creates a skeleton of all black areas. It identifies corner bridges, and unleashes a modified Chinese Postman Algorithm to stitch everything into one continuous SVG path. That file then drives the encoders, producing a drawing that looks like a human with infinite patience and zero caffeine jitters. Originally, the RPi did all the work, but it was getting too slow so the Mac was brought in.

It’s graph theory turned to art, playful and serious at the same time, and it delivers quite unique pieces. [Tekavou] is planning on improving with video support. A bit of love for his efforts might accellerate his endeavours. Let us know in the comments below!

Continue reading “TekaSketch: Where Etch A Sketch Meets Graph Theory”

Wood bent into a spiral

Make Magical-Looking Furniture With Kerf Bend Wizard

The intersection between “woodworkers” and “programmers” is not a densely populated part of the Venn diagram, but [Michael Schiebler] is there with his Kerf Bend Wizard to help us make wood twist and bend like magic.

Kerf bending is a fine technique we have covered before: by cutting away material on the inside face of a piece of wood, you create an area weak enough to allow for bending. The question becomes: how much wood do I remove? And where? That’s where Kerf Bend Wizard comes to the rescue.

More after the break…

Continue reading “Make Magical-Looking Furniture With Kerf Bend Wizard”

ManiPylator focusing its laser pointer at a page.

Simulation And Motion Planning For 6DOF Robotic Arm

[Leo Goldstien] recently got in touch to let us know about a fascinating update he posted on the Hackaday.io page for ManiPylator — his 3D printed Six degrees of freedom, or 6DOF robotic arm.

This latest installment gives us a glimpse at what’s involved for command and control of such a device, as what goes into simulation and testing. Much of the requisite mathematics is introduced, along with a long list of links to further reading. The whole solution is based entirely on free and open source (FOSS) software, in fact a giant stack of such software including planning and simulation software on top of glue like MQTT message queues.

The practical exercise for this installment was to have the arm trace out the shape of a heart, given as a mathematical equation expressed in Python code, and it fared quite well. Measurements were taken! Science was done!

We last brought you word about this project in October of 2024. Since then, the project name has changed from “ManiPilator” to “ManiPylator”. Originally the name was a reference to the Raspberry Pi, but now the focus is on the Python programming language. But all the bot’s best friends just call him “Manny”.

If you want to get started with your own 6DOF robotic arm, [Leo] has traced out a path for you to follow. We’d love to hear about what you come up with!

Continue reading “Simulation And Motion Planning For 6DOF Robotic Arm”

Work, Eat, Sleep, Repeat: Become A Human Tamagotchi

When [Terence Grover] set out to build a Tamagotchi-inspired simulator, he didn’t just add a few modern tweaks. He ditched the entire concept and rebuilt it from the ground up. Forget cute wide-eyed blobby animals and pixel-poop. This Raspberry Pi-powered project ditches nostalgia in favour of brutal realism: inflation, burnout, capitalism, and the occasional existential crisis. Think Sims meets cyberpunk, rendered charmingly in Python on a low-res RGB LED matrix.

Instead of hunger and poop meters, this dystopian pet juggles Maslow’s hierarchy: hunger, rest, safety, social life, esteem, and money. Players make real-life-inspired decisions like working, socialising, and going into education – each affecting the stats in logical (and often unfair) ways. No free lunch here: food requires money, money requires mind-numbing labour, and labour tanks your rest. You can even die of overwork à la Amazon warehouse. The UI and animation logic are all hand-coded, and there’s a working buzzer, pixel-perfect sprite movement, and even mini-games to simulate job repetition.

It’s equal parts social commentary and pixel art fever dream. While we have covered Tamagotchi recreations some time ago, this one makes you the needy survivor. Want your own dystopia in 64×32? Head over to [Terence Grover]’s Github and fork the full open source code. We’ll be watching. The Tamagotchi certainly is.

Continue reading “Work, Eat, Sleep, Repeat: Become A Human Tamagotchi”

Hardware Built For Executing Python (Not Pythons)

Lots of microcontrollers will accept Python these days, with CircuitPython and MicroPython becoming ever more popular in recent years. However, there’s now a new player in town. Enter PyXL, a project to run Python directly in hardware for maximum speed.

What’s the deal with PyXL? “It’s actual Python executed in silicon,” notes the project site. “A custom toolchain compiles a .py file into CPython ByteCode, translates it to a custom assembly, and produces a binary that runs on a pipelined processor built from scratch.” Currently, there isn’t a hard silicon version of PyXL — no surprise given what it costs to make a chip from scratch. For now, it exists as logic running on a Zynq-7000 FPGA on a Arty-Z7-20 devboard. There’s an ARM CPU helping out with setup and memory tasks for now, but the Python code is executed entirely in dedicated hardware.

The headline feature of PyXL is speed. A comparison video demonstrates this with a measurement of GPIO latency. In this test, the PyXL runs at 100 MHz, achieving a round-trip latency of 480 nanoseconds. This is compared to MicroPython running on a PyBoard at 168 MHz, which achieves a much slower 15,000 nanoseconds by comparison. The project site claims PyXL can be 30x faster than MicroPython based on this result, or 50x faster when normalized for the clock speed differences.

Python has never been the most real-time of languages, but efforts like this attempt to push it this way. The aim is that it may finally be possible to write performance-critical code in Python from the outset. We’ve taken a look at Python in the embedded world before, too, albeit in very different contexts.

Continue reading “Hardware Built For Executing Python (Not Pythons)”