Quantum computers have gradually migrated from “natural” quantum objects like ions and quantum dots to “artificial” objects like transmons, where natural frequencies of LC circuit mimic energy levels. Coaxial cables attached to such circuits excite the system, read their state, and adjust their properties. They are still quantum objects and operate at low temperatures.

I wondered if a similar system can be built with large “classical” mechanical objects. Here I demonstrate 2 -qubit quantum computer built of coupled pendulums.

## Quantum computers

Quantum computers (QCs) use so-called qubits, systems in which mixed states are possible, representing a combination of two initial states α|0>+β|1>. Unlike conventional digital computers, manipulation of mix of initial states is possible.

The desired state of a qubit can be changed by external excitation, and the interaction of many such qubits allows computation. It is sometimes argued that the fundamental point of QC is “quantization”, i.e. during computation we deal with some undefined states, and only at the moment of measurement itself we get either 0 or 1 state. Intermediate values between 0 and 1 are obtained by repeatedly performing an experiment where 0 or 1 falls out according to some probability and the final result is the average of all experiments.

We will show that similar results are quite achievable on macroscopic classical objects and many basic properties of QC can be demonstrated even on mechanical objects. We will not discuss quantum entanglement, which is fundamentally applicable only to quantum objects, the role of quantum entanglement in QC is a separate story.

## Two-level system

The two-level quantum system has some specific features. Let us consider the classical atomic two-level system. There are two levels with different energies. If the system is in a state with lower energy, we can excite it with light and with probability A_{01} it will move to the upper state (absorption). If the system is in the upper state, then when irradiated, it will move to the lower state with a probability of A_{10} (stimulated emission). As Einstein showed, A_{01}=A_{10}. In the future, we will neglect the spontaneous decay of the upper level and assume that all transitions from the upper level are stimulated.

*Fig.1. A two-level system with a transition frequency of ω*

_{01}.Under continuous illumination the system is moving between lower and upper levels. This is the so-called Rabi oscillations. In quantum mechanics, we say that the system is in an undetermined state, but at the moment of measurement, we can detect it in either 0 or 1 state with a certain degree of probability. So we're talking about oscillation of probability.

Note that the Rabi frequency is not a 0 — 1 transition frequency. The frequency of Rabi oscillations depends on the intensity of the excitation and probability of transitions. Intuitively we can consider these oscillations as oscillations in a system with positive feedback and delay. For example, with higher intensity of excitation or probability of transitions the transition will occur faster and Rabi oscillations will have higher frequency

*Fig. 2. Transition probability under continuous excitation.*

Under continuous excitation at *ω _{01}* frequency, the probability of finding the system in the state |1> oscillates with the frequency Ω

_{Rabi}. As can be seen from Figure 2, the state of the system depends on how long we excite the system (pulse duration). We can switch it from 0 to 1 (the so-called π pulse) or transfer the system to a superposition state where probability to find the system in the upper state is 0.5 (π/2 pulse). We can then apply another pulse and switch the system again. If the system and excitation parameters do not change while experiment, the state of the system after the second pulse does not depend on how much time ΔT passed between the first and second pulses.

If the parameters of the system or excitation have changed slightly during the time between pulses, we are dealing with a phase. If after the first pulse system parameters have been changed, after the second π/2 pulse pulse the result will depend on how much time has passed between the first and second pulses. In any case, we are always dealing with a phase shift relative to the excitation, this is not a “global” phase, in the absence of interaction with an external field, it makes no sense.

*Fig.3 a,b Evolution of the system after excitation with two π/2 pulses. If the excitation and system parameters do not change, the duration ΔT does not affect the final state (a). If there is a phase difference between excitation and Rabi oscillations, the result depends on time passed between pulses (b).*

All these numerous states of a two-level system can be described using the so-called Bloch sphere.

The lower level corresponds to the North Pole, let's denote it as the vector [1 0] (lower level =1, upper level =0) or as the state |0>. The South Pole is the vector [0 1] or |1>… The superposition state is the equator, different points on the equator correspond to different phases. The sates at the equator can be described with complex numbers (z=x+i*y, z=cos(φ)+i*sin(φ).

*Fig.4. The Bloch sphere, a graphical representation of a two-level system. Two types of notations are shown. The north pole corresponds to the filled lower level, the south pole corresponds to the filled upper level. The equator is a superposition of states 0 and 1, where the contribution of levels 1 and 2 is the same.*

