The Dandelion (Taraxacum Officinalis) and OpenCV

The dandelion’s pallid tube
Astonishes the grass,
And winter instantly becomes
An Infinite Alas —

The tube uplifts a signal Bud
And then a shouting Flower, —
The Proclamation of the Suns
That septulture is o’er.

– Emily Dickinson

The yellow flowers and the delicate and beautiful inflorescence of Dandelion catch the attention of both romantic and curious souls. The aerial consistency of the fine silk decorated seeds that glance to the sunlight as crystalline material became the favorite subject of the inspired photographers and the toy of amused children. Besides the grace of its forms, other interesting and the curious secret is hidden in its phloem fluids. In fact, if you cut one of the stems of the plant, a milky, sticky liquid will flow out of the wound resection. This latex is going to polymerize at 30-35 oC in a few minutes in a yellow-brown quite solid mass. Around the year 1982, I have annotated this observation but I could not find in my later notes further follow-ups study on the topics. It was a casual observation but I didn’t know at that time that this latex is indeed very useful. A variety of the Taraxacum (Taraxacum koksaghyz, Russian Dandelion) was used in Russian and American to produce a replacement of the natural rubber from Brazil during WWII that was in shortage because of the war. Many studies are in progress to exploit the lattice of Taraxacum and  Taraxacum brevicorniculatumas, a convenient replacement for the rubber plant lattice. A recent study has shown the presence of rubber particles in the lattice of these plants in 32% proportion composed prevalently by poly(cis-1,4-isoprene) at >95% purity (www.biomedcentral.com/1471-2091/11/11). The brownish lattice condensate that, as I reported in my note, forms after exposing the latex to the air for several minutes is caused by the presence of the polyphenol oxidase (PPO) enzyme that produces the fast coagulation of the latex by catalysing the oxidation of polyphenols. Genetic engineering the plant makes it possible to reduce the amount of PPO in the latex, making economically competitive use of this resource for latex production.

Continue reading

Programming in Awk Language. LiStaLiA: Little Statistics Library in Awk. Part I.

In the following previous Awk programming articles

The AWK Programming Language

Awk Programming II: Life in a Shell

Awk Programming III: the One-Dimensional Cellular Automaton

I have briefly introduced this handy Unix program by showing two examples of elaborate applications. In this fourth article of the series, I will offer a little library of functions that can be used for the essential statistical analysis of data sets. I have written (and rewritten) many of these functions, but I have spent little time collecting them in a library that can be used by other users. So this article gives me the motivation to achieve this target. Unfortunately, I didn’t extensively test the library, so I am releasing it as an alpha version. If you spot errors or improve it, please just send me your modified code!

READING DATA SETS

We start with a function that can be used to read data from a text file (ascii format). A good data reader should be able to read common data format such as comma separated (cvs) or space separated data files. It should also be able to spik blank lines or lines starting with special characters. It would be also handy to select the columns that need to be read and also check and skip lines with inconsistent data sets (missing data or NaNs). This is what exacty work the function ReadData() given in the Appendix. But shall we see it more in details.

ReadData(filename,fsep,skipchr,warn,range,ndata,data)

The function read the data from a file with name provided in the variable filename. The program skips all empty record, those starting with one of the characters contained in the regular expression skipchar. For example, a regular expressions such as skipchr=”@|#|;” skips the occurrence of the characters “at” or “hash” or semicolomn. The variable warn is used to check the behavior of the program if alphabetic characters or NaN or INF values are present in the data. If the variable is set to 0, the function gives a warning without stop the program, if set to 1 then the function terminate the program after the first warning.

The field separator is specified in fsep and it is used to set the awk internal variable FS and define the separator between data. The variable can be assigned with single character such as fsep=” “ or fsep=”,” or ESC codes such as fsep=FS=”\t” for tab-delimited.

The column in the data record can be read in two ways by set the element zero of the array range[]. For range[0]=0, a adjoint range of data is specified by setting the first element is at range[1] the last one in range[2]. For range[0]=1, the first element in range[1] is the number of data to read followed by the specific field in the record where the data is located.

