0% found this document useful (0 votes)
26 views22 pages

Utkarsh Dubey DSL

jbjg u jgyughkjhjmvnbvtyftftyffggh gyghgvyugyf gf fyftyfk fhjghc hcgth ftyfkufku gyufu h

Uploaded by

Utkarsh Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views22 pages

Utkarsh Dubey DSL

jbjg u jgyughkjhjmvnbvtyftftyffggh gyghgvyugyf gf fyftyfk fhjghc hcgth ftyfkufku gyufu h

Uploaded by

Utkarsh Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

DSL 742 Assignment on Quantum Random Walk

Utkarsh Dubey
October 15, 2024

1 Difference between Quantum Random Walk


and Classical Random Walk
A Random Walk is a mathematical formalism that describes a path consisting
of a succession of random steps. The fundamental differences between Quantum
Random Walks and Classical Random Walks are outlined below:

1.1 1. State Representation


• Classical Random Walk: In a classical random walk, the state of the
walker is represented by a single probability distribution over the possible
positions. At each time step, the walker moves to an adjacent position
with a fixed probability.
• Quantum Random Walk: In a quantum random walk, the state of the
walker is represented by a quantum superposition of all possible positions.
The walker can occupy multiple positions simultaneously due to quantum
superposition.

1.2 2. Coin Tossing


• Classical Random Walk: The decision of which direction to move (left
or right) is made based on a classical coin toss, resulting in a binary
outcome.
• Quantum Random Walk: The direction of movement is determined by
a quantum coin, which can exist in a superposition of states, allowing for
more complex interference patterns in the walk.

1.3 3. Interference Effects


• Classical Random Walk: There are no interference effects since the
states are independent and additive.

1
• Quantum Random Walk: The superposition of states leads to inter-
ference effects, which can enhance or diminish probabilities of finding the
walker in certain positions, resulting in a fundamentally different distri-
bution than that observed in classical random walks.

1.4 4. Propagation Speed


• Classical Random Walk: The mean squared displacement grows lin-
early with time, leading to diffusion-like behavior.
• Quantum Random Walk: The spread of the walker’s position can be
quadratic in time, leading to faster propagation compared to classical
walks.

1.5 5. Probability Distribution Shapes


• Classical Random Walk: The probability distribution after a large
number of steps tends to form a Gaussian-like distribution centered around
the origin. The shape is symmetric and broadens with time, consistent
with the central limit theorem. The variance increases linearly with the
number of steps, leading to the characteristic bell-shaped curve.

Figure 1: 1-D classical random walk of a single particle.

• Quantum Random Walk: The probability distribution can exhibit


more complex shapes due to interference effects. For example, after a
large number of steps, the distribution may show multiple peaks or a
more localized structure, depending on the specific quantum states and

2
Figure 2: 1-D symmetric quantum random walk of a single particle.

coin operations used. The spread can also be much larger than that of
classical walks, leading to the potential for faster exploration of the state
space.

2 Classical Random walk for single particle for


10 and 20 steps
The following MATLAB code simulates a 1D random walk. The particle starts
at the origin and takes N steps, either left or right, with equal probability. The
final positions of the walker are recorded for different numbers of simulations
(P ) to study the distribution. The trajectory for a single random walk is also
plotted.

2.1 MATLAB Code


clc;
clear;
close all;

% Number of steps for each simulation


N = 10; % Number of steps in the random walk change to 20 for 20 steps

% Step 1: Simulate and plot the trajectory for a single random walk

3
single_trajectory = simulateRandomWalk(N);
figure;
plot(0:N, single_trajectory, ’-o’);
title(’1D Random Walk - Single Trajectory’);
xlabel(’Steps’);
ylabel(’Position’);

% Step 2: Simulate random walks for various P values and plot histograms
P_values = [50, 500, 5000, 50000, 500000]; % Different values for P (number of walks)
for p_index = 1:length(P_values)
P = P_values(p_index);
final_positions = zeros(1, P);

% Simulate P random walks and record the final positions


for i = 1:P
single_trajectory = simulateRandomWalk(N);
final_positions(i) = single_trajectory(end);
end

