### Related

##### setdifference-union

S_1 : {{}, {{}}, 1, 2...

S_2 : {{}};

setdifference (S_1, ...

Calculate

##### setdifference-union

S_1 : {{}, {{}}, 1, 2...

S_2 : {1, 2, 3};

setdifference (S_1, ...

Calculate

##### setdifference

S_1 : {{}, {{}}, 1, 2...

S_2 : {1, 2, 3};

setdifference (S_1, ...

Calculate

##### setdifference

A:set(1,2,3,4,5,6,7,8);

B:set(2,4,6,8,10,12,1...

C:set(3,6,9,12,18);

Calculate

##### setdifference

S_1 : {a, b, c, x, y,...

S_2 : {aa, bb, c, x,...

setdifference (S_1, ...

Calculate

##### setdifference-union

S_1 : {{}, {{}}, 1, 2...

S_2 : {};

setdifference (S_1, ...

Calculate

##### setdifference

s_1 : {a, b, c, x, y,...

s_2 : {aa, bb, c, x,...

setdifference (s_1, ...

Calculate

##### setdifference

S_1 : {{}, {{}}, 1, 2...

S_2 : {1, 2, 3};

setdifference (S_1, ...

Calculate

##### setdifference

S_1 : {{}, {{}}, 1, 2...

S_2 : {1, 2, 3};

setdifference (S_1, ...

Calculate

##### setdifference-union

S_1 : {{}, {{}}, 1, 2...

S_2 : {{}};

setdifference (S_1, ...

Calculate

### setdifference

Run Example
```(%i1)S_1 : {a, b, c, x, y, z};
(%o1)                         {a, b, c, x, y, z}
(%i2)  S_2 : {aa, bb, c, x, y, zz};
(%o2)                        {aa, bb, c, x, y, zz}
(%i3)  setdifference (S_1, S_2);
(%o3)                              {a, b, z}
(%i4)  setdifference (S_2, S_1);
(%o4)                            {aa, bb, zz}
(%i5)  setdifference (S_1, S_1);
(%o5)                                 {}
(%i6)  setdifference (S_1, {});
(%o6)                         {a, b, c, x, y, z}
(%i7)  setdifference ({}, S_1);
(%o7)                                 {}
(%i8) ```
Run Example
```A:matrix([-1,-1,1,0,0,1],[-1,-2,0,1,0,2],[-1,-3,0,0,1,3],[0,-1,-1,1,0,1],[0,-2,-1,0,1,2],[0,-1,0,-1,1,1]);
[ - 1  - 1   1    0   0  1 ]
[                          ]
[ - 1  - 2   0    1   0  2 ]
[                          ]
[ - 1  - 3   0    0   1  3 ]
(%o1)                    [                          ]
[  0   - 1  - 1   1   0  1 ]
[                          ]
[  0   - 2  - 1   0   1  2 ]
[                          ]
[  0   - 1   0   - 1  1  1 ]
(%i2) n:rank(A);
(%o2)                                  3
(%i3) B[1,2,3]:submatrix(4,5,A);
[ - 1  - 1  1   0   0  1 ]
[                        ]
[ - 1  - 2  0   1   0  2 ]
(%o3)                     [                        ]
[ - 1  - 3  0   0   1  3 ]
[                        ]
[  0   - 1  0  - 1  1  1 ]
(%i4) input:{1, 2, 3, 4, 5, 6};
(%o4)                         {1, 2, 3, 4, 5, 6}
(%i5) res:powerset ({1, 2, 3, 4, 5, 6}, 4);
(%o5) {{1, 2, 3, 4}, {1, 2, 3, 5}, {1, 2, 3, 6}, {1, 2, 4, 5}, {1, 2, 4, 6},
{1, 2, 5, 6}, {1, 3, 4, 5}, {1, 3, 4, 6}, {1, 3, 5, 6}, {1, 4, 5, 6},
{2, 3, 4, 5}, {2, 3, 4, 6}, {2, 3, 5, 6}, {2, 4, 5, 6}, {3, 4, 5, 6}}
(%i6) i:1;
(%o6)                                  1
(%i7) for resi in res do print (elem[i]:listify(setdifference(input,resi)), i:i+1);
[5, 6] 2
[4, 6] 3
[4, 5] 4
[3, 6] 5
[3, 5] 6
[3, 4] 7
[2, 6] 8
[2, 5] 9
[2, 4] 10
[2, 3] 11
[1, 6] 12
[1, 5] 13
[1, 4] 14
[1, 3] 15
[1, 2] 16
(%o7)                                done
(%i8) ```
Run Example
```A:matrix([-1,-1,1,0,0,1],[-1,-2,0,1,0,2],[-1,-3,0,0,1,3],[0,-1,-1,1,0,1],[0,-2,-1,0,1,2],[0,-1,0,-1,1,1]);
[ - 1  - 1   1    0   0  1 ]
[                          ]
[ - 1  - 2   0    1   0  2 ]
[                          ]
[ - 1  - 3   0    0   1  3 ]
(%o1)                    [                          ]
[  0   - 1  - 1   1   0  1 ]
[                          ]
[  0   - 2  - 1   0   1  2 ]
[                          ]
[  0   - 1   0   - 1  1  1 ]
(%i2) n:rank(A);
(%o2)                                  3
(%i3) B[1,2,3]:submatrix(4,5,A);
[ - 1  - 1  1   0   0  1 ]
[                        ]
[ - 1  - 2  0   1   0  2 ]
(%o3)                     [                        ]
[ - 1  - 3  0   0   1  3 ]
[                        ]
[  0   - 1  0  - 1  1  1 ]
(%i4) input:{1, 2, 3, 4, 5, 6};
(%o4)                         {1, 2, 3, 4, 5, 6}
(%i5) res:powerset ({1, 2, 3, 4, 5, 6}, 4);
(%o5) {{1, 2, 3, 4}, {1, 2, 3, 5}, {1, 2, 3, 6}, {1, 2, 4, 5}, {1, 2, 4, 6},
{1, 2, 5, 6}, {1, 3, 4, 5}, {1, 3, 4, 6}, {1, 3, 5, 6}, {1, 4, 5, 6},
{2, 3, 4, 5}, {2, 3, 4, 6}, {2, 3, 5, 6}, {2, 4, 5, 6}, {3, 4, 5, 6}}
(%i6) resi:res;
(%o6) {{1, 2, 3, 4}, {1, 2, 3, 5}, {1, 2, 3, 6}, {1, 2, 4, 5}, {1, 2, 4, 6},
{1, 2, 5, 6}, {1, 3, 4, 5}, {1, 3, 4, 6}, {1, 3, 5, 6}, {1, 4, 5, 6},
{2, 3, 4, 5}, {2, 3, 4, 6}, {2, 3, 5, 6}, {2, 4, 5, 6}, {3, 4, 5, 6}}
(%i7) for resi in res do print (resi, resi:setdifference(input,resi));
{1, 2, 3, 4} {5, 6}
{1, 2, 3, 5} {4, 6}
{1, 2, 3, 6} {4, 5}
{1, 2, 4, 5} {3, 6}
{1, 2, 4, 6} {3, 5}
{1, 2, 5, 6} {3, 4}
{1, 3, 4, 5} {2, 6}
{1, 3, 4, 6} {2, 5}
{1, 3, 5, 6} {2, 4}
{1, 4, 5, 6} {2, 3}
{2, 3, 4, 5} {1, 6}
{2, 3, 4, 6} {1, 5}
{2, 3, 5, 6} {1, 4}
{2, 4, 5, 6} {1, 3}
{3, 4, 5, 6} {1, 2}
(%o7)                                done
(%i8) full_listify(resi);
(%o8) [[1, 2, 3, 4], [1, 2, 3, 5], [1, 2, 3, 6], [1, 2, 4, 5], [1, 2, 4, 6],
[1, 2, 5, 6], [1, 3, 4, 5], [1, 3, 4, 6], [1, 3, 5, 6], [1, 4, 5, 6],
[2, 3, 4, 5], [2, 3, 4, 6], [2, 3, 5, 6], [2, 4, 5, 6], [3, 4, 5, 6]]
(%i9) ```

### Related Help

Help for Setdifference