How I Use Quantum Computing to Make Tea

lisahobbs/Unsplash

If you’re anything like me, you drink oodles of tea throughout the day and then wonder why you can’t sleep at night. This, as awesome as it sounds, can get monotonous real fast if you always consume the same old beverage.

In order to spice things up — pun intended — I decided to explore the world of flavors by harnessing quantum computing, specifically the quantum physics phenomena of superposition and entanglement.

First, I made a table of possible ingredients, dividing up the flavors into four categories:

Table of ingredients, Hindi translations in parentheses

And then I used IBM’s open source framework, Qiskit, to build the Quantum Chai Maker (QCM).

When tea time comes around, which it does practically every hour or so, the Quantum Chai Maker provides me with a unique flavor combination by following these steps:

1. Choose between green and black tea.

2. Select ingredient categories. Any number of categories and category combinations can be selected, from just one to all four.

3. Choose the number of ingredients from each of the selected categories.

4. Provide a unique list of ingredients!

Quantum Superposition — Flavor Selection

For flavor decisions, the QCM makes use of quantum superposition. The fundamental computing unit of a classical computer (like the device you’re using to read this) is a bit. It can be a 0 or a 1, nothing else. But a quantum bit, or qubit has a third option: a probabilistic superposition of 0 and 1. This means that when it is measured, it has a certain probability of yielding a 0 and a certain probability of yielding a 1. Note that we only get one of the two possible outcomes upon measurement; superposition is destroyed in the act of measurement.

To simplify things, let’s assume that any superposition that I refer to here is a 50–50 superposition, that is, that a qubit is equally likely to yield a 0 as it is to yield a 1.

Mathematically, the superposition state of a qubit can be written as:

where the |> notation is known as ‘Dirac notation’ and represents the state of a qubit. This equation shows that the qubit’s state Q is in a superposition of two states |0> and |1>. The probability of obtaining a 0 upon measurement is 1/2, and the probability of obtaining a 1 upon measurement is 1/2.

If we have multiple qubits, we can have even more possible outcomes! Specifically, if we have n qubits, there are 2^n possible outcomes.

Suppose we want to choose a number between 0 and 7, that is, we have a choice among 8 numbers. If we use 3 qubits that are each in the above superposition state, then we have 8 possibilities at our disposal: 000, 001, 010, 011, 100, 101, 110, 111. Upon measurement, we get one of them. And if we convert them from binary to decimal, we get exactly what we are looking for: a number between 0 and 7! (Eg.: 000->0, 010 -> 2, 101 -> 5, 111 -> 7.)

The QCM uses multiple qubits in superposition states to randomly choose which of the four flavor categories to use, and how many ingredients to select from each category.

Quantum Entanglement — Tea Selection

In order to choose between green and black tea, the QCM makes use of quantum entanglement. When two qubits are entangled, a measurement of one immediately affects the other.

In order to see how entanglement works, let’s look at the specific state the QCM uses. Mathematically, it can be represented by:

This is one of four Bell states, which are nifty, useful, maximally entangled two qubit states!

The equation shows a superposition of two states: |01> and |10>, where the first position within the |> corresponds to the first qubit, and the second position corresponds to the second qubit. This means the two qubits are entangled such that if the first qubit is measured to be 0, the second qubit will definitely be a 1 — it can never be a 0, because the state |10> is no longer accessible to it, since the first qubit has already been measured to be a 0!

In the context of tea, we’re basically using a state represented by:

|not_green, black> + |green, not_black>

The first position corresponds to green tea, the second corresponds to black tea; 0 corresponds to ‘no’ and a ‘1’ corresponds to a ‘yes’.

A measurement will result in just one of these two possibilities. Here’s a pictorial representation of the process of selecting black tea:

The Quantum Chai Maker — Qiskit Code

If you’d like to try the QCM for yourself, here’s the code:

If you want the version that will be updated, here’s the link on Github.

If you’re not a programmer, but would like to run it, here’s a link to some instructions that will show you how to run it in your browser.

Some points to note before you dive in:

  • Sweeteners: Sweeteners haven’t been added, I’ve left that up to you. But here are some options: white sugar, brown sugar, agave syrup, honey, maple syrup, cane sugar, and stevia.
  • Milk: Milk hasn’t been added either. I recommend milk with black tea if you’re looking for something more along the lines of desi chai. Some people who brew desi chai enjoy ‘cooking’ the milk and tea together if they’re using dairy milk. If you’re using other types of milk (soya, almond, coconut etc.) I suggest you add the milk after brewing the tea.
  • Zesty spices: Generally all flavorings should be used in small amounts so that none become overpowering, but take extra care with the spices in the ‘Zesty Spices’ category.
contentpixie/Unsplash

If you don’t want to run the QCM, here are a few randomly generated combinations for you to try!

Your quantum chai is green tea with the following ingredients:
['chamomile, 'spearmint', 'lemongrass']

Happy drinking!
Your quantum chai is green tea with the following ingredients:
['spearmint', 'rose petals', 'orange peel', 'almond shavings/extract', 'lemon']

Happy drinking!
Your quantum chai is black tea with the following ingredients:
['holy basil (tulsi)', 'cardamom (elaichi)', 'cloves (laung)', 'bay leaves', 'saffron (kesar)', 'cinnamon', 'star anise', 'nutmeg', 'fennel seeds (saunf)', 'vanilla bean/extract', 'cumin seeds (zeera)', 'white peppercorns', 'ginger (adrak)', 'black peppercorns', 'carom seeds (ajwain)', 'paprika (lal mirch)', 'allspice', 'turmeric (haldi)']
Happy drinking!Your quantum chai is black tea with the following ingredients:
['carom seeds (ajwain)', 'paprika (lal mirch)', 'ginger (adrak)']
Happy drinking!Your quantum chai is green tea with the following ingredients:
['holy basil (tulsi)', 'saffron (kesar)', 'vanilla bean/extract', 'cloves (laung)', 'nutmeg', 'cinnamon', 'cardamom (elaichi)', 'bay leaves', 'fennel seeds (saunf)', 'almond shavings/extract', 'rose petals', 'coconut butter', 'orange peel', 'lemon']

Happy drinking!
Your quantum chai is green tea with the following ingredients:
['coriander', 'licorice root', 'spearmint', 'lemongrass']

Happy drinking!
Your quantum chai is black tea with the following ingredients:
['holy basil (tulsi)', 'cinnamon', 'rose petals', 'orange peel', 'coconut butter', 'almond shavings/extract', 'cocoa']

Happy drinking!
Your quantum chai is green tea with the following ingredients:
['ginger(adrak)', 'white peppercorns']

Happy drinking!
Your quantum chai is black tea with the following ingredients:
['star anise', 'bay leaves', 'holy basil (tulsi)', 'fennel seeds (saunf)', 'cloves (laung)', 'vanilla bean/extract', 'orange peel', 'lemon', 'almond shavings/extract', 'rose petals']

Happy drinking!

If you do happen to try any of these or a new combination, I’d love to hear about it!

Disclaimer: While I’ve built in a way to avoid certain flavor incompatibilities based on my personal opinion (like cocoa and green tea), and plan to add even more, some combinations may turn out to be less than appealing. After all, we’re working with probabilities, eh? You can choose which ingredients to use once the QCM gives you a list! So, let’s just agree to not blame me for any, erm, taste bud unpleasantness, shall we?

Scientific Adviser. Writer. Physicist. Cat lady and caffeinated.