Understanding the Discrete Fourier Transform in Signal Analysis

In previous posts on this blog I have already introduced the Fourier series and the Fourier transform, following their historical development from Joseph Fourier’s original work on heat conduction to their modern role in physics, engineering, and signal analysis. Rather than repeating that material here, I will take it as a starting point.

When we look at a signal — a sound wave, a vibration, or even a curve drawn by hand — we usually perceive it as a function of time or space. However, very often the most relevant information is not immediately visible in this representation. It is hidden in the frequencies that compose the signal, and in how strongly each of them contributes.

This is precisely the idea behind the Discrete Fourier Transform (DFT): to decompose a discrete signal into a finite sum of harmonic components, each characterized by an amplitude and a phase. Conceptually, the DFT is not a new theory, but a practical bridge between the continuous Fourier framework and the realities of digital data, measurements, and numerical simulations.

Rather than starting from abstract formulas, in this post I adopt a visual and experimental approach. The discussion is supported by an interactive program that allows one to draw an arbitrary signal and explore its harmonic content, and by a practical electronics project where Fourier analysis is applied to real sound and noise signals.

Continue reading →

Retro Programming Nostalgia VIII: 1926-2026 l’equazione di Schrödinger e la struttura elettronica dell’atomo d’idrogeno

Quest’anno ricorre l’anniversario della pubblicazione dell’articolo di Edwin Schrödinger (1887-1961) in cui viene introdotta la sua famosa equazione. Prendendo spunto da questa occasione, ho ripescato e rinnovato uno dei miei antichi progetti di programmazione in BASIC con i miei microcomputer negli anni ’80. Di nuovo il microcomputer era il mio amato Phillips MSX, di cui ho parlato in altri blog. Studiando chimica, non potevo non essere attratto dalla bellezza e dall’eleganza delle soluzioni dell’equazione di Schrödinger per l’atomo d’idrogeno. Inspirato dal libro (S. Marseglia, La Chimica col personal computer pubblicato dalla Muzzio) in cui mostrava alcuni esempi di programmi in BASIC per la chimica, decisi di imbarcarmi nell’impresa e usare l’MSX e poi l’Amiga Basic Basic per provare a riprodurre le bellissime visualizzazioni degli orbitali molecolari che vedevo nei libri di chimica universitari. Ma prima di questo vediamo di tornare a contenuto dell’articolo di Schrödinger.

Continue reading →

Christmas 2025: Growing Christmas Trees from Factorials

Christmas is a time for traditions, decorations, and—at least for some of us—quiet moments spent playing with ideas. In that spirit, this post is a small seasonal diversion: a recreational exploration of large factorial numbers, their historical computation, and an unusual way to see them. The inspiration comes from an old but delightful article by the great recreational mathematician  Martin Gardner, titled “In which a computer prints out mammoth polygonal factorials” (Scientific American, August 1967), in which he discusses the astonishing growth of the function

n! = 1 \cdot 2 \cdot 3 \cdots n

and the surprising difficulty computers once faced when trying to compute it for even modest values of n.

In this post, I will briefly describe the Smith bin algorithm for computing large factorials and present the result for the number 2025, arranged in a geometric form. After all, if numbers are going to grow explosively, why not let them grow into Christmas trees for 2025?

Continue reading →

Principal Component Analysis: Key to Analyzing Biomolecular Dynamics

I have recently written, for WIREs Computational Molecular Science, a review article on the use of Principal Component Analysis (PCA) in the study of dynamical systems, with a particular focus on molecular dynamics (MD) simulations of biomolecules [1]. The aim of this work is to provide a clear and practical overview of how PCA has become a central tool for extracting meaningful collective motions from high-dimensional simulation data, and how modern methodological extensions continue to expand its capabilities.

Continue reading →

RaPenduLa: Una Video piattaforma Fai-Da-Te Per Studiare Oscillazioni Meccaniche

Qualche giorno fa ho pubblicato un nuovo progetto educativo sul mio sito Instructables. Il dispositivo, che ho battezzato RaPenduLa (dalle iniziali in inglese di RaspPi Pendulum Laboratory), è stato ribattezzato in italiano CAMPO (Computer Analisi Moto Pendolare Oscillante) grazie a un suggerimento di ChatGPT. Ma, come direbbe Shakespeare, ‘What’s in a name? That which we call a rose by any other name would smell as sweet’: il cuore del progetto è infatti una piattaforma video per lo studio delle oscillazioni meccaniche. Utilizzando un Raspberry Pi Zero W2 dotato di modulo fotocamera, il sistema registra ad alta velocità il movimento dei pendoli. Poi, con un’analisi video basata su Python e OpenCV, RaPenduLa è in grado di tracciare il percorso preciso della punta del pendolo, visualizzandone il comportamento oscillatorio in 2D.