Then the first π/2 pulse from Figure 3a on the Bloch sphere looks like a 90 degree rotation around the X axis. The second π/2 pulse is another 90 degree rotation (these 2 pulses are equivalent to one π pulse).

*Fig. 5. Two π/2 pulses corresponding to Figure 3a. The first pulse transfers the system from |0> to the superposition (equator), the second – from the equator to the state |1>. If parameters of the excitation and the system stay unchanged, the result of the final state does not depend on the delay between pulses.*

Rotation around the Z axis corresponds to the phase. To obtain this phase shift, we must slightly change the system after pulse 1, and if after a while we test it with a second π/2 pulse, the result will depend on the delay between these two π/2 pulses because of accumulated phase difference.

*Fig. 6. Two π/2*

_{x}pulses corresponding to Figure 3b. During the time ΔT, a phase shift occurs, which affects the final state after exposure to the second pulse. If the phase advance is exactly φ=π /2, the second pulse will not change the state of the system at all (the radius of the second red circle will be 0)In summary, a two-level system can exist in a huge number of states (corresponding to any points on the Bloch sphere). These states are controlled by parameters of the excitation and modification of the system.

Such a system is called

*a qubit*.

## Artificial two-level system. Qubit 1.

Quantum mechanical two-level systems correspond to atomic optical or microwave transitions. Qubits were originally created based on such transitions. However, it is possible to create an artificial two-level system with similar properties. Modern quantum computers are made of so-called transmons, these are resonant superconducting LC circuits operating in the microwave range. Their size is far from atomic sizes, they have dimensions of 0.2-1 mm.

It is possible also to create a “classic” system with properties similar to a two-level system. Such systems are described in the literature [springs (arxiv), beams (arxiv)]

I will explore a mechanical system consisting of coupled pendulums experimentally by computer simulation. This approach does not use any equations and corresponds to an experiment in the real world. The model of this mechanical system is built in Matlab Simulink, in which we specify mechanical parts such as rods, balls, joints, springs, etc. and describe links between them. The result of the simulation is animation of some moving parts and plots of specified parameters.

>The objects are rods with a length of 20 cm and a radius of 1 mm with balls with a radius of 1 cm and a density of 1000 kg/m3. The weight of such a ball is about 4 g. The distance between the pendulums is 20 cm and the balls are connected to each other by a spring of the same length.

The state of such a system can be described as a combination of the angles of each of the pendulums φ_{1} and φ_{2}, but it is more convenient to describe this system in coordinates Q_{0}=φ_{1} + φ_{2} and Q_{1}=φ_{1} - φ_{2}. Wiki: Pendulum_(mechanics)

*Fig.7. Two types of oscillations of coupled pendulums. There is a spring between the pendulums with a length equal to the distance between the pendulums, it is not animated, because MATLAB cannot animate anything except the pendulums themselves.*

So, we have an imitation of the lower level (Q_{1} =0; Q_{0}=max, обозначим |0>) and the upper level (Q_{1} = max; Q_{0} =0, обозначим |1>). The frequency difference is Δγ=0.45 Hz.

The |0> and |1> states are

*modes (types)*of oscillations, we do not care about oscillations itself, any individual movements of each of the pendulums can be expressed as linear combination of these two modes.

Let's see how we can excite this system to transfer it from the state |0> to |1> (and back). It is reasonable to assume that we need to pull one of the balls with some periodic force. By analogy with a quantum two-level system, the frequency of excitation should correspond to the frequency difference between transitions, i.e. 0.45 Hz.

The excitation is realized as a periodic force between the left ball and the anchor.

*Fig.8 Excitation of the pendulums. The thread connected by means of a spring to the left ball moves periodically. This corresponds to the force F=k*r*sin(ωt).*

Under such excitation the system changes oscillation mode (state) between |0> и |1>

*Fig.9 Graphs (amplitude Q0, amplitude Q1, excitation force) The system is in the state |0>, after ~5 seconds the periodic force is applied to the system as in Fig.8, the excitation frequency is equal to the frequency difference between |0> and |1> (0.45Hz).*

The system begins to oscillate between states |0> and |1>. (The state of the system is characterized by the amplitudes of the envelopes Q_{0} and Q_{1}, the oscillations themselves do not matter). The maxima of the envelope Q_{0} correspond to the minima of Q_{1} (and vice versa) these are the points of pure states |0> and |1>, or the North and South poles on the Bloch sphere. When the amplitudes of the envelopes Q_{0} and Q_{1} are equal, the state corresponds to an equal contribution (superposition) or equator on the Bloch sphere.

