I have two lists $A(k,m)$ and $B(k,m)$ given by
A[k_, m_] := Prepend[Table[k/m + (l - 1)/(m + 1), {l, 0, m}], 1]
B[k_, m_] := Prepend[Table[(k + l)/m, {l, 0, m - 1}], (m + k)/m]
for any choices of $m=2,4,6,\dots$ and $k=1,2,3,\dots,m$.
What I'm trying to do is define new lists $a(k,m)$ and $b(k,m)$, which are the same as $A$ and $B$ except all common elements have been dropped. For example, consider
In[23]:= A[2, 4]
B[2, 4]
Out[23]= {1, 3/10, 1/2, 7/10, 9/10, 11/10}
Out[24]= {3/2, 1/2, 3/4, 1, 5/4}
We see each list has a common element of $1/2$ and $1$ so in this case $a(2,4)=\{3/10,7/10,9/10,11/10\}$ and $b(2,4)=\{3/2,3/4,5/4\}$.
I first tried writing DeleteDuplicates[Flatten[{A[2, 4], B[2, 4]}]]
with the intent to then split the result back up into the two lists $a$ and $b$; however, I now see that DeleteDuplicates[]
will not remove all occurences of a duplicated value. I also looked at the Drop[]
function which may be helpful but still its not clear to me how I would use it.
common = Intersection[A[2, 4], B[2, 4]]
andDeleteCases[A[2, 4], x_ /; MemberQ[common, x]]
and similarly for the other case. $\endgroup$