Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Concurrence in Mathematica

  1. Apr 28, 2015 #1
    Hi guys!
    I have an unsolved problem. I'm going to calculate the concurrence for pure 2-qubit states:
    |Ψ>=a| up up >+b|up down> +c|down up> +d | down down >
    where up and down stay for uparrow and downarrow.
    The concurrence is defined as:

    C = 2|ad-bc|≥0

    I have found the vector Ψ3= 1/2 (1,1, cos (φ/2) - sin (φ/2), cos (φ/2) + sin (φ/2)), by the effect of an entangling gate.

    I have written the single elements of the vector as

    a = Flatten[Ψ3][[1]]
    b = Flatten[Ψ3][[1]]
    and so on

    but it is wrong.
    The concurrence should be C=sin(φ/2).
    Could you help me?

    Thanks in advance.

    Kind regards
     
  2. jcsd
  3. Apr 28, 2015 #2

    Dale

    Staff: Mentor

    I put it in to Mathematica just now and got Abs[Sin[φ/2]]. That seems correct to me.

    Did you use capital letters for Sin and Cos, and square brackets for the function calls, and curly braces for the vector?
     
  4. Apr 29, 2015 #3
    Hi Dalespam,
    thanks for helping me.
    I put the values of a,b,c and d into the formula

    C= 2 Abs [ad-bc]. (1)
    But I didn't get Abs[Sin ..].
    The error occurs because C is protected but it occurs again when I change the letter C. Is it correct the code (1) that I used? Thanks in advance

    Pa. Yes, I used capital letters for trigonometrical function, and so on... But an error occurs.
     
  5. Apr 29, 2015 #4
    The code is as follow:

    Code (Text):
    psi = {1, 1, Cos[\[Psi]/2] - Sin[\[Psi]/2],
        Cos[\[Psi]/2] + Sin[\[Psi]/2]}/2;
    con = 2 Abs[psi[[1]] psi[[4]] - psi[[2]] psi[[3]]] // FullSimplify
     
  6. Apr 29, 2015 #5
    Many thanks, Quantioner. Now it works. I found on the net the code for the partial trace of a multiqubit system (PartialTraceGeneral[ρ,dim,sys) but there isn't a similar code in mathematica (not in mine ).
    I need to find the partial trace of two subsystem, A and B, such as:

    \begin{matrix} 1/2 & 1/2 \cos (\phi /2) \\ 1/2 \cos (\phi /2) & 1/2 \end{matrix}

    and

    \begin{matrix} 1/2 - 1/4 \sin (\phi /2) & 1/2 \cos^2 (\phi /2) \\ 1/2 \cos^2 (\phi /2) & 1/2+1/4 \sin (\phi /2) \end{matrix}

    How can I find the partial traces? Is there any particular code to use ( I hope that... my teacher wants a "beautiful and refined" program, using few lines of code)?
    Thanks for helping me.
     
  7. Apr 29, 2015 #6
    Luckily, I have defined such a function.
    Code (Text):

    ptrace[mat_, d_, k_] :=
     With[{d1 = Length[mat]/d},
      Table[Total[
        mat[[FromDigits[({Reverse, Identity}[[k]])[{m, #}], d] - d,
           FromDigits[({Reverse, Identity}[[k]])[{n, #}], d] - d]] & /@
         Range[d]], {m, 1, d1}, {n, 1, d1}]]
    (*partial trace mat the k-th subsystem whose dimension is d, where \
    mat should be a square matrix*)
     
    You can define functions for yourself.
     
  8. Apr 29, 2015 #7
    I'll try to do my best :) Thanks Quantioner.
     
  9. Apr 29, 2015 #8
    Quantioner, I'm sorry but I don't understand your code. Could you, please, explain substitutions to me? If it is possible and if you want or can do it. Thank you anyway.

    P.s. There are too few arguments in the code:
    http://imageshack.com/a/img905/1738/zUdlDv.png [Broken] http://imageshack.com/a/img537/6780/SNMRUz.png [Broken]
     
    Last edited by a moderator: May 7, 2017
  10. Apr 29, 2015 #9
    I will reply you tomorrow.
     
  11. Apr 29, 2015 #10
    Thank you for your time and for being so helpful.
     
  12. Apr 29, 2015 #11
  13. Apr 30, 2015 #12
    Hi Quantioner.
    I apologize for my delay in answering.
    I have just rewritten your code and the calculation is correct. Now, I’m trying to complete the exercise.
    (If I continue to encounter difficulties, can I contact you in this topic? )

    Thanks for all the help you gave me.
     
  14. Apr 30, 2015 #13
    You're always welcome.
     
  15. May 2, 2015 #14
    Famous last words, Quantioner!
    I tried to use the code for entropy ( Entropy[k, density operator]) - k is the base of the logarithm (2) - but I have this error message:
    Entropy::targ: "Argument at position 2 should be a List, a SparseArray, or a String".
    I need the entropy of entanglement, using the von Neumann entropy of a density operator:
    S(ρ) = - Tr {ρ log2 (ρ) }
    where Tr is the trace and ρ is equal to ρA (or ρB).
    Could you help me?

    Thanks in advance ( and again!).
     
  16. May 2, 2015 #15
    You should re-define the entropy function since the original one can not be applied in quantum case. BTW, the von Neumann entropy of a density operator ##\rho## is ##{\rm Tr}[\rho \ln(\rho)]## but not ##{\rm Tr}[\rho \log_2(\rho)]##.
    Code (Text):
    Ventropy[op_] := -Tr[op MatrixLog[op]]
    op = ({
        {1/2, 1/3},
        {1/3, 1/2}
       });
    Ventropy[op]
     
    Last edited: May 2, 2015
  17. May 3, 2015 #16
    Thanks, Quantioner. I forget that if there aren't "enough" functions, I'll need define new functions!
    Why the von Neumann entropy is -Tr[ρ ln (ρ)] but not -Tr [ρ log2 (ρ)]? I used this formula because it is written in this way in an article.
    Could you, please, explain to me why you write

    op = ({
    {1/2, 1/3},
    {1/3, 1/2}
    }); ? Is it an example (... I should substitute op with ρAB)?

    I need to find the resulting entanglement entropy E(ρ3)=S(ρA)=S(ρB).
     
  18. May 3, 2015 #17
  19. May 3, 2015 #18
    Ok, Quantioner. I tried to substitute my density operators into your code, but I have these outputs:

    http://imageshack.com/a/img537/706/bHI3WC.jpg [Broken]

    Where am I wrong?
     
    Last edited by a moderator: May 7, 2017
  20. May 3, 2015 #19
    I'm sorry that the definition should be changed to
    Code (Text):

    Ventropy[op_] := -Tr[op.MatrixLog[op]]
    op = ({
        {1/2, 1/3},
        {1/3, 1/2}
       });
    Ventropy[op]
     
    the result is
    $$
    -\frac{2}{3} \left(\frac{\log (6)}{2}-\frac{1}{2} \log \left(\frac{6}{5}\right)\right)+\frac{\log (6)}{2}+\frac{1}{2} \log \left(\frac{6}{5}\right)
    $$
    There is no wrong in your case when I run in my mathematica, you'd better send me your mathematica file.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Concurrence in Mathematica
  1. In mathematica (Replies: 4)

  2. [Mathematica] Plot 3D (Replies: 1)

Loading...