Question: Forming a Matrix from Bra-kets

Dear All

I am evaluating innerproducts between a cartesian basis set with an arbirtary operator, and the result is;

ans = <X|a[11]|X> + <X|a[12]|Y> + <X|a[13]|Z> +

           <Y|a[21]|X> + <Y|a[22]|Y> + <Y|a[23]|Z> +

           <Z|a[31]|X> + <Z|a[32|Y> + <Z|a[33]|Z>

I would like to put this into a matrix form (i.e. removing the bras and kets), so that

ans = [ a[11]      a[12]    a[13]  ]

           [  a[21]    a[22]     a[32]  ]

          [   a[31]   a[32]    a[33]   ]



Please Wait...