% Plot histogram of the final positions for each P


figure;
histogram(final_positions, ’Normalization’, ’probability’);
title([’Histogram for P = ’ num2str(P)]);
xlabel(’Final Position’);
ylabel(’Probability’);
end

% Function to simulate a 1D random walk


function trajectory = simulateRandomWalk(N)
% Initialize the position and trajectory
position = 0;
trajectory = zeros(1, N+1);
trajectory(1) = position;

% Simulate the random walk over N steps


for step = 1:N
move = randi([0, 1]) * 2 - 1; % Random movement: -1 for left, +1 for right
position = position + move; % Update position
trajectory(step + 1) = position; % Store the position
end
end

4
2.2 simulation results for ten steps

Where the P value refers to the number of times the simulation for ten steps
was run.

2.3 simulation results for twenty steps

5
Where the P value refers to the number of times the simulation for twenty
steps was run.

3 Quantum Random walk for a single particle


for 10 and 20 steps
In this section, we transition from the classical random walk to the quantum
random walk on a 1D linear axis. The quantum random walk has properties
distinct from its classical counterpart due to the interference effects inherent
in quantum mechanics. This model differs from the classical model in how it
evolves the particle’s state through unitary transformations, which leads to a
faster spread of probability distributions.

3.1 Hilbert Space and State Definition


We begin by defining the quantum random walk on a 1D line, where the particle
can either move left or right, similar to the classical walk. The Hilbert space
HP is the space spanned by the positions of the particle. On the real line with
a grid length of 1, this space is spanned by the basis states {|i⟩ : i ∈ Z}, where
|i| corresponds to the position of the particle.
The particle’s state is no longer just a position; it now exists in a superposi-
tion of basis states. To incorporate the directionality of movement, we introduce
an additional Hilbert space HC , often referred to as the ”coin space.” This is a
two-dimensional space spanned by the basis states {| ↑⟩, | ↓⟩}, representing the
particle’s movement to the right or left, respectively.
Thus, the total Hilbert space of the system is given by H = HC ⊗ HP .
States of the system will now evolve through transformations acting on both
the position and coin spaces.

3.2 Unitary Evolution and Coin Flip Operator


The quantum random walk evolves through unitary transformations. A typical
step of the quantum random walk consists of two stages:
1. Coin flip (C): The first step is a rotation in the coin space, which de-
termines the direction of the walk. For an unbiased walk, we use the
Hadamard coin operator H, which is defined as:
 
1 1 1
H=√ .
2 1 −1
This operator creates an equal superposition of moving left or right. For
example, starting in the state | ↑⟩, applying the Hadamard operator gives:
1
H| ↑⟩ = √ (| ↑⟩ + | ↓⟩).
2

6
2. Conditional translation (S): The second step is the translation of the
particle in the position space, conditioned on the state of the coin. This
is described by the unitary shift operator S, which acts as follows:
X X
S = | ↑⟩⟨↑ | ⊗ |i + 1⟩⟨i| + | ↓⟩⟨↓ | ⊗ |i − 1⟩⟨i|.
i i

The shift operator moves the particle one step to the right if the coin is
in state | ↑⟩ and one step to the left if the coin is in state | ↓⟩.

Thus, a single step of the quantum random walk can be described by the
operator U = S · (H ⊗ I), where I is the identity operator on the position space
HP . This unitary operator evolves the system over time.

3.3 Quantum Walk Dynamics


To better understand how the quantum walk differs from the classical one, let
us examine the dynamics of the system after applying multiple steps of the
operator U .
We begin with the initial state |Φini ⟩ = |↓⟩ ⊗ |0⟩. After applying the unitary
transformation U , the system evolves as follows:

U 1
→ √ (|↑⟩ ⊗ |1⟩ − |↓⟩ ⊗ |−1⟩)
|Φini ⟩ − (1)
2
U 1
→ (|↑⟩ ⊗ |2⟩ − (|↑⟩ − |↓⟩) ⊗ |0⟩ + |↓⟩ ⊗ |−2⟩)
− (2)
2
U 1
→ √ (|↑⟩ ⊗ |3⟩ + |↓⟩ ⊗ |1⟩ + |↑⟩ ⊗ |−1⟩

2 2
−2 |↓⟩ ⊗ |−1⟩ − |↓⟩ ⊗ |−3⟩) (3)

