A universal elementary function, EML
Categories: special functions logic
Level:
A standard scientific calculator has quite a large set of functions. These include the four basic arithmetic operators, powers and roots, and the constants e and π. Also logarithms, trig functions, hyperbolic functions, and the inverses of all those functions.
Suppose we could replace all of those with one function? Well, a recent paper, All elementary functions from a single operator, by Andrzej Odrzywołek, shows that we can.
The function is called the eml function. This function, together with the number 1, can do everything listed above. In principle, we could make a scientific calculator with just those two keys, and it could do everything a normal scientific calculator can do!

To be clear, of course, you wouldn't want to do that. It would work in principle, but in practice, you would need to press those two buttons many times for even a simple calculation. Even so, this technique might have applications in computing, see the analogy with NAND gates, below.
The eml(x, y) function
You might expect such a function to be quite complicated, but in fact it is a lot simpler than you might imagine. The eml function of x and y is defined as follows:

EML stands for Exp-Minus-Log.
The exponential function can be written as exp(x), rather than e^x, like this:

In this article, we will use exp(x) because it is more readable when we nest functions to many levels.
How the function works
To understand how this function works, it is easiest to look at some examples. Since the function is based on exponentials and logs, it is not surprising that these functions can be expressed most easily in EML.
First, consider the constant e (Euler's number). Looking at the original function:

If we set x to 1, the first term is just e. If we set y to 1, the log term goes to 0 (log of 1 is 0). So:

Let's be clear what we have done here. We have expressed the constant e in terms of the EML function. That isn't so interesting on its own. But, as we will see, we can express every other elementary function in terms of EML too. That is pretty amazing and potentially very useful.
Let's look at the exponential function next. We just use eml(z, 1), and again the log term vanishes:

What about ln(z), how do we express that in terms of eml? This is slightly more complicated and takes several steps. We start by setting x to 1 and y to z

We can take the exponential of both sides:

We can apply eml(1, z) again to the whole expression, which gives e minus the log of the previous expression:

We can simplify this, because we have ln(exp(...)) on the RHS, and those two functions are inverses, so they cancel out:

So now we know ln in terms of eml and exp. But we already know exp in terms of eml. So we can now express ln in terms of eml:

We will derive the EML representations of other functions later. Quite often, we will use the results of earlier functions to derive new functions (as we just did with exp to derive ln).
This will often result in an expression that is a mixture of eml functions together with other functions whose EML representation is already known. For example equation (1) has eml and exp functions, and we already know how to express exp using eml
In general, it will always be possible to expand the known functions to obtain a representation entirely using eml, as we just did with equation (1) to obtain equation (2). However, we won't do that in the examples below. The result would be some very long expressions that aren't particularly illuminating. The important thing is that we could do it if we wanted to.
Deriving arithmetic operators
We are now in a position to derive the arithmetic operators. Subtraction is quite easy:

We are again using the fact that exp and ln are inverses. When we pass ln(x) as the first term and apply exp in the eml function, the result is just x. Similarly, exp(y) becomes -y
Given subtraction, we can derive negation, once again using ln(1) = 0:

This might look a bit odd. We need to express -x in EML form, but the RHS doesn't contain any eml functions. This goes back to what we said earlier about not expanding known functions, but this is a slightly more extreme example.
We can expand the subtraction using equation (3). Then we will end up with an expression involving eml, exp and ln. We already know how to expand exp and ln. So we know how to expand it, but it would be quite long and hard to read.
Then addition is just subtracting the negated value:

To multiply, we add the logs:

Division can be done by subtracting the logs. Powers and roots by multiplying and dividing the logs. They aren't shown here.
More functions
We could go on to derive all the elementary functions in terms of eml. The supplementary information to the original paper (linked below) does that, but here we will sketch out the route.
The hyperbolic function cosh can be expressed in terms of the exp function:

sinh can be derived in a similar way, and tanh can be found from these
The trig functions are more interesting. There is a standard complex number identity:

But how do we find ix? Essentially, we can use the square root of negative x squared, which evaluates to ix:

We can derive π in a similar way. One definition of π relies on the complex-valued logarithm function:

Using the same trick as before, this can be written as:

We can now derive sin (it is just cos offset by π/2). Then tan can be derived from sin and cos.
The inverse hyperbolic and trig functions have standard formulas that can be used to derive EML representations, for example:

Again, see the supplementary information link below for all the inverse functions.
Tree structure
To summarise the EML system:
- Each of the expressions above can be written as nested elm calls (assuming we fully expand all the other functions to their elm form).
- Each elm call has two inputs and one output.
- Each input can either be 1, an input variable (eg x or y), or the result of another elm call.
This structure forms a binary tree, with leaf nodes that are either 1 or an input variable. The mess of nested elm calls isn't very readable for most humans, but computers are very good at dealing with binary trees.
Also, EML isn't limited to elementary functions. It can represent any formula involving elementary functions and arithmetic operators.
NAND gate analogy
Computer CPUs (and many other parts of a computer's hardware) are mainly constructed from logic gates. A logic gate is a simple electronic circuit that typically accepts two inputs and creates one output. The input voltages are constrained to be either a low voltage (representing the binary value 0) or a high voltage (representing the binary value 1). The output voltage is similarly constrained.
There are several types of gates. AND gates, OR gates and XOR gates combine 2 or more inputs using logic rules, INVERTERS swap 0 and 1. NAND gates, NOR gates and XNOR gates combine the normal logic gate with an INVERTER to flip the output value.
It is possible to simulate every different type of gate using a combination of NAND gates. Most modern chips are designed using only NAND gates, which greatly simplifies their design, analysis, and manufacture. This more than compensates for the fact that a NAND-only design will typically use more gates overall.
Some important subtleties
There are a few additional points that are worth bearing in mind:
- EML sometimes uses complex numbers internally, even when doing real number calculations (for example, when calculating π from ln(-1)).
- Some complex number functions have branches, where an expression has more than one possible value (in much the same way that the square root of 4 can be 2 or -2). Using such functions involves implicit decisions about which branch to take.
- The system often uses the value 1 to eliminate the log term (because ln(1) is 0). Without this, EML wouldn't work.
- EML isn't unique, there are other possible systems.
On the last point, another possible system is EDL (exp-divided-log), which is based on the following function:

In this case, we would also need the constant e rather than 1 to eliminate the log term. That is because ln(e) is 1, and dividing by 1 has no effect,
Applications
This system has some interesting potential applications and implications:
- We have always known that many of the elementary functions are interrelated, in other words, they have redundancies. Indeed, EML uses many of these relationships in its derivation. But EML goes one step further and shows that all elementary functions can be derived from a single eml() function.
- EML provides a uniform language for expressing mathematics, which could be useful in computer algebra.
- It might have implications for hardware design. For example, if a very fast method for calculating eml were developed, it might speed up the calculation of other functions.
- An AI system based on the eml function might be able to spot patterns in data and create a matching mathematical function.
- As a unifying perspective, EML might offer profound insights into mathmatics.
Links to the paper
- All elementary functions from a single operator original paper.
- Supplementary information if you want to dig a little deeper.
Related articles
Join the GraphicMaths Newsletter
Sign up using this form to receive an email when new content is added to the graphpicmaths or pythoninformer websites:
Popular tags
adder adjacency matrix alu and gate angle answers area argand diagram binary maths cardioid cartesian equation chain rule chord circle cofactor combinations complex modulus complex numbers complex polygon complex power complex root cosh cosine cosine rule countable cpu cube decagon demorgans law derivative determinant diagonal differential equation directrix dodecagon e eigenvalue eigenvector ellipse equilateral triangle erf function euclid euler eulers formula eulers identity exercises exponent exponential exterior angle first principles flip-flop focus gabriels horn galileo gamma function gaussian distribution gradient graph hendecagon heptagon heron hexagon hilbert horizontal hyperbola hyperbolic function hyperbolic functions infinity integration integration by parts integration by substitution interior angle inverse function inverse hyperbolic function inverse matrix irrational irrational number irregular polygon isomorphic graph isosceles trapezium isosceles triangle kite koch curve l system lhopitals rule limit line integral locus logarithm maclaurin series major axis matrix matrix algebra mean minor axis n choose r nand gate net newton raphson method nonagon nor gate normal normal distribution not gate octagon or gate parabola parallelogram parametric equation pentagon perimeter permutation matrix permutations pi pi function polar coordinates polynomial power probability probability distribution product rule proof pythagoras proof quadrilateral questions quotient rule radians radius rectangle regular polygon rhombus root sech segment set set-reset flip-flop simpsons rule sine sine rule sinh slope sloping lines solving equations solving triangles square square root squeeze theorem standard curves standard deviation star polygon statistics straight line graphs surface of revolution symmetry tangent tanh transformation transformations translation trapezium triangle turtle graphics uncountable variance vertical volume volume of revolution xnor gate xor gate