This corresponds to Rabi oscillations from Fig.2.

If the excitation force is increased (for example, by making the spring k more rigid), the frequency of Rabi oscillations is expected to increase, as we noted when discussing a two-level quantum system.

*Fig. 10 Oscillations when the excitation force is 2 times higher than the force from Fig.9.*

Let's see how our mechanical qubit reacts to pulses of duration corresponding to the π/2 phase of Rabi oscillations (Fig.2).

The excitation must be coherent, i.e. the phase and frequency of the excitation force must be constant for the entire duration of the experiment. So the pulses are cut off a continuous sinusoidal force as in Fig.10.

In full agreement with the behavior of a two-level system, the first (π/2) pulse puts the pendulums into superposition state, where the contribution from |0> and |1> (i.e., the oscillation types Q0 and Q1) is the same. The system remains in this state until we apply another (π/2) pulse, which will transfer the system to the |1> state. A similar final result can be achieved with a single pulse of twice the duration ((π)x pulse). Since the excitation pulses correspond to rotations around the x axis, let's call them (π/2)_{x} or (π)_{x}. Or, in other words, X^{1/2} and X gates, as they are commonly referred to in the world of quantum computers.

*Fig.11. The reaction of the system to two (π/2)*

_{x}x pulses. (π/2)_{x}is applied by harmonic force pulse for a time of ~2.5 seconds in the manner shown in Fig. 8. The upper graph corresponds to the amplitude of the oscillations Q0, the middle one corresponds to the amplitude Q1, the lower graph is the force applied to the left pendulum according to the scheme Fig. 8.This result corresponds to Fig. 3a.

Now let's see how the phase difference affects the result of the same experiment with two (*π*/2)_{x} pulses. In this case, we change the phase during the superposition state by changing the spring constant of the spring connecting the pendulums. Let's choose the exposure time and the spring constant so that such a pulse leads to a 90-degree rotation relative to the z axis.

*Fig. 12. Excitation by two (π/2)*

_{x}similar to Fig. 11, however, here we also change spring constant of the spring connecting the pendulums (lower graph) for a time of 2.3 seconds. Note that the type of oscillation after this modulation stays the same, but the final state of the system after the second (π/2)_{x}differs significantly from the previous example.This means that by modulating the elasticity of the spring, we changed the phase so that on the Bloch sphere we transferred the system from the state 1/√2(|0>-i|1>) to the state 1/√2(|0>+|1>) and the second excitation pulse does not change the state (radius of rotation around the x axis, which corresponds to the 2nd excitation pulse, is equal to 0).

Similar to the x-axis, let's call a 90-degree rotation relative to the z-axis: (

*π*/2)

_{z}

Now let's make pulse duration of the modulation of spring constant 2 times longer.

In full expectation of the behavior of the two-level system, the second excitation pulse puts the system back into the |0> state.

*Fig. 13 Excitation by two (π/2)*

_{x}pulses when (π)_{z}pulse is applied at the superposition state.So, we built a mechanical system with the properties of a two-level quantum system and showed that we can control such a system by exciting it or changing its properties. This is similar to what is happening with transmon-like systems, where π or π/2 pulses are microwave pulses and phase modulation is done with voltage applied to elements of the circuit.

We demonstrated the control of the system using the so-called X

^{1/2}, X, Z

^{1/2}(or S), Z gates, corresponding to rotations of 90, 180 degrees around the x axis, and 90, 180 degrees around z. Or in matrix form:

Now we will move on to what can be considered a quantum computer. A system of two qubits.

## Two-qubit system

Each of the qubits, as before, consists of two pendulums coupled by a spring. But we can make them interact with another spring, connected for a short time.

*Fig. 14. Two connected qubits. Two pairs of coupled pendulums with the possibility of communication between them using a spring.*

We can choose the duration of the exchange and the elasticity of the spring, for example, so that the state of qubit0 is transferred to qubit1 and vice versa.

This is a fantastic result! No matter how complex the oscillation of the pendulums from qubit 0 is, it will be transmitted to the pendulums from qubit 1 (and vice versa).

Let us consider an experiment where qubit 0 is in the |0> state and qubit 1 is in the |1> state.