So, at T = 3, we get the difference between the classical and the quantum cases.
By a similar analysis we can create the following table which further illustrates
the difference between the quantum and the classical random walk dynamics.

We can see that from T = 3, we observe differences in classical and quantum


random walks.

7
3.4 Symmetry and Asymmetry
Unlike the classical case where a Gaussian distribution would emerge, the quan-
tum walk results in an asymmetric distribution that ”drifts” to the left. This
asymmetry arises because the Hadamard coin operator treats the two spin states
| ↑⟩ and | ↓⟩ differently. Specifically, the coin multiplies the phase by −1 for | ↓⟩,
which causes destructive interference for paths to the right, while paths to the
left experience constructive interference.
To obtain a symmetric distribution in a quantum random walk, we can
modify the initial state of the walker. If we start the walk in the state | ↑⟩ ⊗ |0⟩,
the walk will exhibit a drift to the right. On the other hand, starting the walk
in the state | ↓⟩ ⊗ |0⟩ results in a drift to the left. These opposite drifts arise
because the Hadamard coin treats the two spin states differently. To ensure
that these drifts do not interfere with each other, we can start the walk in a
superposition of | ↑⟩ and | ↓⟩, i.e., the symmetric state
1
|Φsym ⟩ = √ (| ↑⟩ + i| ↓⟩) ⊗ |0⟩.
2
In this state, the trajectories originating from | ↑⟩ will remain real, while
those from | ↓⟩ will be purely imaginary. Since the Hadamard operator does
not introduce complex amplitudes, the real and imaginary components will not
interfere with each other, resulting in a symmetric probability distribution. An-
other solution to eliminate the asymmetry of the walk is to use a different
(balanced) coin, namely
 
1 1 i
Y =√ .
2 i 1
This coin treats | ↑⟩ and | ↓⟩ in the same way and does not bias the walk,
independently of its initial coin state. For generating symmetric distribution,
we will be changing the initial state to
1
|Φsym ⟩ = √ (| ↑⟩ + i| ↓⟩) ⊗ |0⟩.
2

3.5 MATALAB Code for Asymmetric case


n = 10; % Number of random walk steps change to 20 if required
% Initialize matrix to store spin state vectors at each position
M = zeros(2, 2*n + 1);
M(2, n+1) = 1; % Initial spin-down state at position 0

% Define normalized Hadamard coin


H = hadamard(2) / sqrt(2);

% Loop for random walk steps


for step = 1:n

8
M = H * M; % Apply Hadamard coin
M(1,:) = circshift(M(1,:), [0, 1]); % Shift |up> components right
M(2,:) = circshift(M(2,:), [0, -1]); % Shift |down> components left
end

% Compute probabilities at each position


probs = sum(abs(M).^2, 1);

% Plot probability distribution


positions = linspace(-n, n, 2*n + 1);
plot(positions, probs);
ylabel(’Probability’);
xlabel(’Position’);
title(’Quantum Walk Probability Distribution’);

3.6 MATALAB Code for Symmetric case

3.7 simulation results for ten steps

9
3.8 simulation results for twenty steps

4 Theory of Two-Particle Quantum Random Walk


Quantum walks can be extended to multi-particle systems, where interference
and entanglement play crucial roles in determining the evolution of the system.
In this section, we will discuss the two-particle quantum random walk, which
involves two distinguishable or indistinguishable particles moving on a lattice
with quantum coin operations determining their steps.

4.1 1. Overview of Two-Particle Quantum Random Walk


In the case of two particles, the state of the system is described as a product
of the position and spin states of both particles. At each time step, the sys-
tem undergoes a coin operation, which determines the direction of movement,
followed by a shift operation that moves the particles according to their spins.
The total state of the two-particle system can be written as:
X X
ψ(t) = α(x1 , s1 , x2 , s2 , t)|x1 ⟩|s1 ⟩1 |x2 ⟩|s2 ⟩2
x1 ,x2 s1 ,s2

