infix operators, type 1: +


 + :
    description:
        ket1 + ket2
        the infix operator for ket addition
        If the label of ket1 is the same as the label of ket2, then add their coefficients
        If the labels are distinct, then we have a superposition
        Where a superposition is the sum of one or more kets
        Note, the identity element for ket addition is the empty ket |>
        Ie, sp + |> == |> + sp == sp, for any superposition sp

    examples:
        -- adding two apples with three apples:
        2|apple> + 3|apple>
            5|apple>

        -- adding 5 apples with 7 oranges:
        -- we can't add them directly, they have different labels, so return a superposition:
        5|apple> + 7|orange>
            5|apple> + 7|orange>

    see also:
         - , _ , __ , :_ , . 

Home