*Fig.15 Two pairs of pendulums (qubits) are connected at the moment t= 10sec for a time of 4.5 seconds by a spring with an spring constant of 0.05 N/m (two times less than the spring constants of the springs in qubits). the state |0> of qubit 0 becomes the state of qubit 1, and the state |1> of qubit 1 becomes the state of qubit 0. So, the qubits exchanged their states.*

The states can be any points on the Bloch sphere, they will be exactly (up to the phase, see below) transferred to each other.

For clarity, we will superimpose the results of two experiments on each other: the pendulums of the first qubit start at positions (0

^{0},10

^{0}) and (0

^{0},-10

^{0}), and the second qubit at position (-10

^{0},0

^{0}). All these states correspond to equal amplitudes Q0 and Q1 (superposition) and correspond to different points on the equator of the Bloch sphere.

*Fig. 16 Exchange of states located at the equator of the Bloch sphere (Q0=Q1) between two qubits, the results of two experiments with different initial states are superimposed.*

We can determine the phase of states by probe with (

*π*/2)x pulses, just as we did in the experiments Fig. 11-13.

As a result, we find that there is a

*π*phase changes and the exchange of states looks like this on Bloch spheres:

*Fig. 17 Обмен состояниями между кубитами.*

The states of 2 qubit system can be characterized by:basic states.

The interaction of 2 pairs of coupled pendulums leads to transformations |00>⇒|00>, |01> ⇒ -|10>, |10>⇒-|01>, |11>⇒|11>

This corresponds to the matrix:

Any other states are expressed in terms of the base states, for example:

let the initial state of the qubit 0 be 1/√2*(|0>-i|1>) (см. Fig.4), and the state of qubit 1 |0>,

Then the initial state will be written as 1/√2*(|0>-i|1>)|0>=1/√2*|00>-1/√2*i*|10>

After connection with the spring, in accordance with our transformation matrix, we will have:

1/√2*|00>-1/√2*i*|10> ⇒ 1/√2*|00>+1/√2*i*|01>=|0>(1/√2(|0>+i|1>))),

The final state of qubit 0 becomes |0>, and the final state of qubit 1 becomes ½*(|0>+i|1>)|0> (i.e. the initial state of qubit 0 but with a phase shift of 180^{o})

It is easy to see that our matrix is the product of matrices corresponding to iSWAP gate gates and SWAP gate gate for a two—qubit system, or, let us call it iSWAP^{2}.

## Deutsch's algorithm

The so-called Deutsch-Jozsa algorithm is often used to demonstrate principles of operation of quantum computers and show the superiority over common digital computers. For example, here is the implementation of this algorithm on QC where the qubits are two-level atomic transitions Nature (sci-hub) или quantum dots PhysRev (sci-hub).

The task is to determine whether a certain function is balanced or not. A balanced function is a function that returns f(x)=x or f(x)=not(x); the function is unbalanced if f(x)=0 or f(x)=1. A classical computer will need 2 operations to iterate through x=0 and x=1.

The QC can do this in one operation. To do this, we perform actions with a superposition of ½(|0>+|1>), that is, simultaneously with x=0 and x=1.

The QC can do this in one operation. To do this, we perform actions with a superposition of ½(|0>+|1>), that is, simultaneously with x=0 and x=1.

Briefly the idea is the following. We make 4 black boxes, inside of which there is an implementation of 4 variants of the function for f(x): a) f(x)=0, b) f(x)=1, c) f(x)=x, d) f(x)=not(x). The first two are unbalanced, and the last two are balanced. These black boxes perform the operation y⊕f(x), where x is the state of the first qubit and y is the state of the second qubit, and ⊕ denotes the CNOT operation between two qubits.

Here is the implementation of these black boxes:

*Fig. 18. The implementation of black boxes for 4 types of functions (see)*

Then we insert these black boxes into some system of 2 qubits and immediately get that the boxes with functions c) and d) return the result |1>, and a) and b) return the result |0>. The problem is solved.

*Fig. 19 Implementation of the Deutsch algorithm, Oracle Uf contains black boxes with the implementation of the function y⊕f(x). H is a Hadamard gate, see below.*

Apart from the usual mathematics in such cases, the essence boils down to the following:

Let there be 2 qubits.

The 1st qubit is in the state 1/√2(|0>+|1>). The 2nd qubit is in the state 1/√2(0>-|1>).