where:

• x1 and x2 represent the positions of particles 1 and 2, respectively.


• s1 and s2 represent the spin states of particles 1 and 2, which can be | ↑⟩
or | ↓⟩.
• α(x1 , s1 , x2 , s2 , t) represents the amplitude of the state at time t.

10
4.2 2. Coin and Shift Operators
4.2.1 Coin Operator
The coin operator determines the direction of movement for each particle based
on their spin states. For a single particle, a typical coin operator is the Hadamard
operator or a Grover coin, which places the spin state into a superposition of
up and down states.
For a two-particle system, the combined coin operator can be expressed as
the tensor product of the individual coin operators:
C = C1 ⊗ C2
where C1 and C2 are the coin operators acting on particles 1 and 2, respectively.
The application of the coin operator at each time step entangles or superposes
the spins of both particles.

4.2.2 Shift Operator


Once the coin operation has been applied, the particles are moved along the
lattice according to their spin states. The shift operator determines the direction
of motion based on whether the particle is in the up state (| ↑⟩) or down state
(| ↓⟩).
For example, if particle 1 is in the spin-up state (| ↑⟩) and particle 2 is
in the spin-down state (| ↓⟩), the shift operator moves particle 1 to the right
(increasing its position by 1) and particle 2 to the left (decreasing its position
by 1):
S|x1 , ↑⟩|x2 , ↓⟩ = |x1 + 1, ↑⟩|x2 − 1, ↓⟩
Thus, the shift operator updates the positions of the two particles according to
their respective spin states after each coin operation.

4.2.3 Overall Evolution Operator


The overall evolution of the system at each time step is governed by the com-
bined application of the coin and shift operators. This is given by:
U =S·C
where S is the shift operator and C is the coin operator. The combined evolution
ensures that both particles are moved on the lattice based on their spin states
while simultaneously entangling or superposing their spins through the coin
operator.

4.3 3. Cases of Two-Particle Quantum Walk


In this work, we explore five different initial conditions for the two-particle quan-
tum random walk. These cases represent different types of initial states—ranging
from pure product states to various forms of entangled states, both bosonic and
fermionic. The initial states are as follows:

11
1. Pure State (Product State):

ψini = |0 ↑⟩1 |0 ↓⟩2

In this case, the two particles are in a simple product state, where particle
1 starts at position 0 with spin up, and particle 2 starts at position 0 with
spin down. There is no entanglement between the particles.
2. Entangled State 1:
1 2
ψini = √ |0 ↑⟩1 |0 ↓⟩2 − √ |0 ↓⟩1 |0 ↑⟩2
5 5
This represents a partially entangled state between the two particles. The
amplitudes are unequal, resulting in asymmetric interference patterns in
the evolution of the walk.
3. Entangled State 2:

1 2
ψini = √ |0 ↑⟩1 |0 ↓⟩2 − √ |0 ↓⟩1 |0 ↑⟩2
3 3
This is another entangled state with different weighting factors, leading
to distinct interference effects compared to the first entangled state.
4. Fermionic Entangled State:
1
ψini = √ (|0 ↑⟩1 |0 ↓⟩2 − |0 ↓⟩1 |0 ↑⟩2 )
2
In this case, the two particles are indistinguishable fermions. This anti-
symmetric state reflects the Pauli exclusion principle, which forbids two
fermions from occupying the same quantum state.
5. Bosonic Entangled State:
1
ψini = √ (|0 ↑⟩1 |0 ↓⟩2 + |0 ↓⟩1 |0 ↑⟩2 )
2
This represents an entangled state of two indistinguishable bosons. The
state is symmetric, as required by the symmetry properties of bosons,
leading to different interference effects compared to fermions.

4.4 MATLAB Code and Simulation result for Pure state


n = 10; % Number of steps

% Define the 4D array for the wave function (with spin and position indices)
M = zeros(2, 2, 2*n+1, 2*n+1);