Continue reading

Retro programming nostalgia IV: L’Equilibrio e la Titolazione Acido/Base (Parte I)

La motivazione per questo articolo nasce dal mio interesse per il retro-computing connesso, da una parte, alla rivalutazione delle mie esplorazioni giovanili del calcolo scientifico in linguaggio BASIC e dall’altra, alla popolarità che, negli ultimi anni, stanno avendo nel settore amatoriale e della didattica i microcomputer su scheda singola  (single-board computer, quali, per esempio  il Raspberry Pi).  Questi piccoli computer hanno una potenza considerevolmente maggiore a un costo decisamente inferiore dei microcalcolatori degli anni 80. Questo ha reso possibile l’emulazione su questi calcolatori dei sistemi operativi di mitici modelli di home computer della Commodore e i modelli MSX.

Pertanto sta prendendo piede anche un rinnovato interesse nel linguaggio di programmazione BASIC. Questo interesse nel retro-computing riflette la nostalgia nelle grandi emozioni che negli anni 70-80 lo sviluppo della tecnologia informatica consumistica ha portato alla mia generazione. Ricordo che rimasi folgorato dalla creatività nell’uso e nella programmazione di questi microcomputer al punto che ha ridiretto i miei interessi scientifici e la mia carriera accademica. 

Ho raccontato in altri articoli delle mie prime avventure di programmazione con  home computer della Commodore e i sistemi MSX alla fine degli anni ’80 e inizi degli anni ’90 e delle mie riscoperte di archeologia informatica. Tra i reperti ho rinvenuto un piccolo programma che ho usato per studiare le titolazioni acido/base sviluppato in MSX BASIC. Pertanto ho colto l’occasione per scrivere delle note sull’equilibrio acido base  e la titolazione e quindi fornire una versione restaurata e migliorate del mio programma, a gli studenti appassionati di programmazione  che sono  alle prese con questo importante concetto della chimica analitica.

Continue reading

Integrazione Numerica di Equazioni Differenziali: 50 anni fa l’uomo ha messo piede sulla Luna. Parte II

Questo è il secondo articolo di questa serie dedicata alla soluzione numerica delle equazioni differenziali. La serie prende spunto dagli eventi che hanno portato l’uomo sulla Luna.

Nel luglio del 2019, quando ho iniziato a scrivere questo articolo, ricorreva il 50esimo anniversario della missione Apollo 11 (Neil A. Armstrong, Edwin A. Aldrin and Michael Collins) in cui gli astronauti Armstrong, Aldrin hanno posato il piede sulla superficie lunare. Un evento epocale nella storia umana che segna anche l’inizio della esplorazione spaziale. Dopo 50 anni, la NASA come altre agenzia spaziali e compagnie private, si stanno preparando per tornare sulla Luna per creare avamposti per l’esplorazione umana di pianeti più distanti come per esempio Marte. Questo anniversario mi portò ad interessarmi per raccogleire idee per la mia attività d’insegnamento e per curiosità personale, alle tecniche d’integrazione numerica delle equazioni differenziali usate per effettuare i calcoli delle traiettorie dal sistema di guida delle astronavi Apollo e dai calcolatori che hanno assistito l’impresa dalla Terra. In questo articolo semi divulgativo riassumo le informazione che ho raccolto leggendo (in maniera incompleta) la documentazione della NASA e quella ottenuta leggendo dei libri sull’argomento. Come mio solito presenterò anche dei semplici programmi che implementano questo algoritmi.

Continue reading

The First 150 Years of the Periodic Table of the Elements

That the nobility of man, acquired in a hundred centuries of trial and error, lay in making himself the conquerer of matter, and that I had enrolled in chemistry because I wanted to remain faithful to this nobility. That conquering matter is to understand it, and understanding matter is necessary to understanding the universe and ourselves: and that therefore Mendeleev’s Periodic Table, which just during those weeks we were laboriously learning to unravel, was poetry, loftier and more solemn than all the poetry we had swallowed down in liceo; and come to think of it, it even rhymed!

