# Are there any test examples of Octave and Quantum Entanglement?

I have octave and the package running.

This is an example of what I did so far -

octave:3> s1 = state(normalize(ket([1,0])+ket([0,1])))
s1 =

0.00000   0.00000   0.00000   0.00000
0.00000   0.50000   0.50000   0.00000
0.00000   0.50000   0.50000   0.00000
0.00000   0.00000   0.00000   0.00000



How would I see whether or not a state is entangled? Are there any examples using octave demonstrating entanglement?

• It is not clear what you mean by saying that "I did not see any entanglement". The state you have specified is an example of a Bell state, which are entangled states. You can test entanglement of such states by using what is called the Schmidt decomposition. – biryani Nov 9 '18 at 7:59
• OK. I will research Schmidt decompositions. Thanks. – Trevor Lee Oakley Nov 9 '18 at 8:22
• s1 is correct. The program sees the entanglement just fine even if it is not visually obvious to you in this form. – AHusain Nov 9 '18 at 13:15
• Yes I need to research more. I just saw about Julia Labs too. – Trevor Lee Oakley Nov 9 '18 at 15:13
• You might be interested in How do I show that a two-qubit state is an entangled state? and How to show that an n-level system is entangled?. – Sanchayan Dutta Nov 10 '18 at 10:23

There are a few tests of whether a two qubit state is entangled. One is to perform the so-called 'partial transpose', which can be done with the partialtranspose function in quantum-octave. If the resulting matrix has any negative eigenvalues, you know that your original state was entangled.
Another test works only when your two qubit state is pure (note: a state can be said to be either pure or mixed, depending on whether it has only a single non-zero eigenvalue, or multiple non-zero eigenvalues). To test this you can look at the eigenvalues. Or you can calculate the Von Neumann entropy with vnentropy. This returns a value of zero only for pure states.
Once you have a pure state of two qubits and want to test for entanglement, your next step is to perform a partial trace using ptrace. This will give a description of the state of just one of your qubits. If this state is also pure, your overall two qubit state is not entangled. But if it is mixed, it is entangled. To determine which is true, you can again use vnentropy. The result of this can be regarded as a measure of how entangled the state is.
Another measure of entanglement, and one that works even when your overall state is the concurrence. This can be calculated in quantum-octave with concurrence.