12
% Initialize psi: |0 ↑>_1 |0 ↓>_2
M(1, 2, n+1, n+1) = 1; % 1 means full amplitude in this state

% Hadamard coin operator


H = hadamard(2);
H = H / norm(H);
Coin = kron(H, H);

% Main loop for random walk steps


for i = 1:n
% Apply coin operator to all positions
for x1 = 1:2*n+1
for x2 = 1:2*n+1
M(:, :, x1, x2) = reshape(Coin * reshape(M(:, :, x1, x2), [4, 1]), [2, 2]);
end
end

% Apply shift operator


M_new = zeros(size(M));
for x1 = 2:2*n
for x2 = 2:2*n
M_new(1, :, x1+1, x2) = M_new(1, :, x1+1, x2) + M(1, :, x1, x2); % |up>_1 move r
M_new(2, :, x1-1, x2) = M_new(2, :, x1-1, x2) + M(2, :, x1, x2); % |down>_1 move
M_new(:, 1, x1, x2+1) = M_new(:, 1, x1, x2+1) + M(:, 1, x1, x2); % |up>_2 move r
M_new(:, 2, x1, x2-1) = M_new(:, 2, x1, x2-1) + M(:, 2, x1, x2); % |down>_2 move
end
end
M = M_new; % Update the state
end

% Compute probabilities
probs = zeros(2*n+1, 2*n+1);
for x1 = 1:2*n+1
for x2 = 1:2*n+1
probs(x1, x2) = sum(sum(abs(M(:, :, x1, x2)).^2));
end
end
probs = probs/sum(probs(:));
% Plotting
x_vals = linspace(-n, n, 2*n+1);
y_vals = linspace(-n, n, 2*n+1);
[X, Y] = meshgrid(x_vals, y_vals);
figure;
surf(X, Y, probs, ’EdgeColor’, ’none’);
colorbar;
xlabel(’Lattice points - Particle 1’);

13
ylabel(’Lattice points - Particle 2’);
zlabel(’Probability’);
title(’Initial state: |0 ↑>_1 |0 ↓>_2’);

4.5 MATLAB Code and Simulation result for Entangled


state 1
n = 10;

M = zeros(2, 2, 2*n+1, 2*n+1);

% Initialize psi: 1/sqrt(5) |0 ↑>_1 |0 ↓>_2 - 2/sqrt(5) |0 ↑>_1 |0 ↓>_2


M(1, 2, n+1, n+1) = 1/sqrt(5); % First term
M(1, 2, n+1, n+1) = M(1, 2, n+1, n+1) - 2/sqrt(5); % Subtract second term

H = hadamard(2);
H = H / norm(H);
Coin = kron(H, H);

% Main loop for random walk steps (same as above)


for i = 1:n
for x1 = 1:2*n+1
for x2 = 1:2*n+1
M(:, :, x1, x2) = reshape(Coin * reshape(M(:, :, x1, x2), [4, 1]), [2, 2]);
end
end

14
M_new = zeros(size(M));
for x1 = 2:2*n
for x2 = 2:2*n
M_new(1, :, x1+1, x2) = M_new(1, :, x1+1, x2) + M(1, :, x1, x2);
M_new(2, :, x1-1, x2) = M_new(2, :, x1-1, x2) + M(2, :, x1, x2);
M_new(:, 1, x1, x2+1) = M_new(:, 1, x1, x2+1) + M(:, 1, x1, x2);
M_new(:, 2, x1, x2-1) = M_new(:, 2, x1, x2-1) + M(:, 2, x1, x2);
end
end
M = M_new;
end

probs = zeros(2*n+1, 2*n+1);


for x1 = 1:2*n+1
for x2 = 1:2*n+1
probs(x1, x2) = sum(sum(abs(M(:, :, x1, x2)).^2));
end
end
probs = probs/sum(probs(:));
x_vals = linspace(-n, n, 2*n+1);
y_vals = linspace(-n, n, 2*n+1);
[X, Y] = meshgrid(x_vals, y_vals);
figure;
surf(X, Y, probs, ’EdgeColor’, ’none’);
colorbar;
xlabel(’Lattice points - Particle 1’);
ylabel(’Lattice points - Particle 2’);
zlabel(’Probability’);
title(’Initial state: 1/sqrt(5) |0 ↑>_1 |0 ↓>_2 - 2/sqrt(5) |0 ↑>_1 |0 ↓>_2’);