Continue reading →

Easter 2025: Exploring Egg-Shaped Billiards

It has become a recurrent habit for me to write a blog on the shape of eggs to wish you a Happy Easter. Not repeating oneself and finding a new interesting topic is a brainstorming exercise of lateral thinking and a systematic search in literature to find an interesting connection. This year, I wanted to explore an idea that has been lurching in my mind for some time for other reasons: billiards.

I used to play snooker from time to time with some old friends. I am a far cry from being even an amateur in the billiard games, but I had a lot of fun verifying the laws of mechanics on a green table. I soon discovered that studying the dynamics of bouncing collision of an ideal cue ball in billiards of different shapes keeps brilliant mathematicians and physicists engaged in recreational academic studies and important theoretical implications.

Continue reading →

RaPenduLa: A DIY Video Platform for Exploring Mechanical Oscillations

I have recently published another educational project on my Instructables website. I called the device RaPenduLa for the RaspPi Pendulum Laboratory, and it is a video platform for studying mechanical oscillations. It uses a Raspberry Pi Zero W2 equipped with a camera module to record the motion of pendulums at high speed. The interesting part happens through video analysis: using Python and the fantastic OpenCV library, RaPenduLa can track the precise path of a pendulum’s tip and help visualize its oscillatory behavior in two dimensions.

Continue reading →

Season’s Greetings with Diffusion-Limited Aggregation!


As the year comes to a close, let us take a moment to reflect on the beauty of nature and the profound patterns that can arise from simple rules. Inspired by the Diffusion-Limited Aggregation (DLA) simulation—a concept that creates mesmerizing structures from chaotic randomness—we find parallels between its patterns and the essence of the holiday season.

The animation featured here was created using my DLA simulator, written in Awk, my favorite programming language. This program simulates the deposition of randomly diffusing particles in two dimensions. In this case, it mimics the formation of snowflakes or coriander-like clusters, with particles meandering through randomness to form intricate fractal structures.

These patterns remind us how small, individual efforts can come together to create something extraordinary. Be it family gatherings, acts of kindness, or moments of generosity, each step contributes to a larger, beautiful picture—much like how particles aggregate to form stunning natural structures such as snowflakes, coral reefs, or mineral deposits.

Wishing You:

🎄 Fractal Joy: Let your happiness grow in beautiful and unexpected ways.

🌟 Boundless Creativity: Like the Moore and von Neumann neighborhoods in the simulation, embrace different perspectives to expand your horizons.

❄️ Peace and Harmony: May your life’s matrix be filled with meaningful connections and serene moments.

May your holidays be filled with love, joy, and wonder — and may your 2024 be as inspiring as the intricate patterns of life itself!

Happy Holidays! 🌟

How Surfactant Chain Length Shapes Protein Binding

Surfactants are everywhere in protein science — from biochemical laboratories to industrial detergents. Among them, sodium dodecyl sulfate (SDS) is perhaps the most famous (or infamous), widely used for its ability to bind, deactivate, and often denature proteins. Despite decades of experimental and theoretical work, the molecular details of how surfactants bind to protein surfaces are still not fully understood. In my recent study, “Binding Dynamics of Linear Alkyl-sulfates of Different Chain Lengths on a Protein Surface” [1], I have explored this problem using molecular dynamics (MD) simulations, focusing on how the length of the surfactant’s hydrocarbon chain influences protein binding.

Continue reading →

Chlorophyll in Tight Spaces: How Silica Nanoconfinement Stabilizes Photosynthetic Pigments

In a recent molecular dynamics study [1] in collaboration with Prof. K. J. Karki (Department of Physics, Guangdong Technion-Israel Institute of Technology in China), we explored how EthylChlorophyllide a behaves when confined between two silica surfaces — a situation relevant for artificial photosynthesis, nanomaterials, and bio-inspired light-harvesting systems. Chlorophylls are among the most important molecules on Earth. They enable plants, algae, and photosynthetic bacteria to convert sunlight into chemical energy. Yet, outside their natural protein environment, chlorophyll molecules are fragile as they can easily lose their central magnesium ion (demetallation), they degrade under light, and they tend to aggregate uncontrollably in solution.

In natural photosynthetic systems, proteins protect and organize chlorophylls. Reproducing this level of control in artificial systems remains a major challenge. One promising strategy is nanoconfinement — trapping chlorophyll derivatives inside well-defined inorganic structures such as silica nanopores.

Continue reading →