1

This question should be theoretically simple, yet I'm struggling as something may be incorrect about my code. I am trying to plot a graph of the maximum probability ($P(x)$) of a given system against CHSH violation values. We can do this using the expectation values through the NPA moment matrix and create an SDP where I maximise $(1+\langle A_0 \rangle)/2$. This should give me $P(0)$. The constraints lie in making sure the correct elements of the moment matrix sum up to a given CHSH value and the matrix is positive semi-definite.

However, I get values of 1 for all values of the inequality. Rather the curve should be around 1 for values 2 or less and curve to 1/2 for maximum violations of the CHSH Bell inequality (this is for two measurements). Are there more constraints to be added or am I missing something?

chsh_values = np.linspace(2, 2*np.sqrt(2), 100)
max_px_values = []
for chsh in chsh_values:
    # Define the moment matrix (5x5 for this setup)
    M = cp.Variable((5, 5), symmetric=True)
# Objective function: Maximize (1 + <A0>) / 2
objective = cp.Maximize((1 + M[0, 1]) / 2)

# CHSH constraint
constraints = [ 
            M[1, 3] + M[2, 3] + M[1, 4] - M[2, 4] == chsh, 
            M[0, 0] == 1, M[1, 1] == 1, M[2, 2] == 1, M[3, 3] == 1, M[4, 4] == 1,
            M >> 0,
            ]

# Solve the problem
prob = cp.Problem(objective, constraints)
prob.solve(solver=cp.MOSEK)

max_px_value = prob.value
max_px_values.append(round(max_px_value, 3))

# Print the moment matrix and the maximum value
print(f"CHSH Value: {chsh}")
print("Moment Matrix:\n", M.value)
print("Maximum (1 + expectation of A0) / 2:", max_px_value)
print("--------------------------------------------------")

```

FDGod
  • 3,000
  • 2
  • 7
  • 31

0 Answers0