15
4.6 MATLAB Code and Simulation result for Entangled
state 2
n = 10;

M = zeros(2, 2, 2*n+1, 2*n+1);

% Initialize psi: 1/sqrt(3) |0 ↑>_1 |0 ↓>_2 - sqrt(2)/sqrt(3) |0 ↑>_1 |0 ↓>_2


M(1, 2, n+1, n+1) = 1/sqrt(3);
M(1, 2, n+1, n+1) = M(1, 2, n+1, n+1) - sqrt(2)/sqrt(3);

H = hadamard(2);
H = H / norm(H);
Coin = kron(H, H);

% Main loop (same as above)


for i = 1:n
for x1 = 1:2*n+1
for x2 = 1:2*n+1
M(:, :, x1, x2) = reshape(Coin * reshape(M(:, :, x1, x2), [4, 1]), [2, 2]);
end
end

M_new = zeros(size(M));
for x1 = 2:2*n

16
for x2 = 2:2*n
M_new(1, :, x1+1, x2) = M_new(1, :, x1+1, x2) + M(1, :, x1, x2);
M_new(2, :, x1-1, x2) = M_new(2, :, x1-1, x2) + M(2, :, x1, x2);
M_new(:, 1, x1, x2+1) = M_new(:, 1, x1, x2+1) + M(:, 1, x1, x2);
M_new(:, 2, x1, x2-1) = M_new(:, 2, x1, x2-1) + M(:, 2, x1, x2);
end
end
M = M_new;
end

probs = zeros(2*n+1, 2*n+1);


for x1 = 1:2*n+1
for x2 = 1:2*n+1
probs(x1, x2) = sum(sum(abs(M(:, :, x1, x2)).^2));
end
end
probs = probs/sum(probs(:));
x_vals = linspace(-n, n, 2*n+1);
y_vals = linspace(-n, n, 2*n+1);
[X, Y] = meshgrid(x_vals, y_vals);
figure;
surf(X, Y, probs, ’EdgeColor’, ’none’);
colorbar;
xlabel(’Lattice points - Particle 1’);
ylabel(’Lattice points - Particle 2’);
zlabel(’Probability’);
title(’Initial state: 1/sqrt(3) |0 ↑>_1 |0 ↓>_2 - sqrt(2)/sqrt(3) |0 ↑>_1 |0 ↓>_2’);

17
4.7 MATLAB Code and Simulation result for Fermionic
Entangled State
n = 10; % Number of steps

% Define the 4D array for the wave function (with spin and position indices)
M = zeros(2, 2, 2*n+1, 2*n+1);

% Initialize psi: 1/sqrt(2)(|0 ↑>_1 |0 ↓>_2 - |0 ↓>_1 |0 ↑>_2)


M(1, 2, n+1, n+1) = 1/sqrt(2); % |0 ↑>_1 |0 ↓>_2
M(2, 1, n+1, n+1) = -1/sqrt(2); % |0 ↓>_1 |0 ↑>_2

% Hadamard coin operator


H = hadamard(2);
H = H / norm(H);
Coin = kron(H, H);

% Main loop for random walk steps


for i = 1:n
% Apply coin operator to all positions
for x1 = 1:2*n+1
for x2 = 1:2*n+1
M(:, :, x1, x2) = reshape(Coin * reshape(M(:, :, x1, x2), [4, 1]), [2, 2]);
end
end

18
% Apply shift operator
M_new = zeros(size(M));
for x1 = 2:2*n
for x2 = 2:2*n
M_new(1, :, x1+1, x2) = M_new(1, :, x1+1, x2) + M(1, :, x1, x2); % |up>_1 move r
M_new(2, :, x1-1, x2) = M_new(2, :, x1-1, x2) + M(2, :, x1, x2); % |down>_1 move
M_new(:, 1, x1, x2+1) = M_new(:, 1, x1, x2+1) + M(:, 1, x1, x2); % |up>_2 move r
M_new(:, 2, x1, x2-1) = M_new(:, 2, x1, x2-1) + M(:, 2, x1, x2); % |down>_2 move
end
end
M = M_new; % Update the state
end

