I would not class myself as old but, equally, I can no longer claim to be in the first flush of youth. And, whilst I am not always the most observant of people, I have managed to spot some of the trends that have occurred during my lifetime. If our younger readers will forgive the trip down memory lane, I remember the advent of the Sony Walkman or, more generically, the portable, personal music player – although many passengers on public transport may take issue with my use of the word 'personal'.
Of course, in that case, music came on cassette tapes. By modern standards, this constrained the amount of music that could be listened to (and carried on one's person). In my day, the standard was a 90-minute tape, 45 minutes on each side. Whilst theoretically possible, finding a particular song within that 45 minutes was practically very difficult. So, at least in my case, music was listened to sequentially, in the order that the artist intended. [latexpage]
Nowadays, with digital formats and modern devices, you can carry around almost endless amounts of music (and video). You can also call up any track as and when you desire, assuming you can remember that you have it, of course. You can even create your own playlists, choosing which tracks come in which order.
I am not a music critic and I do not understand enough about people and their behaviour, to say how these changes have affected people and their listening habits, but, it seems to me, that the move from analogue-to-digital music storage is part of a much wider trend. Indeed, you could say that the past decades have seen the rise of the digital.
Computation
Currently, computation is mainly a digital endeavour, but this was not always the case. For example, the Antikythera mechanism dates from around the second century BCE. This mechanical (or analogue) computer tracks the cycles of the Solar System. Given the importance of computing to our lives, it is perhaps not surprising that there are modern implementations of analogue computation, including chemical reaction networks (CRNs).
In simple terms, a CRN operates over a finite set of species, $S$. In that context, a reaction is a tuple: $\left( R , P, k \right) \in \mathbb{N}^S \times \mathbb{N}^S \times ( 0 , \infty)$, with $R$ being reactants, $P$ being products and $k$ being rates. A collection of one or more reactions, over the same set of species, is a CRN.
As an example, consider the following single-reaction CRN:
\begin{equation} \label{eqn:and}
X_1 + X_2 \xrightarrow[]{1} Y.
\end{equation}
This has three species: $X_1$ and $X_2$ are reactants, and $Y$ is a product. The rate is indicated by the number above the arrow. For simplicity, if the rate is not indicated, it is assumed to be unity.
An idealised implementation of this CRN is shown in Figure 1. We begin with slightly less of $X_1$ than $X_2$ and no $Y$. Over time, the reaction progresses so that all of the $X_1$ (and most of the $X_2$) is converted into $Y$.
There are several ways that we can view this system. As described above, the system implements ${Y = \min \left( X_1 , X_2 \right)}$. Alternatively, we can view the initial states of $X_1$ and $X_2$ as encoding a high signal, in which case we have implemented an $\textrm{and}$ gate. Depending on our motivation, either of these may be more natural: if we are trying to represent a system then finding the minimum of two values may be useful; or, if we are trying to encode a logic circuit in a CRN, then logic gates are required.
Polynomial equations
We can also use CRNs to solve equations or, equivalently, to calculate algebraic numbers. Consider the polynomial equation $P(x)$ given by:
\begin{equation*}
P(x) = c_n x^n + c_{n-1} x^{n-1} + \dots + c_0.
\end{equation*}
We assume that $c_0 \geq 0$, using $-P(x)$ if this is not the case, and construct a CRN that finds the smallest positive root of this equation. Furthermore, we will do this using only one species. The construction uses the following rules:
\begin{equation*}
\begin{split}
\text{If } c_k > 0 & \text{ add } kX \xrightarrow[]{c_k} \left( k + 1 \right)X, \
\text{If } c_k < 0 & \text{ add } kX \xrightarrow[]{|c_k|} \left( k - 1 \right)X.
\end{split}
\end{equation*}
To make this concrete, consider $P(x) = -x^2 + 2$ with ${c_2 = -1}$, ${c_1 = 0}$ and ${c_0 = 2}$. Hence, we need these reactions:
\begin{equation} \label{eqn:sqrt2}
\begin{split}
\emptyset \xrightarrow[]{2} X, & \qquad \left[ c_0 \right] \
2X \xrightarrow[]{1} X. & \qquad \left[ c_2 \right]
\end{split}
\end{equation}
Note that, the first reaction begins with the empty set. That is, $X$ is apparently created out of nothing. We will briefly return to this topic later. For the moment, assume that this is, in some way, possible. The results of an idealised implementation of this system are shown in Figure 2. It is apparent that, over time, $X$ reaches the correct value (shown by the dashed line).
To provide an intuitive understanding of why this is the case, we consider the link between CRNs and ordinary differential equations (ODEs). In particular, we link species $X$ with quantity $x$ and consider the evolution of this quantity with time. Each reaction contributes to this evolution as shown below:
\begin{equation*} \label{eqn:polyproof}
\begin{split}
kX \xrightarrow[]{c_k} \left( k + 1 \right)X, & \qquad \frac{\textrm{d} x}{\textrm{d} t} = c_k x^k, \
kX \xrightarrow[]{|c_k|} \left( k - 1 \right)X, & \qquad \frac{\textrm{d} x}{\textrm{d} t} = -|c_k| x^k.
\end{split}
\end{equation*}
Given the above, it is apparent that the CRN dynamics satisfy ${\textrm{d} x/\textrm{d} t = P(x)}$. We start with ${x = 0}$ and, since we have guaranteed ${c_0 > 0}$, we know that $x$ must begin to increase. When $x$ reaches the first positive root of ${P(x)}$, we have, by construction, ${\textrm{d} x/\textrm{d} t = 0}$. So, $x$ remains at that constant value.
Trigonometric functions
CRNs can also be used to calculate trigonometric functions. The reactions to calculate $\cos$ are shown in (3). The output from an idealised implementation is illustrated in Figure 3.
\begin{equation} \label{eqn:cos}
\begin{split}
F_M & \xrightarrow[]{1} F_M + Z_P, \
F_P & \xrightarrow[]{1} F_P + Z_M, \
Z_P & \xrightarrow[]{1} Z_P + F_P, \
Z_M & \xrightarrow[]{1} Z_M + F_M, \
F_M + F_P & \xrightarrow[]{1000} \emptyset, \
Z_M + Z_P & \xrightarrow[]{1000} \emptyset.
\end{split}
\end{equation}
As this example illustrates, working with CRNs, even in their idealised form, can be complicated. In particular, when working with CRNs, we measure the concentration of a species, which, by definition, is a positive value. Conversely, $\cos$ covers the range ${\left[ -1 , +1 \right]}$. To account for this, Equation (3) has two output species, $F_P$ and $F_M$. The first of these covers the positive part of the $\cos$ range, the latter covers the negative part (multiplied by $-1$). Equivalently, our desired output is given by ${F_P - F_M}$.
The last two reactions in Equation (3) are annihilation reactions, which act to ensure one of $F_M$ and $F_P$ always remains small (and similarly for $Z_P$ and $Z_M$). The faster the rate of these annihilation equations, the neater the handover between $F_P$ and $F_M$. Close observation of Figure 3 suggests, that even in our idealised situation, this handover is noticeably imperfect, so a rate greater than 1