Primo Levi, The Periodic Table.

This year marks the 150th anniversary of the periodic table of the elements (TPE) which currently has 118 entries, the latest arrival (the Tennessine) was discovered 10 years ago (announced in April 2010), and I feel obliged as a chemist to give some a small informative contribution to celebrate this important event.

Continue reading

Retro programming nostalgia III: the MSX Microcomputer and the Orbit of the Planets in the Solar System

In a recent article, I have explained the Euler’s method for solving ordinary differential equations using as a motivation the fictionalized version in the film Hidden Figures of the scientific contribution of Katherine Goble and her two colleagues to the NASA space program. As an example of application, I have also shown a program written in the awk programming language for calculating the orbits of planets of the solar system. However, my interest in astrodynamics come back to my juvenile age, when still going to high school, my parents decided to gift me a more sophisticated microcomputer than my previous one (the celebrated Commodore VIC 20). So I became a programmer of a Philips MSX VG 8010 that I still jealously own in its original box. So, powered by the versatile Federico Faggin’s Zilog Z80 processor with a clock 3.58 MHz, with an impressive (for a previous owner of a VIC20 with a mere 3.583 kB!) memory of 32 kB RAM , 16kB of video RAM and a dedicated tape-record device as storage system, I started to write more sophisticated in MSX Basic. At that time, I was eagerly following the department “Ricreazioni al Computer” by the famous computer scientist A. K. Dewdney on the magazine “Le Scienze”, the Italian edition of Scientific American. The new microcomputer allowed me to experiment with the fascinating computational topics that Dewdney was offering every month. One of these topics was dedicated to the simulation of stars using the algorithm based on the Euler integration of the Newton equation. Following the instruction of Dewdney, I managed to write a small program in MSX basic and this was the starting of my interest in computational astronomy.

Continue reading

The Logistic Map and the Feigenbaum Constants: a Retro Programming Inspired Excursion

“… Mitchell Feigenbaum was an unusual case. He had exactly one published article to his name, and he was working on nothing that seemed to have any particular promise. His hair was a ragged mane, sweeping back from his wide brow in the style of busts of German composers… At the age of twenty he had already become a savant among savants, an ad hoc consultant [at Los Alamos National Laboratory, USA] whom scientist would go to see about any expecially intractable problem.”

James Gleick, Chaos: the amazing science of the unpredectable.

This year, on June 30th 2019, Mitchell J. Feigenbaum died at the age of 74. Feigenbaum was an American mathematician that became famous with the discovery of the universal constants that bear his name. In the middle of the ’80, reading Le Scienze magazine (the Italian edition of Scientific American) I got to know of the contribution to the chaos theory of this charismatic mathematician. In particular, I was delighted by reading the Douglas Hofstadter’s article in the rubric “Temi Metamagici” ( Methamagical themes) (Scientific American, November 1981). The article explained the emergence of the chaos in the iteration map of the logistic equation, the same equation deeply studied by Feigenbaum. The full story about the Mitchell Feigenbaum and his discovery of his universal constants is delightly narrated in the beautiful book Chaos:the amazing science of the unpredectable by J. Gleick [1]. Here it is just another small extract:

“… in the summer of 1975, at a gathering in Aspen, Colorado, he heard Steve Smale [another key mathematicial in the developing of the chaos theory, NDA] talk about some of the mathematical qualities of the same quadratic difference equation [the same studied by Robert May, NDA]. Smale seemed to think that there were some interesting open questions about the exact point at which the mapping changes from periodic to chaotic. As always, Smale had a sharp instinct for questions worth exploring. Feigenbaum decided to look into it once more.”[1]

Continue reading

Numerical Integration of Differential Equations. Part I.: Katherine Johnson and the Euler’s Method.

This article was inspired by the beautiful 2016 movie Hidden Figures (based on the book of the same name by M. L. Shetterley) which tell the dramatic story of three talented black women scientist that worked as “human computers” for NASA in 1961 for the Mercury project.

Figure 1: Official theatrical poster of the movie and the phFoto of the real protagonist. From left to right. Mary Jackson, Katherine Goble and Dorothy Vaughan. (source: wikipedia)