If we perform a CNOT operation between qubit 0 and 1, the state of qubit 0 will change the phase to π.

*Рис. 20 If qubit 1 is in the state 1/√2(0>-|1>), then CNOT (0,1) leads to a phase change of qubit 0 by 180 degrees.*

And then we can easily determine whether there was a phase rotation or not by applying the H operator.

The H (Hadamard gate) operator corresponds to rotation around the axis [1 0 1]. For a number of reasons, it is very convenient, for example, double application of this operator leads to the initial state.

If the phase has not changed and the state remains

*1/√2(*|0>+|1>), then using Hadamard gate will bring the system to the |0>, state. If the phase has changed to π and the state has become

*1/√2(*|0>-|1>), then applying H will bring the system to the state |1>,

*Fig. 21 a) H gate applied to 1/√2(|0>+|1>) brings the qubit to the |0> state, b) H gate applied to 1/√2(|0>-|1>) brings the qubit to the |1> state*

So, we need black boxes with unbalanced functions not to change the phase, but balanced ones to make a 180 phase shift. Then after H, the unbalanced functions that did not touch |x> will give the result |0>, and the balanced functions that used |x> and changed its phase to 180

^{о}will give the result |1>.

This is the hidden trick of this algorithm: the implementation of unbalanced black boxes is that the state of qubit 0 is not used at all, since the function f(x) is just a constant, and both balanced functions require CNOT that change the phase of qubit 0 (see Fig. 20). And then, respectively, leads to |1> after H gate. As soon as the state |x> is involved, interaction with the second qubit changes |x>, which we detect.

At the same time, we are not at all interested in what happens to qubit 1, and a useful result is a change in the state of the original variable x (qubit 0).

## Modified algorithm for our mechanical QC.

Earlier, we demonstrated the iSWAP

^{2}gate for our two mechanical qubits. Perhaps we can find a way to link our 2 mechanical qubits so that the CNOT gate is implemented. However, we can solve the problem of determining if the function balanced even with our iSWAP

^{2}.

Following the logic of the Deutsch algorithm, we will build black boxes for 4 types of functions, similar to Fig. 18.

*Fig. 22.Implementation of black boxes for the modified Deutsch algorithm. a) and b) correspond to the unbalanced functions f(x)=0 and f(x)=1, and c) and d) balanced f(x)=x and f(x)=not(x).*

If we ignore small details, such as the reversibility of calculations, we can use X gates instead of H gates and then we have everything to implement this algorithm for our 2-qubit mechanical quantum computer.

*Fig.23. Implementation of the iSWAP*

^{2}algorithm.For example, let's consider the step-by-step execution of the algorithm for 2 cases: c) f(x)=x and a) f(x)=0 (fig. 23)

*Fig. 24. The sequence of execution of the algorithm for f(x)=x. The result is |1>, the function is balanced.*

*Fig. 25. The sequence of execution of the algorithm for f(x)=0. The result is |0>, the function is unbalanced*

And we can do it on our mechanical computer.

*Fig. 26. Experiment with a balanced function corresponding to Fig. 6 © and Fig. 8. X*

^{1/2}at the 1st second and 25th second indicates the excitation by (π/2)_{x}pulse, as in Fig.8 and Fig.11. iSWAP^{2}experimentally corresponds to the connection of pendulums with a spring (as in Fig.14) at the 10th second.*Fig. 27. Experiment with an unbalanced function corresponding to Fig. 6 (a) and Fig. 9. X*

^{1/2}for the 1st second and 25th second indicates the excitation by (π/2)_{x}pulse, as in Fig.8 and Fig.11. X^{3/2}indicates excitation by a pulse of 3*π/2 duration at the 10th second.The task of balanced function detection is very simple, it can be easily solved in one step with many analog systems. Nevertheless, we have formally demonstrated that our mechanical quantum computer can perform operations often used to demonstrate the operation of “real” quantum computers.

## Summary

We have shown that many basic properties of quantum computers can be reproduced on a mechanical classical system and even performed some algorithm that is often used to demonstrate quantum QC.

I tried to demonstrate the basic properties of CC as simply as possible, and explain how they work.

In fact, QC are universal analog computers, there are many tasks that can be solved very effectively with analog computers. Although, in general, there are no big breakthroughs here yet and, in my opinion, they are not expected.

_{see more http://mshtools.atwebpages.com}