% Compute probabilities
probs = zeros(2*n+1, 2*n+1);
for x1 = 1:2*n+1
for x2 = 1:2*n+1
probs(x1, x2) = sum(sum(abs(M(:, :, x1, x2)).^2));
end
end
probs = probs/sum(probs(:));
% Plotting
x_vals = linspace(-n, n, 2*n+1);
y_vals = linspace(-n, n, 2*n+1);
[X, Y] = meshgrid(x_vals, y_vals);
figure;
surf(X, Y, probs, ’EdgeColor’, ’none’);
colorbar;
xlabel(’Lattice points - Particle 1’);
ylabel(’Lattice points - Particle 2’);
zlabel(’Probability’);
title(’Initial state: 1/sqrt(2)(|0 ↑>_1 |0 ↓>_2 - |0 ↓>_1 |0 ↑>_2)’);

19
4.8 MATLAB Code and Simulation result for Bosonic En-
tangled State
n = 10; % Number of steps

% Define the 4D array for the wave function (with spin and position indices)
M = zeros(2, 2, 2*n+1, 2*n+1);

% Initialize psi: 1/sqrt(2)(|0 ↑>_1 |0 ↓>_2 + |0 ↓>_1 |0 ↑>_2)


M(1, 2, n+1, n+1) = 1/sqrt(2); % |0 ↑>_1 |0 ↓>_2
M(2, 1, n+1, n+1) = 1/sqrt(2); % |0 ↓>_1 |0 ↑>_2

% Hadamard coin operator


H = hadamard(2);
H = H / norm(H);
Coin = kron(H, H);

% Main loop for random walk steps


for i = 1:n
% Apply coin operator to all positions
for x1 = 1:2*n+1
for x2 = 1:2*n+1
M(:, :, x1, x2) = reshape(Coin * reshape(M(:, :, x1, x2), [4, 1]), [2, 2]);
end
end

20
% Apply shift operator
M_new = zeros(size(M));
for x1 = 2:2*n
for x2 = 2:2*n
M_new(1, :, x1+1, x2) = M_new(1, :, x1+1, x2) + M(1, :, x1, x2); % |up>_1 move r
M_new(2, :, x1-1, x2) = M_new(2, :, x1-1, x2) + M(2, :, x1, x2); % |down>_1 move
M_new(:, 1, x1, x2+1) = M_new(:, 1, x1, x2+1) + M(:, 1, x1, x2); % |up>_2 move r
M_new(:, 2, x1, x2-1) = M_new(:, 2, x1, x2-1) + M(:, 2, x1, x2); % |down>_2 move
end
end
M = M_new; % Update the state
end

% Compute probabilities
probs = zeros(2*n+1, 2*n+1);
for x1 = 1:2*n+1
for x2 = 1:2*n+1
probs(x1, x2) = sum(sum(abs(M(:, :, x1, x2)).^2));
end
end
probs = probs/sum(probs(:));
% Plotting
x_vals = linspace(-n, n, 2*n+1);
y_vals = linspace(-n, n, 2*n+1);
[X, Y] = meshgrid(x_vals, y_vals);
figure;
surf(X, Y, probs, ’EdgeColor’, ’none’);
colorbar;
xlabel(’Lattice points - Particle 1’);
ylabel(’Lattice points - Particle 2’);
zlabel(’Probability’);
title(’Initial state: 1/sqrt(2)(|0 ↑>_1 |0 ↓>_2 + |0 ↓>_1 |0 ↑>_2)’);

21
5 References
A. Sah, Classical and Quantum Random Walks, 2021
J. Kempe, ”Quantum random walks: An introductory overview,” Contemporary
Physics, vol. 44, no. 4, pp. 307–327, 2003.

22

You might also like