In the movie, the mathematician Creola Katherine Johnson (or Globe) (interpreted by Taraji P. Henson), had a brilliant intuition on how to numerically solve the complex problem to find the transfer trajectory for the reentry into the Earth atmosphere of the Friendship 7 capsule with the astronaut John Glenn on board. In the particular scene, she was standing together with other engineers and the director of the Langley Research Center (a fictional character interpreted by Kevin Coster) in front of the vast blackboard looking to graph and equations when she says that the solution might be in the “old math” and she runs to take an old book from a bookshelf with the description of the Euler method [UPDATE, May 2022: I just come across another excellent youtube video by the Tibees about the mathematical work of K. Johnson at NASA, and at the end of the video she reveal that the book shown in the movie is the classic H Margenau & G. M Murphy, The Mathematics of Physics and Chemistry. Published by Van Nostrand, 1956]. The scene is also nicely described in the youtube video lesson by Prof. Alan Garfinkel of the UCLA. A detailed description of the numerical solution based on the original derivation of K. Johnson is in the Wolfram blog website.

Katherine Globe was using for these complex calculation her brilliant brain with the support of a mechanical calculator (the Friden STW-10, in the movie, this machine is visible in different scenes). In a scene of the film, she revealed that her typical computing performance was of 10000 calculations per day and probably for calculations, she was not referring to single arithmetic operations! These exceptional mathematical skills have given a significative contribution at the beginning of the American space program, but it became insufficient to handle the more complex mathematics necessary to land the man on the Moon, and the other fantastic NASA achievements.

Continue reading

The Lissajous-Bowditch Curves

Try to glue a small mirror to the end of a bent piece of wire fixed to a stable platform and let the laser beam of a laser pointer reflect on it. Entangled spires of an ephemeral red dragon will perform a hypnotic dance on the wall of your room. This voluptuous dance results from two mutually perpendicular harmonic oscillations produced by the oscillations of the elastic wire. 

The curved patterns are called Lissajous-Bowditch figures and named after the French physicist Jules Antoine Lissajous who did a detailed study of them (published in his Mémoire sur l’étude optique des mouvements vibratoires, 1857). The American mathematician Nathaniel Bowditch (1773 – 1838) conducted earlier and independent studies on the same curves and for this reason, the figures are also called  Lissajous-Bowditch curves. Lissajous invented different mechanical devices consisting of two mirrors attached to two oriented diapasons (or other oscillators) by double reflecting a collimated ray of light on a screen, produce these figures upon oscillations of the diapasons.  The diapason can be substituted with elastic wires, speakers, pendulum or electronic circuits. In the last case, the light is the electron beam of a cathodic tube (or its digital equivalent)  of an oscilloscope. This article is about the mathematical theory behind these curves introduced with a demonstration program and an example of education application proposed in 1827 by C. Wheatstone . Finally, we will give a look to the equivalent of the L-B curves in 3D by exploring the spherical L-B curves.

Continue reading

Calculus in a Nutshell: Functions and their Derivatives

When I was about thirteen, the library was going to get ‘Calculus for the Practical Man.’ By this time I knew, from reading the encyclopedia, that calculus was an important and interesting subject, and I ought to learn it.  

Richard P. Feynman, from What Do You Care What Other People Think?

Introduction

Calculus is an important branch of mathematics that deals with the methods for calculating derivatives and integrals of functions and using this information to study the properties of functions. It was independently invented by I. Newton and W. Leibniz in the 18{^{th}} century and it was further developed by other great mathematicians in the centuries that follows (see Figure below).

Figure 1: Some of the great mathematician that invented the Calculus.

It comprises two areas:

  • Differential calculus {\rightarrow} It concerns the study of the rate of variation of functions.
  • Integral calculus {\rightarrow} It concern the study of the area under functions.

Depending on the nature of the functions involved in the calculations, we can further distinguish between the single- and multi-variable calculus. In this chapter, the main concepts and methods of the single-variable calculus are summarised.

Continue reading